1 /** mbed Microcontroller Library 2 ****************************************************************************** 3 * @file timer_api.h 4 * @author 5 * @version V1.0.0 6 * @brief This file provides following mbed I2C API 7 ****************************************************************************** 8 * @attention 9 * 10 * Copyright (c) 2006-2013 ARM Limited 11 * 12 * Licensed under the Apache License, Version 2.0 (the "License"); 13 * you may not use this file except in compliance with the License. 14 * You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, software 19 * distributed under the License is distributed on an "AS IS" BASIS, 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 * See the License for the specific language governing permissions and 22 * limitations under the License. 23 ****************************************************************************** 24 */ 25 26 27 #include "device.h" 28 29 #ifndef __RTK_DCT_H__ 30 #define __RTK_DCT_H__ 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /** @addtogroup dct DCT 37 * @ingroup hal 38 * @brief dct functions 39 * @{ 40 */ 41 42 ///@name Ameba Common 43 ///@{ 44 45 enum{ 46 DCT_SUCCESS = 0, 47 DCT_ERR = -1, 48 DCT_ERR_CRC = -2, 49 DCT_ERR_NO_SPACE = -3, 50 DCT_ERR_NO_MEMORY = -4, 51 DCT_ERR_FLASH_RW = -5, 52 DCT_ERR_NOT_FIND = -6, 53 DCT_ERR_INVALID = -7, 54 DCT_ERR_SIZE_OVER = -8, 55 DCT_ERR_MODULE_BUSY = -9, 56 }; 57 58 enum{ 59 DCT_MODULE_STATE_INIT = 0xFFFFFFFF, 60 DCT_MODULE_STATE_VALID = 0xFFFFFFFE, 61 DCT_MODULE_STATE_DELETING = 0xFFFFFFFC, 62 DCT_MODULE_STATE_DELETED = 0xFFFFFFF8, 63 }; 64 65 66 67 68 /** 69 * @brief Initialize device configuration table. 70 * @param none 71 * @retval 32 bit 72 */ 73 int32_t dct_init(void); 74 75 /** 76 * @brief Deinitialize device configuration table. 77 * @retval none 78 */ 79 void dct_deinit(void); 80 81 /** 82 * @brief Register module in DCT. 83 * @param module_name : module name 84 * @retval 0 : SUCCESS 85 * @retval <0 : ERROR 86 */ 87 int32_t dct_register_module(char *module_name); 88 89 /** 90 * @brief Unregister and delete module in DCT. 91 * @param module_name : module name 92 * @retval 0 : SUCCESS 93 * @retval <0 : ERROR 94 */ 95 int32_t dct_unregister_module(char *module_name); 96 97 /** 98 * @brief Open module in DCT. 99 * @param dct_handle : setup module informations in dct handler 100 * @param module_name : module name 101 * @retval 0 : SUCCESS 102 * @retval <0 : ERROR 103 */ 104 int32_t dct_open_module(dct_handle_t *dct_handle, char *module_name); 105 106 /** 107 * @brief Close module in DCT. 108 * @param dct_handle : dct handler 109 * @retval 0 : SUCCESS 110 * @retval <0 : ERROR 111 */ 112 int32_t dct_close_module(dct_handle_t *dct_handle); 113 114 /** 115 * @brief Write variable name and value in opened module. 116 * @param dct_handle : dct handler 117 * @param variable_name : variable name which you want to store in module 118 * @param variable_value : variable value which you want to store in module 119 * @retval 0 : SUCCESS 120 * @retval <0 : ERROR 121 */ 122 int32_t dct_set_variable(dct_handle_t *dct_handle, char *variable_name, char *variable_value); 123 124 /** 125 * @brief Read value of variable name in opened module. 126 * @param dct_handle : dct handler 127 * @param variable_name : variable name which you want to get from module 128 * @param buffer : read variable value 129 * @param buffer_size : the buffer size 130 * @retval 0 : SUCCESS 131 * @retval <0 : ERROR 132 */ 133 int32_t dct_get_variable(dct_handle_t *dct_handle, char *variable_name, char *buffer, uint16_t buffer_size); 134 135 /** 136 * @brief Delete variable name and value in opened module. 137 * @param dct_handle : dct handler 138 * @param variable_name : variable name which you want to delete in module 139 * @retval 0 : SUCCESS 140 * @retval <0 : ERROR 141 */ 142 int32_t dct_delete_variable(dct_handle_t *dct_handle, char *variable_name); 143 144 145 146 147 #ifdef __cplusplus 148 } 149 #endif 150 151 #endif/* MBED_TIMER_API_H */ 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179