]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sub1ghz-sensor-to-cloud/tida01476.git/blob - sensor_cc1310lp/Application/Services/nvintf.h
Initial Commit
[sub1ghz-sensor-to-cloud/tida01476.git] / sensor_cc1310lp / Application / Services / nvintf.h
1 /******************************************************************************
3  @file  nvintf.h
5  @brief Function pointer interface to the NV API
7  Group: WCS, LPC, BTS
8  Target Device: CC13xx
10  ******************************************************************************
11  
12  Copyright (c) 2014-2017, Texas Instruments Incorporated
13  All rights reserved.
15  Redistribution and use in source and binary forms, with or without
16  modification, are permitted provided that the following conditions
17  are met:
19  *  Redistributions of source code must retain the above copyright
20     notice, this list of conditions and the following disclaimer.
22  *  Redistributions in binary form must reproduce the above copyright
23     notice, this list of conditions and the following disclaimer in the
24     documentation and/or other materials provided with the distribution.
26  *  Neither the name of Texas Instruments Incorporated nor the names of
27     its contributors may be used to endorse or promote products derived
28     from this software without specific prior written permission.
30  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
34  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
37  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  ******************************************************************************
43  Release Name: simplelink_cc13x0_sdk_1_30_00_06"
44  Release Date: 2017-03-08 14:43:25
45  *****************************************************************************/
46 #ifndef NVINTF_H
47 #define NVINTF_H
49 #include <stdbool.h>
50 #include <stdint.h>
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif
57 //*****************************************************************************
58 // Constants and definitions
59 //*****************************************************************************
61 // NV system ID codes
62 #define NVINTF_SYSID_NVDRVR 0
63 #define NVINTF_SYSID_ZSTACK 1
64 #define NVINTF_SYSID_TIMAC  2
65 #define NVINTF_SYSID_REMOTI 3
66 #define NVINTF_SYSID_BLE    4
67 #define NVINTF_SYSID_6MESH  5
68 #define NVINTF_SYSID_APP    6
70 // NV driver status codes
71 #define NVINTF_SUCCESS      0
72 #define NVINTF_FAILURE      1
73 #define NVINTF_CORRUPT      2
74 #define NVINTF_NOTREADY     3
75 #define NVINTF_BADPARAM     4
76 #define NVINTF_BADLENGTH    5
77 #define NVINTF_BADOFFSET    6
78 #define NVINTF_BADITEMID    7
79 #define NVINTF_BADSUBID     8
80 #define NVINTF_BADSYSID     9
81 #define NVINTF_NOTFOUND     10
82 #define NVINTF_LOWPOWER     11
83 #define NVINTF_BADVERSION   12
85 //*****************************************************************************
86 // Typedefs
87 //*****************************************************************************
89 /**
90  * NV Item Identification structure
91  */
92 typedef struct nvintf_itemid_t
93 {
94     //! NV System ID - identifies system (ZStack, BLE, App, OAD...)
95     uint8_t systemID;
96     //! NV Item ID
97     uint16_t itemID;
98     //! NV Item sub ID
99     uint16_t subID;
100 } NVINTF_itemID_t;
102 //! Function pointer definition for the NVINTF_initNV() function
103 typedef uint8_t (*NVINTF_initNV)(void *param);
105 //! Function pointer definition for the NVINTF_compactNV() function
106 typedef uint8_t (*NVINTF_compactNV)(uint16_t minBytes);
108 //! Function pointer definition for the NVINTF_createItem() function
109 typedef uint8_t (*NVINTF_createItem)(NVINTF_itemID_t id,
110                                      uint32_t length,
111                                      void *buffer );
113 //! Function pointer definition for the NVINTF_deleteItem() function
114 typedef uint8_t (*NVINTF_deleteItem)(NVINTF_itemID_t id);
116 //! Function pointer definition for the NVINTF_readItem() function
117 typedef uint8_t (*NVINTF_readItem)(NVINTF_itemID_t id,
118                                    uint16_t offset,
119                                    uint16_t length,
120                                    void *buffer );
122 //! Function pointer definition for the NVINTF_writeItem() function
123 typedef uint8_t (*NVINTF_writeItem)(NVINTF_itemID_t id,
124                                     uint16_t length,
125                                     void *buffer );
127 //! Function pointer definition for the NVINTF_writeItemEx() function
128 typedef uint8_t (*NVINTF_writeItemEx)(NVINTF_itemID_t id,
129                                       uint16_t offset,
130                                       uint16_t length,
131                                       void *buffer );
133 //! Function pointer definition for the NVINTF_getItemLen() function
134 typedef uint32_t (*NVINTF_getItemLen)(NVINTF_itemID_t id);
136 //! Structure of NV API function pointers
137 typedef struct nvintf_nvfuncts_t
139     //! Initialization function
140     NVINTF_initNV initNV;
141     //! Compact NV function
142     NVINTF_compactNV compactNV;
143     //! Create item function
144     NVINTF_createItem createItem;
145     //! Delete NV item function
146     NVINTF_deleteItem deleteItem;
147     //! Read item function
148     NVINTF_readItem readItem;
149     //! Write item function
150     NVINTF_writeItem writeItem;
151     //! Write existing item function
152     NVINTF_writeItemEx writeItemEx;
153     //! Get item length function
154     NVINTF_getItemLen getItemLen;
155 } NVINTF_nvFuncts_t;
157 //*****************************************************************************
158 //*****************************************************************************
160 #ifdef __cplusplus
162 #endif
164 #endif /* NVINTF_H */