OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [GCC/] [OpenRISC/] [port.c] - Diff between revs 621 and 664

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 621 Rev 664
Line 83... Line 83...
        unsigned long value;
        unsigned long value;
        asm("l.mfspr\t\t%0,%1,0" : "=r" (value) : "r" (spr));
        asm("l.mfspr\t\t%0,%1,0" : "=r" (value) : "r" (spr));
        return value;
        return value;
}
}
 
 
 
inline void vPortDisableInterrupts( void )
/*
 
 * naked attribute is ignored or32-elf-gcc 4.5.1-or32-1.0rc1
 
 * use assemble routines in portasm.S
 
 */
 
#if 0
 
void vPortDisableInterrupts( void ) __attribute__ ((__naked__))
 
{
{
        asm volatile (                                                          \
        mtspr(SPR_SR, mfspr(SPR_SR) & ~(SPR_SR_TEE|SPR_SR_IEE));        // Tick, interrupt stop
        "       @ get current SR                                \n\t"   \
 
        "       l.mfspr r3, r0, SPR_SR                  \n\t"   \
 
        "       l.addi  r4, r0, SPR_SR_TEE              \n\t"   \
 
        "       l.xori  r4, r4, 0xffffffff              \n\t"   \
 
        "       l.and   r3, r3, r4                              \n\t"   \
 
        "       l.addi  r4, r0, SPR_SR_IEE              \n\t"   \
 
        "       l.xori  r4, r4, 0xffffffff              \n\t"   \
 
        "       l.and   r3, r3, r4                              \n\t"   \
 
        "       @ update SR                                             \n\t"   \
 
        "       l.mtspr r0, r3, SPR_SR                  \n\t"   \
 
        );
 
}
}
 
 
void vPortEnableInterrupts( void ) __attribute__ ((__naked__))
inline void vPortEnableInterrupts( void )
{
{
        asm volatile (                                                          \
        mtspr(SPR_SR, mfspr(SPR_SR) | (SPR_SR_TEE|SPR_SR_IEE));         // Tick, interrupt start
        "       @ get current SR                                \n\t"   \
 
        "       l.mfspr r3, r0, SPR_SR                  \n\t"   \
 
        "       @ enable Tick Timer Interrupt   \n\t"   \
 
        "       l.ori   r3, r3, SPR_SR_TEE              \n\t"   \
 
        "       @ enable External Interrupt             \n\t"   \
 
        "       l.ori   r3, r3, SPR_SR_IEE              \n\t"   \
 
        "       @ update SR                                             \n\t"   \
 
        "       l.mtspr r0, r3, SPR_SR                  \n\t"   \
 
        );
 
}
}
#endif
 
 
 
 
 
/*
/*
 * Initialise the stack of a task to look exactly as if a call to
 * Initialise the stack of a task to look exactly as if a call to
 * portSAVE_CONTEXT had been called.
 * portSAVE_CONTEXT had been called.
 *
 *
 * See header file for description.
 * See header file for description.
 */
 */
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
{
{
        unsigned portLONG uTaskSR = mfspr(SPR_ESR_BASE);
        unsigned portLONG uTaskSR = mfspr(SPR_SR);
        uTaskSR &= ~SPR_SR_SM;                                  // User mode
        uTaskSR |= SPR_SR_SM;                                           // Supervisor mode
        uTaskSR |= (SPR_SR_TEE | SPR_SR_IEE);   // Tick interrupt enable, All External interupt enable
        uTaskSR |= (SPR_SR_TEE | SPR_SR_IEE);   // Tick interrupt enable, All External interupt enable
 
 
        /* Setup the initial stack of the task.  The stack is set exactly as
        /* Setup the initial stack of the task.  The stack is set exactly as
        expected by the portRESTORE_CONTEXT() macro. */
        expected by the portRESTORE_CONTEXT() macro. */
        *(--pxTopOfStack) = (portSTACK_TYPE)pxCode;                     // SPR_EPCR_BASE(0)
        *(--pxTopOfStack) = (portSTACK_TYPE)pxCode;                     // SPR_EPCR_BASE(0)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.