[libcpu]:optimize code format
This commit is contained in:
parent
15715692d2
commit
e7b1786759
|
@ -26,14 +26,14 @@
|
||||||
/*****************************/
|
/*****************************/
|
||||||
/* CPU Mode */
|
/* CPU Mode */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
#define USERMODE 0x10
|
#define USERMODE 0x10
|
||||||
#define FIQMODE 0x11
|
#define FIQMODE 0x11
|
||||||
#define IRQMODE 0x12
|
#define IRQMODE 0x12
|
||||||
#define SVCMODE 0x13
|
#define SVCMODE 0x13
|
||||||
#define ABORTMODE 0x17
|
#define ABORTMODE 0x17
|
||||||
#define UNDEFMODE 0x1b
|
#define UNDEFMODE 0x1b
|
||||||
#define MODEMASK 0x1f
|
#define MODEMASK 0x1f
|
||||||
#define NOINT 0xc0
|
#define NOINT 0xc0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will initialize thread stack
|
* This function will initialize thread stack
|
||||||
|
@ -46,36 +46,36 @@
|
||||||
* @return stack address
|
* @return stack address
|
||||||
*/
|
*/
|
||||||
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
|
rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
|
||||||
rt_uint8_t *stack_addr, void *texit)
|
rt_uint8_t *stack_addr, void *texit)
|
||||||
{
|
{
|
||||||
rt_uint32_t *stk;
|
rt_uint32_t *stk;
|
||||||
|
|
||||||
stack_addr += sizeof(rt_uint32_t);
|
stack_addr += sizeof(rt_uint32_t);
|
||||||
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
|
stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8);
|
||||||
stk = (rt_uint32_t*)stack_addr;
|
stk = (rt_uint32_t*)stack_addr;
|
||||||
*(--stk) = (rt_uint32_t)tentry; /* entry point */
|
*(--stk) = (rt_uint32_t)tentry; /* entry point */
|
||||||
*(--stk) = (rt_uint32_t)texit; /* lr */
|
*(--stk) = (rt_uint32_t)texit; /* lr */
|
||||||
*(--stk) = 0; /* r12 */
|
*(--stk) = 0; /* r12 */
|
||||||
*(--stk) = 0; /* r11 */
|
*(--stk) = 0; /* r11 */
|
||||||
*(--stk) = 0; /* r10 */
|
*(--stk) = 0; /* r10 */
|
||||||
*(--stk) = 0; /* r9 */
|
*(--stk) = 0; /* r9 */
|
||||||
*(--stk) = 0; /* r8 */
|
*(--stk) = 0; /* r8 */
|
||||||
*(--stk) = 0; /* r7 */
|
*(--stk) = 0; /* r7 */
|
||||||
*(--stk) = 0; /* r6 */
|
*(--stk) = 0; /* r6 */
|
||||||
*(--stk) = 0; /* r5 */
|
*(--stk) = 0; /* r5 */
|
||||||
*(--stk) = 0; /* r4 */
|
*(--stk) = 0; /* r4 */
|
||||||
*(--stk) = 0; /* r3 */
|
*(--stk) = 0; /* r3 */
|
||||||
*(--stk) = 0; /* r2 */
|
*(--stk) = 0; /* r2 */
|
||||||
*(--stk) = 0; /* r1 */
|
*(--stk) = 0; /* r1 */
|
||||||
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
|
*(--stk) = (rt_uint32_t)parameter; /* r0 : argument */
|
||||||
|
|
||||||
/* cpsr */
|
/* cpsr */
|
||||||
if ((rt_uint32_t)tentry & 0x01)
|
if ((rt_uint32_t)tentry & 0x01)
|
||||||
*(--stk) = SVCMODE | 0x20; /* thumb mode */
|
*(--stk) = SVCMODE | 0x20; /* thumb mode */
|
||||||
else
|
else
|
||||||
*(--stk) = SVCMODE; /* arm mode */
|
*(--stk) = SVCMODE; /* arm mode */
|
||||||
|
|
||||||
/* return task's current stack address */
|
/* return task's current stack address */
|
||||||
return (rt_uint8_t *)stk;
|
return (rt_uint8_t *)stk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue