add tos_slist.h, rename tos.h to tos_k.h
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <tos.h>
|
||||
#include <tos_k.h>
|
||||
#include "syscfg/syscfg.h"
|
||||
#include "nimble/nimble_port.h"
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
#ifdef __CC_ARM
|
||||
/* avoid the heap and heap-using library functions supplied by arm */
|
||||
|
@@ -30,7 +30,7 @@ extern "C" {
|
||||
#define DLLExport __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define DLLImport
|
||||
#define DLLExport
|
||||
#define DLLExport
|
||||
#endif
|
||||
|
||||
enum errors
|
||||
@@ -93,7 +93,7 @@ int MQTTstrlen(MQTTString mqttstring);
|
||||
#include "MQTTSubscribe.h"
|
||||
#include "MQTTUnsubscribe.h"
|
||||
#include "MQTTFormat.h"
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
DLLExport int MQTTSerialize_ack(unsigned char* buf, int buflen, unsigned char type, unsigned char dup, unsigned short packetid);
|
||||
DLLExport int MQTTDeserialize_ack(unsigned char* packettype, unsigned char* dup, unsigned short* packetid, unsigned char* buf, int buflen);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "qcloud.h"
|
||||
|
||||
__QCLOUD_OSAL__ void osal_printf(const char *fmt, ...)
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
#include "qcloud.h"
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "qcloud.h"
|
||||
|
||||
#include "lwip/api.h"
|
||||
|
@@ -17,10 +17,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <tos.h>
|
||||
#include <tos_k.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "qcloud.h"
|
||||
|
||||
static char now_time_str[20] = {0};
|
||||
|
@@ -21,7 +21,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "qcloud.h"
|
||||
|
||||
#include "mbedtls/ssl.h"
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
#include "qcloud.h"
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "qcloud.h"
|
||||
|
||||
#include "lwip/api.h"
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
#include "infra_defs.h"
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
|
||||
#define PORT_BUFF_LEN 16
|
||||
|
@@ -17,10 +17,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <tos.h>
|
||||
#include <tos_k.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
uint32_t HAL_UptimeMs(void)
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "qcloud_iot_import.h"
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
//#define PLATFORM_HAS_CMSIS
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "qcloud_iot_export_error.h"
|
||||
#include "qcloud_iot_common.h"
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
|
||||
#define PORT_BUFF_LEN 16
|
||||
|
@@ -23,7 +23,7 @@ extern "C" {
|
||||
#include <string.h>
|
||||
#include "qcloud_iot_import.h"
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
static char now_time_str[20] = {0};
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "qcloud_iot_export_log.h"
|
||||
#include "qcloud_iot_export_error.h"
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
|
||||
#define PORT_BUFF_LEN 16
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "qcloud_iot_import.h"
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
//#define PLATFORM_HAS_CMSIS
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "qcloud_iot_export_error.h"
|
||||
#include "qcloud_iot_common.h"
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
|
||||
#define PORT_BUFF_LEN 16
|
||||
|
@@ -23,7 +23,7 @@ extern "C" {
|
||||
#include <string.h>
|
||||
#include "qcloud_iot_import.h"
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
static char now_time_str[20] = {0};
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "qcloud_iot_export_log.h"
|
||||
#include "qcloud_iot_export_error.h"
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
|
||||
#define PORT_BUFF_LEN 16
|
||||
|
2
components/fs/fatfs/3rdparty/ffsystem.c
vendored
2
components/fs/fatfs/3rdparty/ffsystem.c
vendored
@@ -3,7 +3,7 @@
|
||||
/* (C)ChaN, 2018 */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "ff.h"
|
||||
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
/* (C)ChaN, 2018 */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "tos_ff.h"
|
||||
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
#ifndef _TOS_KV_H_
|
||||
#define _TOS_KV_H_
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "tos_kv_err.h"
|
||||
#include "tos_kv_flash.h"
|
||||
|
||||
@@ -112,12 +112,12 @@ typedef uint64_t kv_dword_t; // double word
|
||||
#define KV_BLK_FIRST_ITEM(blk_start) (blk_start + KV_BLK_HDR_SIZE)
|
||||
#define KV_BLK_NEXT(blk_start) (blk_start + KV_BLK_SIZE >= KV_FLASH_END ? KV_FLASH_START : blk_start + KV_BLK_SIZE)
|
||||
|
||||
#define KV_BLK_FOREACH_FROM(cur_blk, start_blk) \
|
||||
#define KV_BLK_FOR_EACH_FROM(cur_blk, start_blk) \
|
||||
for (cur_blk = KV_BLK_NEXT(start_blk); \
|
||||
cur_blk != start_blk; \
|
||||
cur_blk = KV_BLK_NEXT(cur_blk))
|
||||
|
||||
#define KV_BLK_FOREACH(cur_blk) \
|
||||
#define KV_BLK_FOR_EACH(cur_blk) \
|
||||
for (cur_blk = KV_FLASH_START; \
|
||||
cur_blk < KV_FLASH_END; \
|
||||
cur_blk += KV_BLK_SIZE)
|
||||
|
@@ -136,7 +136,7 @@ __STATIC__ uint32_t kv_blk_next_fresh(void)
|
||||
uint32_t cur_blk;
|
||||
|
||||
// we try to find a fresh block behind current block(take all the blocks as a ring)
|
||||
KV_BLK_FOREACH_FROM(cur_blk, KV_MGR_WORKSPACE) {
|
||||
KV_BLK_FOR_EACH_FROM(cur_blk, KV_MGR_WORKSPACE) {
|
||||
if (kv_blk_is_fresh(cur_blk)) {
|
||||
return cur_blk;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ __STATIC__ uint32_t kv_blk_search_inuse(uint32_t item_size)
|
||||
{
|
||||
uint32_t cur_blk;
|
||||
|
||||
KV_BLK_FOREACH_FROM(cur_blk, KV_MGR_WORKSPACE) {
|
||||
KV_BLK_FOR_EACH_FROM(cur_blk, KV_MGR_WORKSPACE) {
|
||||
if (kv_blk_is_inuse(cur_blk) &&
|
||||
kv_blk_freesz_get(cur_blk) >= item_size) {
|
||||
return cur_blk;
|
||||
@@ -668,7 +668,7 @@ __STATIC__ kv_item_t *kv_item_find(const char *key)
|
||||
uint32_t cur_blk;
|
||||
kv_item_t *item;
|
||||
|
||||
KV_BLK_FOREACH(cur_blk) {
|
||||
KV_BLK_FOR_EACH(cur_blk) {
|
||||
if (kv_blk_is_bad(cur_blk) ||
|
||||
kv_blk_is_fresh(cur_blk)) {
|
||||
continue;
|
||||
@@ -699,7 +699,7 @@ __STATIC__ kv_item_t *kv_item_find_new_copy(kv_item_t *the_item)
|
||||
uint32_t cur_blk;
|
||||
kv_item_t *item;
|
||||
|
||||
KV_BLK_FOREACH(cur_blk) {
|
||||
KV_BLK_FOR_EACH(cur_blk) {
|
||||
if (kv_blk_is_bad(cur_blk) ||
|
||||
kv_blk_is_fresh(cur_blk)) {
|
||||
continue;
|
||||
@@ -893,7 +893,7 @@ __STATIC__ int kv_mgr_blk_index_rebuild(void)
|
||||
uint32_t cur_blk;
|
||||
int is_rebuild_done = K_FALSE;
|
||||
|
||||
KV_BLK_FOREACH(cur_blk) {
|
||||
KV_BLK_FOR_EACH(cur_blk) {
|
||||
if (kv_blk_is_hanging(cur_blk)) {
|
||||
if (kv_mgr_index_build(cur_blk) == KV_ERR_NONE) {
|
||||
kv_blk_reset_hanging(cur_blk);
|
||||
@@ -921,7 +921,7 @@ __STATIC__ kv_err_t kv_mgr_workspace_locate(void)
|
||||
/* if no block inuse, we locate workspace in first fresh block
|
||||
else locate in first block inuse
|
||||
*/
|
||||
KV_BLK_FOREACH(cur_blk) {
|
||||
KV_BLK_FOR_EACH(cur_blk) {
|
||||
if (KV_MGR_BLK_NUM_INUSE == 0) {
|
||||
if (kv_blk_is_fresh(cur_blk)) {
|
||||
KV_MGR_WORKSPACE = cur_blk;
|
||||
@@ -942,7 +942,7 @@ __STATIC__ void kv_mgr_ctl_build(void)
|
||||
uint32_t cur_blk;
|
||||
kv_blk_hdr_t blk_hdr;
|
||||
|
||||
KV_BLK_FOREACH(cur_blk) {
|
||||
KV_BLK_FOR_EACH(cur_blk) {
|
||||
if (kv_blk_hdr_read(cur_blk, &blk_hdr) != KV_ERR_NONE) {
|
||||
// sth must be wrong seriously with this block
|
||||
kv_blk_set_bad(cur_blk);
|
||||
@@ -1022,7 +1022,7 @@ __STATIC__ kv_err_t kv_gc(void)
|
||||
// there must be at least one fresh block left, make workspace pointer to the fresh one
|
||||
KV_MGR_WORKSPACE = kv_blk_next_fresh();
|
||||
|
||||
KV_BLK_FOREACH(cur_blk) {
|
||||
KV_BLK_FOR_EACH(cur_blk) {
|
||||
if (kv_blk_is_dirty(cur_blk)) {
|
||||
if (kv_do_gc(cur_blk) != KV_ERR_NONE) {
|
||||
// cannot do gc for this block, give others a try
|
||||
@@ -1171,7 +1171,7 @@ __DEBUG__ kv_err_t tos_kv_walkthru(void)
|
||||
|
||||
printf("workspace: 0x%x [%d block]\n", KV_MGR_WORKSPACE, KV_BLK_ADDR2IDX(KV_MGR_WORKSPACE));
|
||||
|
||||
KV_BLK_FOREACH(cur_blk) {
|
||||
KV_BLK_FOR_EACH(cur_blk) {
|
||||
printf("[%d] block\n", i++);
|
||||
printf("addr: 0x%x\n", cur_blk);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef _TOS_VFS_H_
|
||||
#define _TOS_VFS_H_
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
|
||||
#if TOS_CFG_VFS_EN > 0u
|
||||
|
||||
|
@@ -7,13 +7,11 @@ TOS_LIST_DEFINE(k_vfs_fsmap_list);
|
||||
|
||||
__STATIC__ vfs_fsmap_t *vfs_fsmap_get(const char *fs_name)
|
||||
{
|
||||
k_list_t *curr;
|
||||
char *name = K_NULL;
|
||||
vfs_fsmap_t *fsmap = K_NULL;
|
||||
|
||||
TOS_LIST_FOR_EACH(curr, &k_vfs_fsmap_list) {
|
||||
fsmap = TOS_LIST_ENTRY(curr, vfs_fsmap_t, list);
|
||||
name = (char *)fsmap->name;
|
||||
TOS_LIST_FOR_EACH_ENTRY(fsmap, vfs_fsmap_t, list, &k_vfs_fsmap_list) {
|
||||
name = (char *)fsmap->name;
|
||||
if (strlen(name) == strlen(fs_name) &&
|
||||
strncmp(name, fs_name, strlen(name)) == 0) {
|
||||
return fsmap;
|
||||
|
@@ -20,15 +20,13 @@ __STATIC__ TOS_LIST_DEFINE(k_vfs_inode_list);
|
||||
*/
|
||||
__STATIC__ vfs_inode_t *vfs_inode_search(const char *path, const char **relative_path)
|
||||
{
|
||||
k_list_t *curr;
|
||||
char *name = K_NULL;
|
||||
int path_len, name_len;
|
||||
vfs_inode_t *inode = K_NULL;
|
||||
|
||||
path_len = strlen(path);
|
||||
|
||||
TOS_LIST_FOR_EACH(curr, &k_vfs_inode_list) {
|
||||
inode = TOS_LIST_ENTRY(curr, vfs_inode_t, list);
|
||||
TOS_LIST_FOR_EACH_ENTRY(inode, vfs_inode_t, list, &k_vfs_inode_list) {
|
||||
name = (char *)inode->name;
|
||||
name_len = strlen(name);
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#include "sal_module_wrapper.h"
|
||||
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "mbedtls/net_sockets.h"
|
||||
#include "lwip/api.h"
|
||||
#include "lwip/sockets.h"
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include MBEDTLS_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#include "tos.h"
|
||||
#include "tos_k.h"
|
||||
#include "timing_alt.h"
|
||||
|
||||
unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset)
|
||||
|
@@ -48,7 +48,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cJSON.h"
|
||||
#include <tos.h>
|
||||
#include <tos_k.h>
|
||||
|
||||
#ifdef ENABLE_LOCALES
|
||||
#include <locale.h>
|
||||
|
Reference in New Issue
Block a user