diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-11 17:03:01 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-11 17:03:01 +0000 |
commit | cdfe85a7f3c29489a8f7f8848e4d351eaf4d0b76 (patch) | |
tree | 1f2c6f757fb82a497c24349903015bc894f4117a /cpukit/score/cpu/avr/cpu.c | |
parent | 2009-08-10 Roxana Leontie <roxana.leontie@gmail.com> (diff) | |
download | rtems-cdfe85a7f3c29489a8f7f8848e4d351eaf4d0b76.tar.bz2 |
2009-08-11 Josh Switnicki <josh.switnicki@utoronto.ca>
* cpu.c, cpu_asm.S, rtems/score/cpu.h: Fix bug in
_CPU_Context_Initialize.
Diffstat (limited to 'cpukit/score/cpu/avr/cpu.c')
-rw-r--r-- | cpukit/score/cpu/avr/cpu.c | 82 |
1 files changed, 3 insertions, 79 deletions
diff --git a/cpukit/score/cpu/avr/cpu.c b/cpukit/score/cpu/avr/cpu.c index c4ec993eb3..5833deea12 100644 --- a/cpukit/score/cpu/avr/cpu.c +++ b/cpukit/score/cpu/avr/cpu.c @@ -30,8 +30,7 @@ */ void _CPU_Initialize(void) { - printk( "AVR CPU Initialize\n" ); - + /* * If there is not an easy way to initialize the FP context * during Context_Initialize, then it is usually easier to @@ -44,82 +43,6 @@ void _CPU_Initialize(void) /*PAGE * - * _CPU_Context_Initialize - * - * This kernel routine initializes the basic non-FP context area associated - * with each thread. - * - * Input parameters: - * the_context - pointer to the context area - * stack_base - address of memory for the SPARC - * size - size in bytes of the stack area - * new_level - interrupt level for this context area - * entry_point - the starting execution point for this this context - * is_fp - TRUE if this context is associated with an FP thread - * - * Output parameters: NONE - */ - -void _CPU_Context_Initialize( - Context_Control *the_context, - uint32_t *stack_base, - uint32_t size, - uint32_t new_level, - void *entry_point, - bool is_fp -) -{ - uint16_t stack; - uint16_t start; - uint8_t *tmp_sp; - uint8_t start_low; - uint8_t start_high; - - /* calc stack high end */ - stack = (uint16_t) (stack_base) + (uint16_t) (size); - /* calc stack pointer initial value */ - the_context->stack_pointer = (stack - 18); - /* put the entry point on the stack */ - start = (uint16_t) entry_point; - start_low = start & 0xff; - start_high = start >> 8; - tmp_sp = (uint8_t *) (stack+1); - tmp_sp[0] = start_high; - tmp_sp[1] = start_low; - - if (new_level) the_context->status = 0x00; //interrupts are enabled - else the_context->status = 0x80; //interrupts are disabled - - /* - * JOEL: Why if I comment out these three lines does ticker not run? - */ -#if 1 - printk( "tmp_sp=0x%04x ", ((uint16_t)tmp_sp) ); - printk("the_context = 0x%x\n", the_context); - printk("entry = 0x%x\n", entry_point); -#endif -#if 0 - printk("sp = 0x%x\n\n",stack); - - { int i; uint8_t *p; - p = (uint8_t *)(stack - 18); - for( i=0 ; i<=20 ; i+=8 ) { - printk( "0x%04x ", ((uint16_t)&p[i]) ); - printk( - "0x%02x 0x%02x 0x%02x 0x%02x ", - p[i + 0], p[i + 1], p[i + 2], p[i + 3] - ); - printk( - "0x%02x 0x%02x 0x%02x 0x%02x\n", - p[i + 4], p[i + 5], p[i + 6], p[i + 7] - ); - } - } -#endif -} - -/*PAGE - * * _CPU_ISR_Get_level * * NO_CPU Specific Information: @@ -132,8 +55,9 @@ uint32_t _CPU_ISR_Get_level( void ) /* * This routine returns the current interrupt level. */ + if((SREG & 0x80))return 1; + else return 0; - return 0; } /*PAGE |