unv.h revision e9629bad30a9f478b336ab46b8e6e02f7f87af46
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
40typedef UINT8 tUNV_STORAGE_PREF;
41
42/**** Status ****/
43#define UNV_REINIT      (-1)
44#define UNV_WRITELOCKED (-2)
45#define UNV_ERROR       (-3)
46
47typedef INT16 tUNV_STATUS;
48
49/* Prototype for function to restore defaults to a block */
50typedef void  (tUNV_DEFAULT_FUNC)(void);
51
52/*******************************************************************************
53** Function Prototypes
54*******************************************************************************/
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60#ifndef UDRV_API
61#define UDRV_API
62#endif
63
64UDRV_API extern void        UNV_Init(void *);
65UDRV_API extern BOOLEAN     UNV_MapBlock(UINT16, tUNV_STORAGE_PREF, UINT16,
66                                         UINT16, UINT16 *, void *);
67UDRV_API extern BOOLEAN     UNV_ReadMap(UINT16, tUNV_STORAGE_PREF *, UINT16 *,
68                                        UINT16 *, UINT16 *);
69UDRV_API extern BOOLEAN     UNV_EraseBlock(UINT16);
70UDRV_API extern void        UNV_Default(UINT16);
71UDRV_API extern tUNV_STATUS UNV_Read(UINT16, UINT16, UINT16, UINT16, void *);
72UDRV_API extern tUNV_STATUS UNV_Write(UINT16, UINT16, UINT16, UINT16, void *);
73UDRV_API extern tUNV_STATUS UNV_ReadBlock(UINT16, UINT16, void *);
74UDRV_API extern tUNV_STATUS UNV_WriteBlock(UINT16, void *);
75UDRV_API extern UINT32      UNV_BytesRemaining(void);
76UDRV_API extern void        UNV_Consolidate(void);
77UDRV_API extern tUNV_STATUS UNV_ReadPtr(UINT16, UINT16, UINT8 **);
78UDRV_API extern tUNV_STATUS UNV_FreePtr(UINT16, UINT16);
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif /* UNV_H */
85