Skip to content

Commit 87265f7

Browse files
committed
rtos: fix coding style in the boot files
1 parent 9238bf2 commit 87265f7

File tree

4 files changed

+34
-28
lines changed

4 files changed

+34
-28
lines changed

rtos/TARGET_CORTEX/TOOLCHAIN_ARM_MICRO/mbed_boot_arm_micro.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ void _main_init(void)
3737
{
3838
/* microlib only supports the two region memory model */
3939

40-
mbed_heap_start = (unsigned char*)__heap_base;
40+
mbed_heap_start = (unsigned char *)__heap_base;
4141
mbed_heap_size = (uint32_t)__heap_base - (uint32_t)__heap_limit;
4242

43-
mbed_stack_isr_start = (unsigned char*)((uint32_t)__initial_sp - ISR_STACK_SIZE);
43+
mbed_stack_isr_start = (unsigned char *)((uint32_t)__initial_sp - ISR_STACK_SIZE);
4444
mbed_stack_isr_size = ISR_STACK_SIZE;
4545

4646
mbed_init();

rtos/TARGET_CORTEX/TOOLCHAIN_ARM_STD/mbed_boot_arm_std.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,16 @@ __asm(".global __use_no_semihosting\n\t");
105105
//lint -esym(9003, os_libspace*) "variables 'os_libspace*' defined at module scope"
106106

107107
// Memory for libspace
108-
static uint32_t os_libspace[OS_THREAD_LIBSPACE_NUM+1][LIBSPACE_SIZE/4] \
108+
static uint32_t os_libspace[OS_THREAD_LIBSPACE_NUM + 1][LIBSPACE_SIZE / 4] \
109109
__attribute__((section(".bss.os.libspace")));
110110

111111
// Thread IDs for libspace
112112
static osThreadId_t os_libspace_id[OS_THREAD_LIBSPACE_NUM] \
113113
__attribute__((section(".bss.os.libspace")));
114114

115115
// Check if Kernel has been started
116-
static uint32_t os_kernel_is_active (void) {
116+
static uint32_t os_kernel_is_active(void)
117+
{
117118
static uint8_t os_kernel_active = 0U;
118119

119120
if (os_kernel_active == 0U) {
@@ -125,7 +126,8 @@ static uint32_t os_kernel_is_active (void) {
125126
}
126127

127128
// Provide libspace for current thread
128-
void *__user_perthread_libspace (void) {
129+
void *__user_perthread_libspace(void)
130+
{
129131
osThreadId_t id;
130132
uint32_t n;
131133

@@ -182,7 +184,7 @@ __USED int _mutex_initialize(mutex *m)
182184
core_util_critical_section_enter();
183185
for (int i = 0; i < OS_MUTEX_STATIC_NUM; i++) {
184186
if (_static_mutexes[i] == NULL) {
185-
_static_mutexes[i] = (mutex)-1; // dummy value to reserve slot
187+
_static_mutexes[i] = (mutex) - 1; // dummy value to reserve slot
186188
slot = &_static_mutexes[i];
187189
//Use the static attrs
188190
attr.cb_size = sizeof(mbed_rtos_storage_mutex_t);
@@ -202,7 +204,7 @@ __USED int _mutex_initialize(mutex *m)
202204

203205
/* Mutex pool exhausted, try using HEAP */
204206
attr.cb_size = sizeof(mbed_rtos_storage_mutex_t);
205-
attr.cb_mem = (void*)malloc(attr.cb_size);
207+
attr.cb_mem = (void *)malloc(attr.cb_size);
206208
if (attr.cb_mem == NULL) {
207209
osRtxErrorNotify(osRtxErrorClibSpace, m);
208210
return 0;
@@ -218,21 +220,24 @@ __USED int _mutex_initialize(mutex *m)
218220
}
219221

220222
/* Acquire mutex */
221-
__USED void _mutex_acquire(mutex *m) {
223+
__USED void _mutex_acquire(mutex *m)
224+
{
222225
if (os_kernel_is_active() != 0U) {
223226
(void)osMutexAcquire(*m, osWaitForever);
224227
}
225228
}
226229

227230
/* Release mutex */
228-
__USED void _mutex_release(mutex *m) {
231+
__USED void _mutex_release(mutex *m)
232+
{
229233
if (os_kernel_is_active() != 0U) {
230234
(void)osMutexRelease(*m);
231235
}
232236
}
233237

234238
/* Free mutex */
235-
__USED void _mutex_free(mutex *m) {
239+
__USED void _mutex_free(mutex *m)
240+
{
236241
mutex *slot = NULL;
237242
core_util_critical_section_enter();
238243
for (int i = 0; i < OS_MUTEX_STATIC_NUM; i++) {

rtos/TARGET_CORTEX/TOOLCHAIN_GCC_ARM/mbed_boot_gcc_arm.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern uint32_t __end__[];
3535
#define HEAP_SIZE ((uint32_t)((uint32_t)INITIAL_SP - (uint32_t)HEAP_START))
3636
#endif
3737

38-
extern void __libc_init_array (void);
38+
extern void __libc_init_array(void);
3939

4040
/*
4141
* mbed entry point for the GCC toolchain
@@ -86,30 +86,31 @@ void mbed_toolchain_init()
8686
}
8787

8888
extern int __real_main(void);
89-
int __wrap_main(void) {
89+
int __wrap_main(void)
90+
{
9091
/* For backwards compatibility */
9192
return __real_main();
9293
}
9394

9495
/* Opaque declaration of _reent structure */
9596
struct _reent;
9697

97-
void __rtos_malloc_lock( struct _reent *_r )
98+
void __rtos_malloc_lock(struct _reent *_r)
9899
{
99100
osMutexAcquire(malloc_mutex_id, osWaitForever);
100101
}
101102

102-
void __rtos_malloc_unlock( struct _reent *_r )
103+
void __rtos_malloc_unlock(struct _reent *_r)
103104
{
104105
osMutexRelease(malloc_mutex_id);
105106
}
106107

107-
void __rtos_env_lock( struct _reent *_r )
108+
void __rtos_env_lock(struct _reent *_r)
108109
{
109110
osMutexAcquire(env_mutex_id, osWaitForever);
110111
}
111112

112-
void __rtos_env_unlock( struct _reent *_r )
113+
void __rtos_env_unlock(struct _reent *_r)
113114
{
114115
osMutexRelease(env_mutex_id);
115116
}

rtos/TARGET_CORTEX/TOOLCHAIN_IAR/mbed_boot_iar.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#pragma section="CSTACK"
2828
#pragma section="HEAP"
2929

30-
extern void* __vector_table;
30+
extern void *__vector_table;
3131
extern int __low_level_init(void);
3232
extern void __iar_data_init3(void);
3333
extern __weak void __iar_init_core(void);
@@ -53,7 +53,7 @@ extern void __iar_dynamic_initialization(void);
5353
* <IAR>\arm\src\lib\thumb\cstartup_M.s
5454
*/
5555
#pragma required=__vector_table
56-
void __iar_program_start( void )
56+
void __iar_program_start(void)
5757
{
5858
/* the calls below are normally made in IAR cstartup */
5959
__iar_init_core();
@@ -74,10 +74,10 @@ void __iar_program_start( void )
7474
__iar_data_init3();
7575

7676
/* mbed specific code */
77-
mbed_heap_start = (unsigned char*)__section_begin("HEAP");
77+
mbed_heap_start = (unsigned char *)__section_begin("HEAP");
7878
mbed_heap_size = (uint32_t)__section_size("HEAP");
7979

80-
mbed_stack_isr_start = (unsigned char*)__section_begin("CSTACK");
80+
mbed_stack_isr_start = (unsigned char *)__section_begin("CSTACK");
8181
mbed_stack_isr_size = (uint32_t)__section_size("CSTACK");
8282

8383
mbed_init();
@@ -112,7 +112,7 @@ void __iar_system_Mtxinit(__iar_Rmtx *mutex) /* Initialize a system lock */
112112
attr.cb_size = sizeof(std_mutex_sys[index]);
113113
attr.attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust;
114114
std_mutex_id_sys[index] = osMutexNew(&attr);
115-
*mutex = (__iar_Rmtx*)&std_mutex_id_sys[index];
115+
*mutex = (__iar_Rmtx *)&std_mutex_id_sys[index];
116116
return;
117117
}
118118
}
@@ -123,18 +123,18 @@ void __iar_system_Mtxinit(__iar_Rmtx *mutex) /* Initialize a system lock */
123123

124124
void __iar_system_Mtxdst(__iar_Rmtx *mutex) /* Destroy a system lock */
125125
{
126-
osMutexDelete(*(osMutexId_t*)*mutex);
126+
osMutexDelete(*(osMutexId_t *)*mutex);
127127
*mutex = 0;
128128
}
129129

130130
void __iar_system_Mtxlock(__iar_Rmtx *mutex) /* Lock a system lock */
131131
{
132-
osMutexAcquire(*(osMutexId_t*)*mutex, osWaitForever);
132+
osMutexAcquire(*(osMutexId_t *)*mutex, osWaitForever);
133133
}
134134

135135
void __iar_system_Mtxunlock(__iar_Rmtx *mutex) /* Unlock a system lock */
136136
{
137-
osMutexRelease(*(osMutexId_t*)*mutex);
137+
osMutexRelease(*(osMutexId_t *)*mutex);
138138
}
139139

140140
void __iar_file_Mtxinit(__iar_Rmtx *mutex) /* Initialize a file lock */
@@ -148,7 +148,7 @@ void __iar_file_Mtxinit(__iar_Rmtx *mutex) /* Initialize a file lock */
148148
attr.cb_size = sizeof(std_mutex_file[index]);
149149
attr.attr_bits = osMutexRecursive | osMutexPrioInherit | osMutexRobust;
150150
std_mutex_id_file[index] = osMutexNew(&attr);
151-
*mutex = (__iar_Rmtx*)&std_mutex_id_file[index];
151+
*mutex = (__iar_Rmtx *)&std_mutex_id_file[index];
152152
return;
153153
}
154154
}
@@ -158,16 +158,16 @@ void __iar_file_Mtxinit(__iar_Rmtx *mutex) /* Initialize a file lock */
158158

159159
void __iar_file_Mtxdst(__iar_Rmtx *mutex) /* Destroy a file lock */
160160
{
161-
osMutexDelete(*(osMutexId_t*)*mutex);
161+
osMutexDelete(*(osMutexId_t *)*mutex);
162162
*mutex = 0;
163163
}
164164

165165
void __iar_file_Mtxlock(__iar_Rmtx *mutex) /* Lock a file lock */
166166
{
167-
osMutexAcquire(*(osMutexId_t*)*mutex, osWaitForever);
167+
osMutexAcquire(*(osMutexId_t *)*mutex, osWaitForever);
168168
}
169169

170170
void __iar_file_Mtxunlock(__iar_Rmtx *mutex) /* Unlock a file lock */
171171
{
172-
osMutexRelease(*(osMutexId_t*)*mutex);
172+
osMutexRelease(*(osMutexId_t *)*mutex);
173173
}

0 commit comments

Comments
 (0)