Example

Dependencies:   FXAS21002 FXOS8700Q

Committer:
maygup01
Date:
Tue Nov 19 09:49:38 2019 +0000
Revision:
0:11cc2b7889af
Example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maygup01 0:11cc2b7889af 1 // ----------------------------------------------------------------------------
maygup01 0:11cc2b7889af 2 // Copyright 2016-2017 ARM Ltd.
maygup01 0:11cc2b7889af 3 //
maygup01 0:11cc2b7889af 4 // SPDX-License-Identifier: Apache-2.0
maygup01 0:11cc2b7889af 5 //
maygup01 0:11cc2b7889af 6 // Licensed under the Apache License, Version 2.0 (the "License");
maygup01 0:11cc2b7889af 7 // you may not use this file except in compliance with the License.
maygup01 0:11cc2b7889af 8 // You may obtain a copy of the License at
maygup01 0:11cc2b7889af 9 //
maygup01 0:11cc2b7889af 10 // http://www.apache.org/licenses/LICENSE-2.0
maygup01 0:11cc2b7889af 11 //
maygup01 0:11cc2b7889af 12 // Unless required by applicable law or agreed to in writing, software
maygup01 0:11cc2b7889af 13 // distributed under the License is distributed on an "AS IS" BASIS,
maygup01 0:11cc2b7889af 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
maygup01 0:11cc2b7889af 15 // See the License for the specific language governing permissions and
maygup01 0:11cc2b7889af 16 // limitations under the License.
maygup01 0:11cc2b7889af 17 // ----------------------------------------------------------------------------
maygup01 0:11cc2b7889af 18
maygup01 0:11cc2b7889af 19 #ifndef ARM_PAL_KV_H
maygup01 0:11cc2b7889af 20 #define ARM_PAL_KV_H
maygup01 0:11cc2b7889af 21
maygup01 0:11cc2b7889af 22 #include <stdint.h>
maygup01 0:11cc2b7889af 23 #include <stddef.h>
maygup01 0:11cc2b7889af 24
maygup01 0:11cc2b7889af 25 #ifdef __cplusplus
maygup01 0:11cc2b7889af 26 extern "C" {
maygup01 0:11cc2b7889af 27 #endif
maygup01 0:11cc2b7889af 28
maygup01 0:11cc2b7889af 29
maygup01 0:11cc2b7889af 30 #define ARM_PAL_KV_KEY_MAX_PATH 220
maygup01 0:11cc2b7889af 31
maygup01 0:11cc2b7889af 32 typedef struct arm_pal_key_value_api {
maygup01 0:11cc2b7889af 33 uint32_t (*keySize)();
maygup01 0:11cc2b7889af 34 void (*keyInit)(void *key);
maygup01 0:11cc2b7889af 35
maygup01 0:11cc2b7889af 36 int32_t (*Close)(void *hkey);
maygup01 0:11cc2b7889af 37 int32_t (*Create)(const char *key_name, size_t value_len, const void *kdesc, void *hkey);
maygup01 0:11cc2b7889af 38 int32_t (*Delete)(void *hkey);
maygup01 0:11cc2b7889af 39 int32_t (*Find)(const char *key_name_query, const void *previous, void *next);
maygup01 0:11cc2b7889af 40 int32_t (*Flush)(void);
maygup01 0:11cc2b7889af 41 int32_t (*GetKeyName)(void *hkey, char *key_name, uint8_t *key_len);
maygup01 0:11cc2b7889af 42 int32_t (*GetValueLen)(void *hkey, size_t *value_len);
maygup01 0:11cc2b7889af 43 int32_t (*Initialize)(
maygup01 0:11cc2b7889af 44 void(*callback)(int32_t status, int32_t cmd_code, void *client_context, void *handle),
maygup01 0:11cc2b7889af 45 void *client_context);
maygup01 0:11cc2b7889af 46 int32_t (*PowerControl)(uint32_t state);
maygup01 0:11cc2b7889af 47 int32_t (*Read)(void *hkey, void *data, size_t *len);
maygup01 0:11cc2b7889af 48 int32_t (*Open)(const char *key_name, uint32_t flags, void *hkey);
maygup01 0:11cc2b7889af 49 int32_t (*Rseek)(void *hkey, size_t offset);
maygup01 0:11cc2b7889af 50 int32_t (*Uninitialize)(void);
maygup01 0:11cc2b7889af 51 int32_t (*Write)(void *hkey, const char *data, size_t *len);
maygup01 0:11cc2b7889af 52 } arm_pal_key_value_api;
maygup01 0:11cc2b7889af 53
maygup01 0:11cc2b7889af 54
maygup01 0:11cc2b7889af 55 #define ARM_PAL_KV_OPENMODE_RD (1 << 3)
maygup01 0:11cc2b7889af 56
maygup01 0:11cc2b7889af 57 uint32_t ARM_PAL_KV_keySize(const arm_pal_key_value_api *api);
maygup01 0:11cc2b7889af 58 void ARM_PAL_KV_keyInit(const arm_pal_key_value_api *api, void *key);
maygup01 0:11cc2b7889af 59 int32_t ARM_PAL_KV_Close(const arm_pal_key_value_api *api, void *hkey);
maygup01 0:11cc2b7889af 60 int32_t ARM_PAL_KV_Create(const arm_pal_key_value_api *api, const char *key_name, size_t value_len, const void *kdesc,
maygup01 0:11cc2b7889af 61 void *hkey);
maygup01 0:11cc2b7889af 62 int32_t ARM_PAL_KV_Delete(const arm_pal_key_value_api *api, void *hkey);
maygup01 0:11cc2b7889af 63 int32_t ARM_PAL_KV_Find(const arm_pal_key_value_api *api, const char *key_name_query, const void *previous, void *next);
maygup01 0:11cc2b7889af 64 int32_t ARM_PAL_KV_Flush(const arm_pal_key_value_api *api);
maygup01 0:11cc2b7889af 65 int32_t ARM_PAL_KV_GetKeyName(const arm_pal_key_value_api *api, void *hkey, char *key_name, uint8_t *key_len);
maygup01 0:11cc2b7889af 66 int32_t ARM_PAL_KV_GetValueLen(const arm_pal_key_value_api *api, void *hkey, size_t *value_len);
maygup01 0:11cc2b7889af 67 int32_t ARM_PAL_KV_Initialize(const arm_pal_key_value_api *api, void(*callback)(int32_t status, int32_t cmd_code,
maygup01 0:11cc2b7889af 68 void *client_context, void *handle), void *client_context);
maygup01 0:11cc2b7889af 69 int32_t ARM_PAL_KV_PowerControl(const arm_pal_key_value_api *api, uint32_t state);
maygup01 0:11cc2b7889af 70 int32_t ARM_PAL_KV_Read(const arm_pal_key_value_api *api, void *hkey, void *data, size_t *len);
maygup01 0:11cc2b7889af 71 int32_t ARM_PAL_KV_Open(const arm_pal_key_value_api *api, const char *key_name, uint32_t flags, void *hkey);
maygup01 0:11cc2b7889af 72 int32_t ARM_PAL_KV_Rseek(const arm_pal_key_value_api *api, void *hkey, size_t offset);
maygup01 0:11cc2b7889af 73 int32_t ARM_PAL_KV_Uninitialize(const arm_pal_key_value_api *api);
maygup01 0:11cc2b7889af 74 int32_t ARM_PAL_KV_Write(const arm_pal_key_value_api *api, void *hkey, const char *data, size_t *len);
maygup01 0:11cc2b7889af 75
maygup01 0:11cc2b7889af 76
maygup01 0:11cc2b7889af 77
maygup01 0:11cc2b7889af 78
maygup01 0:11cc2b7889af 79 #ifdef __cplusplus
maygup01 0:11cc2b7889af 80 }
maygup01 0:11cc2b7889af 81 #endif
maygup01 0:11cc2b7889af 82
maygup01 0:11cc2b7889af 83
maygup01 0:11cc2b7889af 84 #endif // ARM_PAL_KV_H