diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c b/bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c index e8dc60dd383f3cab4b00ecfccb3d2d5d68924af5..880c979c881ecf95361ed65685ade4b5d6cb59a9 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c +++ b/bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c @@ -64,7 +64,8 @@ static int blehr_sample(void) 15, 1); - if (tid != RT_NULL) { + if (tid != RT_NULL) + { rt_thread_startup(tid); } } diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/applications/mnt.c b/bsp/bluetrum/ab32vg1-ab-prougen/applications/mnt.c index e719cd6c52f80a2b59dc5ca1888a291db871d37a..50681e7bc607af82f88676538cd20bc5742205de 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/applications/mnt.c +++ b/bsp/bluetrum/ab32vg1-ab-prougen/applications/mnt.c @@ -26,7 +26,7 @@ void sd_mount(void *parameter) while (1) { rt_thread_mdelay(500); - if(rt_device_find("sd0") != RT_NULL) + if (rt_device_find("sd0") != RT_NULL) { if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK) { diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c b/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c index 9a96f7dffcca0ddefbf3abd7d40e7060dfaa920e..1cfd4e2e9ec607c604255e988da90d58ae39ac11 100644 --- a/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c +++ b/bsp/bluetrum/ab32vg1-ab-prougen/board/board.c @@ -182,7 +182,7 @@ void rt_hw_systick_init(void) timer0_init(); hal_set_tick_hook(timer0_cfg); - hal_set_ticks(get_sysclk_nhz()/RT_TICK_PER_SECOND); + hal_set_ticks(get_sysclk_nhz() / RT_TICK_PER_SECOND); PICCON |= 0x10002; } @@ -224,7 +224,8 @@ void cache_init(void) RT_SECTION(".irq.cache") void os_spiflash_lock(void) { - if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) { + if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) + { rt_mutex_take(&mutex_spiflash, RT_WAITING_FOREVER); } } @@ -232,7 +233,8 @@ void os_spiflash_lock(void) RT_SECTION(".irq.cache") void os_spiflash_unlock(void) { - if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) { + if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) + { rt_mutex_release(&mutex_spiflash); } } @@ -240,7 +242,8 @@ void os_spiflash_unlock(void) RT_SECTION(".irq.cache") void os_cache_lock(void) { - if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) { + if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) + { rt_mutex_take(&mutex_cache, RT_WAITING_FOREVER); } } @@ -248,7 +251,8 @@ void os_cache_lock(void) RT_SECTION(".irq.cache") void os_cache_unlock(void) { - if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) { + if ((rt_thread_self() != RT_NULL) && (rt_interrupt_nest == 0)) + { rt_mutex_release(&mutex_cache); } } @@ -280,5 +284,5 @@ void exception_isr(void) rt_kprintf(stack_info, rt_thread_self()->sp, rt_thread_self()->name); #endif - while(1); + while (1); } diff --git a/bsp/bluetrum/libraries/hal_drivers/drv_flash.c b/bsp/bluetrum/libraries/hal_drivers/drv_flash.c index d2baf5f6176449fb25925a2c17191282c4bdd439..2e98f793cf957e8a72c8f841e9e580611820a02b 100644 --- a/bsp/bluetrum/libraries/hal_drivers/drv_flash.c +++ b/bsp/bluetrum/libraries/hal_drivers/drv_flash.c @@ -31,13 +31,14 @@ static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size); static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size); static int fal_flash_erase(long offset, size_t size); -const struct fal_flash_dev ab32_onchip_flash = { +const struct fal_flash_dev ab32_onchip_flash = +{ "onchip_flash", AB32_FLASH_START_ADDRESS, AB32_FLASH_SIZE, AB32_FLASH_PAGE_SIZE, {NULL, fal_flash_read, fal_flash_write, fal_flash_erase}, - 256*8 + 256 * 8 }; static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size) @@ -47,7 +48,8 @@ static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size) static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size) { - if (size % 256) { + if (size % 256) + { rt_kprintf("Flash write requires 256 byte alignment\n"); return -1; } @@ -57,11 +59,13 @@ static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size) static int fal_flash_erase(long offset, size_t size) { - if (size % 4096) { + if (size % 4096) + { rt_kprintf("Flash erase requires 4096 byte alignment\n"); return -1; } - while (size > 0) { + while (size > 0) + { os_spiflash_erase(offset); offset += 4096; size -= 4096; @@ -78,7 +82,8 @@ int fal_ops_test(void) int size = 256; int addr = 0; - for (int i = 0; i < 256; i++) { + for (int i = 0; i < 256; i++) + { data[i] = i; } @@ -108,9 +113,11 @@ int fal_ops_test(void) } result = fal_partition_erase(part_dev, 0, 4096); - if (result >= 0) { + if (result >= 0) + { rt_kprintf("Erase data success.\n"); } + rt_memset(data, 0, 256); result = fal_partition_read(part_dev, 0, data, 256); if (result >= 0) diff --git a/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/libhal.a b/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/libhal.a deleted file mode 100644 index fbd9652b214c039b751c5547e14e92bfbfbebf39..0000000000000000000000000000000000000000 Binary files a/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/libhal.a and /dev/null differ diff --git a/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal.c b/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal.c index 4d90dc8ec1bfcb4fa5ca6b7296f23998512edcd1..dd796fd21be2b5b1e1506b4074bc6b118971a596 100644 --- a/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal.c +++ b/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal.c @@ -11,10 +11,12 @@ void hal_set_tick_hook(void (*hook)(uint32_t ticks)) void hal_set_ticks(uint32_t ticks) { - if (ticks != hw_ticks) { + if (ticks != hw_ticks) + { hw_ticks = ticks; } - if (tick_cfg_hook != HAL_NULL) { + if (tick_cfg_hook != HAL_NULL) + { tick_cfg_hook(hw_ticks); } }