diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-10-16 21:26:15 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-10-16 21:26:15 +0000 |
commit | bf07771326512a3ae595e97e30166df63a327ff3 (patch) | |
tree | 24b4c063ffb4e9823e4b4701bedbbeccc06b75e5 /nuttx/arch/avr/src/avr32/up_initialstate.c | |
parent | c45a1e95964096ffcebcf34678fa40a02b754715 (diff) | |
download | px4-nuttx-bf07771326512a3ae595e97e30166df63a327ff3.tar.gz px4-nuttx-bf07771326512a3ae595e97e30166df63a327ff3.tar.bz2 px4-nuttx-bf07771326512a3ae595e97e30166df63a327ff3.zip |
Initial AVR32 task state
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3026 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/avr/src/avr32/up_initialstate.c')
-rw-r--r-- | nuttx/arch/avr/src/avr32/up_initialstate.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/nuttx/arch/avr/src/avr32/up_initialstate.c b/nuttx/arch/avr/src/avr32/up_initialstate.c index e6f606b6a..a9bf1a3ac 100644 --- a/nuttx/arch/avr/src/avr32/up_initialstate.c +++ b/nuttx/arch/avr/src/avr32/up_initialstate.c @@ -81,19 +81,39 @@ void up_initial_state(_TCB *tcb) { struct xcptcontext *xcp = &tcb->xcp; - /* Initialize the initial exception register context structure */ + /* Initialize the initial exception register context structure. Zeroing + * all registers is a good debug helper, but should not be necessary. + */ +#ifdef CONFIG_DEBUG memset(xcp, 0, sizeof(struct xcptcontext)); +#else + /* No pending signal delivery */ - /* Save the initial stack pointer */ - /* Save the task entry point (stripping off the thumb bit) */ + xcp->sigdeliver = NULL; + + /* Clear the frame pointer and link register since this is the outermost + * frame. + */ -# warning "Not implemented" + xcp->regs[REG_R7] = 0; + xcp->regs[REG_LR] = 0; +#endif + + /* Set the initial stack pointer to the "base" of the allocated stack */ + + xcp->regs[REG_SP] = (uint32_t)tcb->adj_stack_ptr; + + /* Save the task entry point */ + + xcp->regs[REG_PC] = (uint32_t)tcb->start; /* Enable or disable interrupts, based on user configuration */ # ifdef CONFIG_SUPPRESS_INTERRUPTS -# warning "Not implemented" + xcp->regs[REG_SR] = ; +# else + xcp->regs[REG_SR] = 0; # endif } |