1 /******************************************************************************
2  *
3  *  Copyright (C) 2002-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This file contains NV definitions from WIDCOMM's Universal Embedded
22  *  Drivers API.
23  *
24  ******************************************************************************/
25 
26 #ifndef UNV_H
27 #define UNV_H
28 
29 #include "data_types.h"
30 
31 /*******************************************************************************
32 ** NV APIs
33 *******************************************************************************/
34 
35 /**** Storage preferences ****/
36 #define UNV_BLOCK         1
37 #define UNV_BYTE          2
38 #define UNV_NOPREF        3
39 
40 typedef UINT8 tUNV_STORAGE_PREF;
41 
42 /**** Status ****/
43 #define UNV_REINIT      (-1)
44 #define UNV_WRITELOCKED (-2)
45 #define UNV_ERROR       (-3)
46 
47 typedef INT16 tUNV_STATUS;
48 
49 /* Prototype for function to restore defaults to a block */
50 typedef void  (tUNV_DEFAULT_FUNC)(void);
51 
52 /*******************************************************************************
53 ** Function Prototypes
54 *******************************************************************************/
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 #ifndef UDRV_API
61 #define UDRV_API
62 #endif
63 
64 UDRV_API extern void        UNV_Init(void *);
65 UDRV_API extern BOOLEAN     UNV_MapBlock(UINT16, tUNV_STORAGE_PREF, UINT16,
66                                          UINT16, UINT16 *, void *);
67 UDRV_API extern BOOLEAN     UNV_ReadMap(UINT16, tUNV_STORAGE_PREF *, UINT16 *,
68                                         UINT16 *, UINT16 *);
69 UDRV_API extern BOOLEAN     UNV_EraseBlock(UINT16);
70 UDRV_API extern void        UNV_Default(UINT16);
71 UDRV_API extern tUNV_STATUS UNV_Read(UINT16, UINT16, UINT16, UINT16, void *);
72 UDRV_API extern tUNV_STATUS UNV_Write(UINT16, UINT16, UINT16, UINT16, void *);
73 UDRV_API extern tUNV_STATUS UNV_ReadBlock(UINT16, UINT16, void *);
74 UDRV_API extern tUNV_STATUS UNV_WriteBlock(UINT16, void *);
75 UDRV_API extern UINT32      UNV_BytesRemaining(void);
76 UDRV_API extern void        UNV_Consolidate(void);
77 UDRV_API extern tUNV_STATUS UNV_ReadPtr(UINT16, UINT16, UINT8 **);
78 UDRV_API extern tUNV_STATUS UNV_FreePtr(UINT16, UINT16);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* UNV_H */
85