added files
[bcm963xx.git] / shared / include / flash_api.h
1 /*
2 <:copyright-broadcom
3
4  Copyright (c) 2005 Broadcom Corporation
5  All Rights Reserved
6  No portions of this material may be reproduced in any form without the
7  written permission of:
8           Broadcom Corporation
9           16215 Alton Parkway
10           Irvine, California 92619
11  All information contained in this document is Broadcom Corporation
12  company private, proprietary, and trade secret.
13
14 :>
15 */
16 /***************************************************************************
17  * File Name  : flash_api.h
18  *
19  * Description: This file contains definitions and prototypes for a public
20  *              flash device interface and an internal flash device interface.
21  ***************************************************************************/
22
23 #if !defined(_FLASH_API_H)
24 #define _FLASH_API_H
25
26 #if __cplusplus
27 extern "C" {
28 #endif
29
30 /* Flash definitions. */
31 #define FLASH_API_OK                1
32 #define FLASH_API_ERROR             -1
33
34 /* Public Interface Prototypes. */
35 int flash_init(void);
36 int flash_sector_erase_int(unsigned short sector);
37 int flash_read_buf(unsigned short sector, int offset, unsigned char *buffer,
38     int numbytes);
39 int flash_write_buf(unsigned short sector, int offset, unsigned char *buffer,
40     int numbytes);
41 int flash_get_numsectors(void);
42 int flash_get_sector_size(unsigned short sector);
43 unsigned char *flash_get_memptr(unsigned short sector);
44 int flash_get_blk(int addr);
45 int flash_get_total_size(void);
46 int flash_get_total_memory_mapped_size(void);
47
48
49 /* Internal Flash Device Driver Information. */
50 typedef struct flash_device_info_s
51 {
52     unsigned short flash_device_id;
53     char flash_device_name[30];
54
55     int (*fn_flash_sector_erase_int) (unsigned short sector);
56     int (*fn_flash_read_buf) (unsigned short sector, int offset,
57         unsigned char *buffer, int numbytes);
58     int (*fn_flash_write_buf) (unsigned short sector, int offset,
59         unsigned char *buffer, int numbytes);
60     int (*fn_flash_get_numsectors) (void);
61     int (*fn_flash_get_sector_size) (unsigned short sector);
62     unsigned char * (*fn_flash_get_memptr) (unsigned short sector);
63     int (*fn_flash_get_blk) (int addr);
64     int (*fn_flash_get_total_size) (void);
65     int (*fn_flash_get_total_memory_mapped_size) (void);
66 } flash_device_info_t;
67
68 #if __cplusplus
69 }
70 #endif
71
72 #endif /* _FLASH_API_H */
73