mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			nanostakc cmsis rtos: fix coding style
							parent
							
								
									3aab38140a
								
							
						
					
					
						commit
						29a1149bd6
					
				| 
						 | 
				
			
			@ -36,8 +36,7 @@ static const fhss_api_t *fhss_active_handle = NULL;
 | 
			
		|||
static EventQueue *equeue;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
struct fhss_timeout_s
 | 
			
		||||
{
 | 
			
		||||
struct fhss_timeout_s {
 | 
			
		||||
    void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t);
 | 
			
		||||
    uint32_t start_time;
 | 
			
		||||
    uint32_t stop_time;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,10 +39,10 @@ static uint8_t sys_irq_disable_counter;
 | 
			
		|||
 | 
			
		||||
static mbed_rtos_storage_mutex_t critical_mutex;
 | 
			
		||||
static const osMutexAttr_t critical_mutex_attr = {
 | 
			
		||||
  .name = "nanostack_critical_mutex",
 | 
			
		||||
  .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust,
 | 
			
		||||
  .cb_mem = &critical_mutex,
 | 
			
		||||
  .cb_size = sizeof critical_mutex,
 | 
			
		||||
    .name = "nanostack_critical_mutex",
 | 
			
		||||
    .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust,
 | 
			
		||||
    .cb_mem = &critical_mutex,
 | 
			
		||||
    .cb_size = sizeof critical_mutex,
 | 
			
		||||
};
 | 
			
		||||
static osMutexId_t critical_mutex_id;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ uint16_t platform_timer_get_remaining_slots(void)
 | 
			
		|||
{
 | 
			
		||||
    uint32_t elapsed = timer->read_us();
 | 
			
		||||
    if (elapsed < due) {
 | 
			
		||||
        return (uint16_t) ((due - elapsed) / 50);
 | 
			
		||||
        return (uint16_t)((due - elapsed) / 50);
 | 
			
		||||
    } else {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -99,9 +99,9 @@ static void nvm_fsm_timer_cb(void *arg);
 | 
			
		|||
static void configuration_store_cb(int32_t status, ARM_CFSTORE_OPCODE cmd_code, void *ctx, ARM_CFSTORE_HANDLE handle)
 | 
			
		||||
{
 | 
			
		||||
    tr_debug("configuration_store_cb status=%d, cmd_code=%d, ctx=%x, hndl=%x", (int)status, (int)cmd_code, (unsigned int)ctx, (unsigned int)handle);
 | 
			
		||||
    cs_context_t *cf_context = (cs_context_t*)ctx;
 | 
			
		||||
    cs_context_t *cf_context = (cs_context_t *)ctx;
 | 
			
		||||
 | 
			
		||||
    switch(cmd_code) {
 | 
			
		||||
    switch (cmd_code) {
 | 
			
		||||
        case CFSTORE_OPCODE_INITIALIZE:
 | 
			
		||||
            tr_debug("CFSTORE_OPCODE_INITIALIZE %d", (int)status);
 | 
			
		||||
            cf_context->state = NVM_STATE_INIT_DONE;
 | 
			
		||||
| 
						 | 
				
			
			@ -229,8 +229,7 @@ static int nvm_fsm_update(cs_context_t *cs_context)
 | 
			
		|||
    int ret_val = 0;
 | 
			
		||||
 | 
			
		||||
    tr_debug("nvm_fsm_update() state=%d", (int)cs_context->state);
 | 
			
		||||
    switch (cs_context->state)
 | 
			
		||||
    {
 | 
			
		||||
    switch (cs_context->state) {
 | 
			
		||||
        case NVM_STATE_UNINIT_DONE:
 | 
			
		||||
            cs_context->client_cb(cs_context->client_status, cs_context->client_context);
 | 
			
		||||
            cs_context->state = NVM_STATE_NONE;
 | 
			
		||||
| 
						 | 
				
			
			@ -288,7 +287,7 @@ platform_nvm_status platform_nvm_init(nvm_callback *callback, void *context)
 | 
			
		|||
 | 
			
		||||
    cs_context_ptr->capabilities = drv->GetCapabilities();
 | 
			
		||||
 | 
			
		||||
    tr_debug("mode: %s", IS_SYNC_MODE(cs_context_ptr) ? "sync": "async" );
 | 
			
		||||
    tr_debug("mode: %s", IS_SYNC_MODE(cs_context_ptr) ? "sync" : "async");
 | 
			
		||||
 | 
			
		||||
    ret = drv->Initialize(configuration_store_cb, cs_context_ptr);
 | 
			
		||||
    if (ret < ARM_DRIVER_OK) {
 | 
			
		||||
| 
						 | 
				
			
			@ -367,14 +366,14 @@ platform_nvm_status platform_nvm_key_create(nvm_callback *callback, const char *
 | 
			
		|||
    keydesc.drl = ARM_RETENTION_NVM;
 | 
			
		||||
 | 
			
		||||
    ret = drv->Create(key_name, value_len, &keydesc, cs_context_ptr->hkey);
 | 
			
		||||
    if(ret < ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret < ARM_DRIVER_OK) {
 | 
			
		||||
        if (ret == ARM_CFSTORE_DRIVER_ERROR_PREEXISTING_KEY) {
 | 
			
		||||
            tr_debug("adjust value len to %d", value_len);
 | 
			
		||||
            ret = drv->Create(key_name, value_len, NULL, cs_context_ptr->hkey);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(ret < ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret < ARM_DRIVER_OK) {
 | 
			
		||||
        tr_error("Key creation failed %d", (int)ret);
 | 
			
		||||
        cs_context_ptr->state = NVM_STATE_CREATE_DONE;
 | 
			
		||||
        cs_context_ptr->client_status = nvm_error_map(ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -413,7 +412,7 @@ platform_nvm_status platform_nvm_key_delete(nvm_callback *callback, const char *
 | 
			
		|||
    flags.write = 1;
 | 
			
		||||
    ret = drv->Open(key_name, flags, cs_context_ptr->hkey);
 | 
			
		||||
 | 
			
		||||
    if(ret < ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret < ARM_DRIVER_OK) {
 | 
			
		||||
        tr_error("Key delete, open failed %d", (int)ret);
 | 
			
		||||
        cs_context_ptr->state = NVM_STATE_DELETE_DONE;
 | 
			
		||||
        cs_context_ptr->client_status = nvm_error_map(ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -455,7 +454,7 @@ platform_nvm_status platform_nvm_read(nvm_callback *callback, const char *key_na
 | 
			
		|||
    flags.read = 1;
 | 
			
		||||
    ret = drv->Open(key_name, flags, cs_context_ptr->hkey);
 | 
			
		||||
 | 
			
		||||
    if(ret < ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret < ARM_DRIVER_OK) {
 | 
			
		||||
        tr_error("Read failed to open handle %d", (int)ret);
 | 
			
		||||
        cs_context_ptr->state = NVM_STATE_READ_DONE;
 | 
			
		||||
        cs_context_ptr->client_status = nvm_error_map(ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -485,7 +484,7 @@ platform_nvm_status platform_nvm_write(nvm_callback *callback, const char *key_n
 | 
			
		|||
    }
 | 
			
		||||
    cs_context_ptr->client_cb = callback;
 | 
			
		||||
    cs_context_ptr->client_context = context;
 | 
			
		||||
    cs_context_ptr->client_buf = (void*)data;
 | 
			
		||||
    cs_context_ptr->client_buf = (void *)data;
 | 
			
		||||
    cs_context_ptr->client_buf_len = data_len;
 | 
			
		||||
    cs_context_ptr->data_len = *data_len;
 | 
			
		||||
    cs_context_ptr->client_status = PLATFORM_NVM_OK;
 | 
			
		||||
| 
						 | 
				
			
			@ -496,7 +495,7 @@ platform_nvm_status platform_nvm_write(nvm_callback *callback, const char *key_n
 | 
			
		|||
    flags.write = 1;
 | 
			
		||||
    ret = drv->Open(key_name, flags, cs_context_ptr->hkey);
 | 
			
		||||
 | 
			
		||||
    if(ret < ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret < ARM_DRIVER_OK) {
 | 
			
		||||
        tr_error("Write failed %d", (int)ret);
 | 
			
		||||
        cs_context_ptr->state = NVM_STATE_WRITE_DONE;
 | 
			
		||||
        cs_context_ptr->client_status = nvm_error_map(ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -532,7 +531,7 @@ platform_nvm_status platform_nvm_flush(nvm_callback *callback, void *context)
 | 
			
		|||
 | 
			
		||||
    ret = drv->Flush();
 | 
			
		||||
 | 
			
		||||
    if(ret < ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret < ARM_DRIVER_OK) {
 | 
			
		||||
        cs_context_ptr->state = NVM_STATE_FLUSH_DONE;
 | 
			
		||||
        cs_context_ptr->client_status = nvm_error_map(ret);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -547,9 +546,9 @@ static bool nvm_write_internal(cs_context_t *cf_context)
 | 
			
		|||
{
 | 
			
		||||
    int32_t ret;
 | 
			
		||||
    cf_context->state = NVM_STATE_WRITING;
 | 
			
		||||
    ret = drv->Write(cf_context->hkey, (const char*)cf_context->client_buf, &cf_context->data_len);
 | 
			
		||||
    ret = drv->Write(cf_context->hkey, (const char *)cf_context->client_buf, &cf_context->data_len);
 | 
			
		||||
 | 
			
		||||
    if(ret >= ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret >= ARM_DRIVER_OK) {
 | 
			
		||||
        return true;
 | 
			
		||||
    } else {
 | 
			
		||||
        tr_error("Write failed %d", (int)ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -561,9 +560,9 @@ static bool nvm_read_internal(cs_context_t *cf_context)
 | 
			
		|||
{
 | 
			
		||||
    int32_t ret;
 | 
			
		||||
    cf_context->state = NVM_STATE_READING;
 | 
			
		||||
    ret = drv->Read(cf_context->hkey, (void*)cf_context->client_buf, &cf_context->data_len);
 | 
			
		||||
    ret = drv->Read(cf_context->hkey, (void *)cf_context->client_buf, &cf_context->data_len);
 | 
			
		||||
 | 
			
		||||
    if(ret >= ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret >= ARM_DRIVER_OK) {
 | 
			
		||||
        return true;
 | 
			
		||||
    } else {
 | 
			
		||||
        tr_error("Read failed %d", (int)ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -577,7 +576,7 @@ static bool nvm_delete_internal(cs_context_t *cf_context)
 | 
			
		|||
    cf_context->state = NVM_STATE_DELETING;
 | 
			
		||||
    ret = drv->Delete(cf_context->hkey);
 | 
			
		||||
 | 
			
		||||
    if(ret >= ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret >= ARM_DRIVER_OK) {
 | 
			
		||||
        return true;
 | 
			
		||||
    } else {
 | 
			
		||||
        tr_error("Delete failed %d", (int)ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -591,7 +590,7 @@ static bool nvm_close_internal(cs_context_t *cf_context)
 | 
			
		|||
    cf_context->state = NVM_STATE_CLOSING;
 | 
			
		||||
    ret = drv->Close(cf_context->hkey);
 | 
			
		||||
 | 
			
		||||
    if(ret >= ARM_DRIVER_OK) {
 | 
			
		||||
    if (ret >= ARM_DRIVER_OK) {
 | 
			
		||||
        return true;
 | 
			
		||||
    } else {
 | 
			
		||||
        tr_error("Close failed %d", (int)ret);
 | 
			
		||||
| 
						 | 
				
			
			@ -626,7 +625,7 @@ static platform_nvm_status nvm_error_map(int32_t cs_error)
 | 
			
		|||
        return PLATFORM_NVM_OK;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    switch(cs_error) {
 | 
			
		||||
    switch (cs_error) {
 | 
			
		||||
        case  ARM_CFSTORE_DRIVER_ERROR_KEY_NOT_FOUND:
 | 
			
		||||
            client_error = PLATFORM_NVM_KEY_NOT_FOUND;
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			@ -641,7 +640,7 @@ static platform_nvm_status nvm_error_map(int32_t cs_error)
 | 
			
		|||
static void nvm_fsm_timer_cb(void *args)
 | 
			
		||||
{
 | 
			
		||||
    (void) args;
 | 
			
		||||
    switch(nvm_fsm_update(cs_context_ptr)) {
 | 
			
		||||
    switch (nvm_fsm_update(cs_context_ptr)) {
 | 
			
		||||
        case 0:
 | 
			
		||||
            // Nothing processed, restart timer
 | 
			
		||||
            tr_debug("nvm_fsm_timer_cb not handled event in () %d", (int)cs_context_ptr->state);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,8 +22,7 @@ uint8_t buf[100];
 | 
			
		|||
uint16_t buf_len;
 | 
			
		||||
uint16_t data_len;
 | 
			
		||||
 | 
			
		||||
typedef struct 
 | 
			
		||||
{
 | 
			
		||||
typedef struct {
 | 
			
		||||
    platform_nvm_status status;
 | 
			
		||||
    void *ctx;
 | 
			
		||||
} test_platform_nvm_api_callback_t;
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +186,7 @@ bool test_cs_nvm_init_finalize()
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    // finalize NVM - OK
 | 
			
		||||
    if (!test_nvm_finalize()){
 | 
			
		||||
    if (!test_nvm_finalize()) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -300,7 +299,7 @@ bool test_cs_nvm_key_create()
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    // finalize NVM - OK
 | 
			
		||||
    if (!test_nvm_finalize()){
 | 
			
		||||
    if (!test_nvm_finalize()) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -341,7 +340,7 @@ bool test_cs_nvm_key_delete()
 | 
			
		|||
    ret = platform_nvm_key_delete(test_nvm_callback, NULL, TEST_NS_NVM_HELPER_CONTEXT1);
 | 
			
		||||
    if (ret != PLATFORM_NVM_ERROR) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }   
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Configuration-store returns error in OPEN directly
 | 
			
		||||
    cfstore_stub.ret_val = ARM_DRIVER_ERROR;
 | 
			
		||||
| 
						 | 
				
			
			@ -389,7 +388,7 @@ bool test_cs_nvm_key_delete()
 | 
			
		|||
    ret = platform_nvm_key_delete(test_nvm_callback, key_name, TEST_NS_NVM_HELPER_CONTEXT1);
 | 
			
		||||
    if (ret != PLATFORM_NVM_OK) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }      
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // simulate open
 | 
			
		||||
    cfstore_stub.cmd_code = CFSTORE_OPCODE_OPEN;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@ static int32_t test_cfstore_close(ARM_CFSTORE_HANDLE hkey)
 | 
			
		|||
    return cfstore_stub.close_ret_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t test_cfstore_create(const char* key_name, ARM_CFSTORE_SIZE value_len, const ARM_CFSTORE_KEYDESC* kdesc, ARM_CFSTORE_HANDLE hkey)
 | 
			
		||||
static int32_t test_cfstore_create(const char *key_name, ARM_CFSTORE_SIZE value_len, const ARM_CFSTORE_KEYDESC *kdesc, ARM_CFSTORE_HANDLE hkey)
 | 
			
		||||
{
 | 
			
		||||
    return cfstore_stub.ret_val;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +26,7 @@ static int32_t test_cfstore_delete(ARM_CFSTORE_HANDLE hkey)
 | 
			
		|||
    return cfstore_stub.delete_ret_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t test_cfstore_find(const char* key_name_query, const ARM_CFSTORE_HANDLE previous, ARM_CFSTORE_HANDLE next)
 | 
			
		||||
static int32_t test_cfstore_find(const char *key_name_query, const ARM_CFSTORE_HANDLE previous, ARM_CFSTORE_HANDLE next)
 | 
			
		||||
{
 | 
			
		||||
    return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ ARM_CFSTORE_CAPABILITIES test_cfstore_get_capabilities(void)
 | 
			
		|||
    return cfstore_caps_g;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t test_cfstore_get_key_name(ARM_CFSTORE_HANDLE hkey, char* key_name, uint8_t *key_name_len)
 | 
			
		||||
static int32_t test_cfstore_get_key_name(ARM_CFSTORE_HANDLE hkey, char *key_name, uint8_t *key_name_len)
 | 
			
		||||
{
 | 
			
		||||
    return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -64,14 +64,14 @@ ARM_DRIVER_VERSION test_cfstore_get_version(void)
 | 
			
		|||
    return cfstore_driver_version_g;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t test_cfstore_initialise(ARM_CFSTORE_CALLBACK callback, void* client_context)
 | 
			
		||||
static int32_t test_cfstore_initialise(ARM_CFSTORE_CALLBACK callback, void *client_context)
 | 
			
		||||
{
 | 
			
		||||
    cfstore_stub.callback = callback;
 | 
			
		||||
    cfstore_stub.client_context = client_context;
 | 
			
		||||
    return cfstore_stub.ret_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t test_cfstore_open(const char* key_name, ARM_CFSTORE_FMODE flags, ARM_CFSTORE_HANDLE hkey)
 | 
			
		||||
static int32_t test_cfstore_open(const char *key_name, ARM_CFSTORE_FMODE flags, ARM_CFSTORE_HANDLE hkey)
 | 
			
		||||
{
 | 
			
		||||
    return cfstore_stub.ret_val;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ static int32_t test_cfstore_power_control(ARM_POWER_STATE state)
 | 
			
		|||
    return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t test_cfstore_read(ARM_CFSTORE_HANDLE hkey, void* data, ARM_CFSTORE_SIZE* len)
 | 
			
		||||
static int32_t test_cfstore_read(ARM_CFSTORE_HANDLE hkey, void *data, ARM_CFSTORE_SIZE *len)
 | 
			
		||||
{
 | 
			
		||||
    return cfstore_stub.read_ret_val;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -96,30 +96,29 @@ static int32_t test_cfstore_uninitialise(void)
 | 
			
		|||
    return cfstore_stub.ret_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int32_t test_cfstore_write(ARM_CFSTORE_HANDLE hkey, const char* data, ARM_CFSTORE_SIZE* len)
 | 
			
		||||
static int32_t test_cfstore_write(ARM_CFSTORE_HANDLE hkey, const char *data, ARM_CFSTORE_SIZE *len)
 | 
			
		||||
{
 | 
			
		||||
    return cfstore_stub.write_ret_val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ARM_CFSTORE_DRIVER cfstore_driver =
 | 
			
		||||
{
 | 
			
		||||
        .Close = test_cfstore_close,
 | 
			
		||||
        .Create = test_cfstore_create,
 | 
			
		||||
        .Delete= test_cfstore_delete,
 | 
			
		||||
        .Find = test_cfstore_find,
 | 
			
		||||
        .Flush = test_cfstore_flush,
 | 
			
		||||
        .GetCapabilities = test_cfstore_get_capabilities,
 | 
			
		||||
        .GetKeyName = test_cfstore_get_key_name,
 | 
			
		||||
        .GetStatus = test_cfstore_get_status,
 | 
			
		||||
        .GetValueLen = test_cfstore_get_value_len,
 | 
			
		||||
        .GetVersion = test_cfstore_get_version,
 | 
			
		||||
        .Initialize = test_cfstore_initialise,
 | 
			
		||||
        .Open = test_cfstore_open,
 | 
			
		||||
        .PowerControl = test_cfstore_power_control,
 | 
			
		||||
        .Read = test_cfstore_read,
 | 
			
		||||
        .Rseek = test_cfstore_rseek,
 | 
			
		||||
        .Uninitialize = test_cfstore_uninitialise,
 | 
			
		||||
        .Write = test_cfstore_write,
 | 
			
		||||
ARM_CFSTORE_DRIVER cfstore_driver = {
 | 
			
		||||
    .Close = test_cfstore_close,
 | 
			
		||||
    .Create = test_cfstore_create,
 | 
			
		||||
    .Delete = test_cfstore_delete,
 | 
			
		||||
    .Find = test_cfstore_find,
 | 
			
		||||
    .Flush = test_cfstore_flush,
 | 
			
		||||
    .GetCapabilities = test_cfstore_get_capabilities,
 | 
			
		||||
    .GetKeyName = test_cfstore_get_key_name,
 | 
			
		||||
    .GetStatus = test_cfstore_get_status,
 | 
			
		||||
    .GetValueLen = test_cfstore_get_value_len,
 | 
			
		||||
    .GetVersion = test_cfstore_get_version,
 | 
			
		||||
    .Initialize = test_cfstore_initialise,
 | 
			
		||||
    .Open = test_cfstore_open,
 | 
			
		||||
    .PowerControl = test_cfstore_power_control,
 | 
			
		||||
    .Read = test_cfstore_read,
 | 
			
		||||
    .Rseek = test_cfstore_rseek,
 | 
			
		||||
    .Uninitialize = test_cfstore_uninitialise,
 | 
			
		||||
    .Write = test_cfstore_write,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -190,7 +190,7 @@ void debug_int(int i)
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void printf_array(const void *buf , uint16_t len)
 | 
			
		||||
void printf_array(const void *buf, uint16_t len)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,32 +17,26 @@ void ns_dyn_mem_init(uint8_t *heap, uint16_t h_size, void (*passed_fptr)(heap_fa
 | 
			
		|||
 | 
			
		||||
void *ns_dyn_mem_alloc(int16_t alloc_size)
 | 
			
		||||
{
 | 
			
		||||
    if (nsdynmemlib_stub.returnCounter > 0)
 | 
			
		||||
    {
 | 
			
		||||
    if (nsdynmemlib_stub.returnCounter > 0) {
 | 
			
		||||
        nsdynmemlib_stub.returnCounter--;
 | 
			
		||||
        return malloc(alloc_size);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        return(nsdynmemlib_stub.expectedPointer);
 | 
			
		||||
    } else {
 | 
			
		||||
        return (nsdynmemlib_stub.expectedPointer);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void *ns_dyn_mem_temporary_alloc(int16_t alloc_size)
 | 
			
		||||
{
 | 
			
		||||
    if (nsdynmemlib_stub.returnCounter > 0)
 | 
			
		||||
    {
 | 
			
		||||
    if (nsdynmemlib_stub.returnCounter > 0) {
 | 
			
		||||
        nsdynmemlib_stub.returnCounter--;
 | 
			
		||||
        return malloc(alloc_size);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        return(nsdynmemlib_stub.expectedPointer);
 | 
			
		||||
    } else {
 | 
			
		||||
        return (nsdynmemlib_stub.expectedPointer);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ns_dyn_mem_free(void *block)
 | 
			
		||||
{
 | 
			
		||||
        free(block);
 | 
			
		||||
    free(block);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,7 @@ extern "C" {
 | 
			
		|||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    uint8_t returnCounter;
 | 
			
		||||
    void* expectedPointer;
 | 
			
		||||
    void *expectedPointer;
 | 
			
		||||
} nsdynmemlib_stub_data_t;
 | 
			
		||||
 | 
			
		||||
extern nsdynmemlib_stub_data_t nsdynmemlib_stub;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,8 @@ void eventOS_timeout_cancel(timeout_t *t)
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void test_eventOS_timeout_trigger() {
 | 
			
		||||
void test_eventOS_timeout_trigger()
 | 
			
		||||
{
 | 
			
		||||
    test_callback(test_args);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,11 +43,11 @@ static osEventFlagsId_t event_flag_id;
 | 
			
		|||
 | 
			
		||||
#ifndef MBED_TZ_DEFAULT_ACCESS
 | 
			
		||||
#define MBED_TZ_DEFAULT_ACCESS   0
 | 
			
		||||
#endif    
 | 
			
		||||
    
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void event_loop_thread(void *arg);
 | 
			
		||||
 | 
			
		||||
static uint64_t event_thread_stk[MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_THREAD_STACK_SIZE/8];
 | 
			
		||||
static uint64_t event_thread_stk[MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_THREAD_STACK_SIZE / 8];
 | 
			
		||||
static mbed_rtos_storage_thread_t event_thread_tcb;
 | 
			
		||||
static const osThreadAttr_t event_thread_attr = {
 | 
			
		||||
    .name = "nanostack_event_thread",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,10 +28,10 @@
 | 
			
		|||
 | 
			
		||||
static mbed_rtos_storage_mutex_t event_mutex;
 | 
			
		||||
static const osMutexAttr_t event_mutex_attr = {
 | 
			
		||||
  .name = "nanostack_event_mutex",
 | 
			
		||||
  .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust,
 | 
			
		||||
  .cb_mem = &event_mutex,
 | 
			
		||||
  .cb_size = sizeof event_mutex,
 | 
			
		||||
    .name = "nanostack_event_mutex",
 | 
			
		||||
    .attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust,
 | 
			
		||||
    .cb_mem = &event_mutex,
 | 
			
		||||
    .cb_size = sizeof event_mutex,
 | 
			
		||||
};
 | 
			
		||||
static osMutexId_t event_mutex_id;
 | 
			
		||||
static osThreadId_t event_mutex_owner_id = NULL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Define flag IGNORE_SIMULATED_NVM_STORAGE to ignore usage of simulated NVM and use 
 | 
			
		||||
 * Define flag IGNORE_SIMULATED_NVM_STORAGE to ignore usage of simulated NVM and use
 | 
			
		||||
 * platform specific NVM instead.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef IGNORE_SIMULATED_NVM_STORAGE
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ platform_nvm_status platform_nvm_key_create(nvm_callback *callback, const char *
 | 
			
		|||
    tr_debug("platform_nvm_key_create() %s len=%d", key_name, (int)value_len);
 | 
			
		||||
 | 
			
		||||
    ns_list_foreach(nvm_data_entry_t, current_entry, &nvm_entry_list) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name)==0) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name) == 0) {
 | 
			
		||||
            // resizing existing key
 | 
			
		||||
            ns_list_remove(&nvm_entry_list, current_entry);
 | 
			
		||||
            nvm_ram_free_entry(current_entry);
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +182,7 @@ platform_nvm_status platform_nvm_key_delete(nvm_callback *callback, const char *
 | 
			
		|||
    tr_debug("platform_nvm_key_delete() %s", key_name);
 | 
			
		||||
 | 
			
		||||
    ns_list_foreach(nvm_data_entry_t, current_entry, &nvm_entry_list) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name)==0) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name) == 0) {
 | 
			
		||||
            client_status = PLATFORM_NVM_OK;
 | 
			
		||||
            ns_list_remove(&nvm_entry_list, current_entry);
 | 
			
		||||
            nvm_ram_free_entry(current_entry);
 | 
			
		||||
| 
						 | 
				
			
			@ -199,7 +199,7 @@ platform_nvm_status platform_nvm_write(nvm_callback *callback, const char *key_n
 | 
			
		|||
    tr_debug("platform_nvm_write() %s len=%d", key_name, (int)*data_len);
 | 
			
		||||
 | 
			
		||||
    ns_list_foreach(nvm_data_entry_t, current_entry, &nvm_entry_list) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name)==0) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name) == 0) {
 | 
			
		||||
            if (current_entry->data_len >= *data_len) {
 | 
			
		||||
                memcpy(current_entry->data, data, *data_len);
 | 
			
		||||
            } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -211,7 +211,7 @@ platform_nvm_status platform_nvm_write(nvm_callback *callback, const char *key_n
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return create_client_request(callback, context, (void*)data, data_len, client_status);
 | 
			
		||||
    return create_client_request(callback, context, (void *)data, data_len, client_status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
platform_nvm_status platform_nvm_read(nvm_callback *callback, const char *key_name, void *buf, uint16_t *buf_len, void *context)
 | 
			
		||||
| 
						 | 
				
			
			@ -220,7 +220,7 @@ platform_nvm_status platform_nvm_read(nvm_callback *callback, const char *key_na
 | 
			
		|||
    tr_debug("platform_nvm_read() %s len=%d", key_name, (int)*buf_len);
 | 
			
		||||
 | 
			
		||||
    ns_list_foreach(nvm_data_entry_t, current_entry, &nvm_entry_list) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name)==0) {
 | 
			
		||||
        if (strcmp(current_entry->key, key_name) == 0) {
 | 
			
		||||
            if (*buf_len >= current_entry->data_len) {
 | 
			
		||||
                memcpy(buf, current_entry->data, current_entry->data_len);
 | 
			
		||||
                *buf_len = current_entry->data_len;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue