summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreedyhao <[email protected]>2021-11-30 17:26:39 +0800
committergreedyhao <[email protected]>2021-11-30 17:26:39 +0800
commit8a85ff4ebebfe218cf42ec38d19f9497f5f06cd2 (patch)
tree7ce695045a00cf2e6eb38bab1c577dc4913f3efd
parent26310fe2541f254a38a1c8c17e370c8f7b44179e (diff)
[bsp/bluetrum] formatting code
-rw-r--r--bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c3
-rw-r--r--bsp/bluetrum/ab32vg1-ab-prougen/applications/mnt.c2
-rw-r--r--bsp/bluetrum/ab32vg1-ab-prougen/board/board.c16
-rw-r--r--bsp/bluetrum/libraries/hal_drivers/drv_flash.c21
-rw-r--r--bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/libhal.abin37598 -> 0 bytes
-rw-r--r--bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/source/ab32vg1_hal.c6
6 files changed, 31 insertions, 17 deletions
diff --git a/bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c b/bsp/bluetrum/ab32vg1-ab-prougen/applications/blehr_app.c
index e8dc60dd38..880c979c88 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 e719cd6c52..50681e7bc6 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 9a96f7dffc..1cfd4e2e9e 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 d2baf5f617..2e98f793cf 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 fbd9652b21..0000000000
--- a/bsp/bluetrum/libraries/hal_libraries/ab32vg1_hal/libhal.a
+++ /dev/null
Binary files 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 4d90dc8ec1..dd796fd21b 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);
}
}