source: svn/trunk/newcon3bcm2_21bu/dta/src/bfdb/bfds.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 4.1 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2010, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: $
11 * $brcm_Revision: $
12 * $brcm_Date: $
13 *
14 * Module Description: flash data store abstraction
15 *
16 * Revision History:
17 *
18 * $brcm_Log: $
19 *
20 *
21 ***************************************************************************/
22
23#if !defined(__BFDS_H__)
24#define __BFDS_H__
25
26/* Flash store handle */
27typedef struct bfds_state * bfds_handle;
28
29typedef struct bfds_properties {
30    unsigned flash_sector_size; /* size of minimum erasable block */
31    unsigned flash_page_size;   /* size of maximum writable block */
32    unsigned flash_total_size;   /* size of flash */
33} bfds_properties;
34
35#define BFDS_OK 0
36#define BFDS_ERROR 1
37
38/***************************************************************************
39Summary:
40        Open block device.
41
42Description:
43        Open block device for reading and writing.
44
45Returns:
46        BFDS_OK or BFDS_ERROR on failure.
47
48See Also:
49        bfds_close()
50
51****************************************************************************/
52int bfds_open (
53                bfds_handle * handle  /* [out] return device handle */
54              );
55
56/***************************************************************************
57Summary:
58        Close block device.
59
60Description:
61        Close block device and release resources.
62
63Returns:
64        BFDS_OK or BFDS_ERROR on failure.
65
66See Also:
67        bfds_open()
68
69****************************************************************************/
70int bfds_close(
71                                bfds_handle handle  /* [in] device handle */
72                           );
73
74/***************************************************************************
75Summary:
76        Read from device at offset.
77
78Description:
79        Read from device at offset, copying data into the buffer provided.
80
81Returns:
82        BFDS_OK or BFDS_ERROR on failure.
83
84See Also:
85        bfds_open()
86
87****************************************************************************/
88int bfds_read(
89                        bfds_handle handle,   /* [in] device handle */
90                        unsigned offset,      /* [in] offset in bytes */
91                        void * data,          /* [out] buffer to copy data into at offset */
92                        unsigned size         /* [in] size of the buffer */
93                        );
94/***************************************************************************
95Summary:
96        Erase the sector/block at offset.
97
98Description:
99        Erase the sector/block at offset.
100
101Returns:
102        BFDS_OK or BFDS_ERROR on failure.
103
104See Also:
105        bfds_open(), bfds_page_program()
106
107****************************************************************************/
108int bfds_sector_erase(
109                                                bfds_handle handle,   /* [in] device handle */
110                                                unsigned offset       /* [in] offset in bytes */
111                                                );
112/***************************************************************************
113Summary:
114        Program the sector/block at offset.
115
116Description:
117        Program the sector/block at offset with the contents of the buffer provided in data.
118        Normaly for flash devices bfds_sector_erase should be called prior to any programming.
119
120Returns:
121        BFDS_OK or BFDS_ERROR on failure.
122
123See Also:
124        bfds_open(), bfds_sector_erase()
125
126****************************************************************************/
127int bfds_page_program(
128                                                bfds_handle handle,   /* [in] device handle */
129                                                unsigned offset,      /* [in] offset in bytes */
130                                                void * data,          /* [in] buffer to program at offset */
131                                                unsigned size         /* [in] size of the buffer */
132                                                );
133/***************************************************************************
134Summary:
135    Retrieve parameters of flash device.
136
137Description:
138    Retrieve parameters of flash device such as sector and page sizes.
139
140Returns:
141    BFDS_OK or BFDS_ERROR on failure.
142
143See Also:
144    bfds_open()
145
146****************************************************************************/
147int bfds_get_properties (
148    bfds_handle handle,   /* [in] device handle */
149    bfds_properties * properties /* [out] details of flash device */
150    );
151
152#endif
Note: See TracBrowser for help on using the repository browser.