mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 11:09:01 +01:00 
			
		
		
		
	Revert formatting on Rowley ports (#884)
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									8d1da77d0d
								
							
						
					
					
						commit
						9a2ce912ff
					
				@ -31,28 +31,28 @@
 | 
			
		||||
#include "task.h"
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------
 | 
			
		||||
* Implementation of functions defined in portable.h for the MSP430 port.
 | 
			
		||||
*----------------------------------------------------------*/
 | 
			
		||||
 * Implementation of functions defined in portable.h for the MSP430 port.
 | 
			
		||||
 *----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Constants required for hardware setup.  The tick ISR runs off the ACLK,
 | 
			
		||||
 * not the MCLK. */
 | 
			
		||||
not the MCLK. */
 | 
			
		||||
#define portACLK_FREQUENCY_HZ           ( ( TickType_t ) 32768 )
 | 
			
		||||
#define portINITIAL_CRITICAL_NESTING    ( ( uint16_t ) 10 )
 | 
			
		||||
#define portFLAGS_INT_ENABLED           ( ( StackType_t ) 0x08 )
 | 
			
		||||
 | 
			
		||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
 | 
			
		||||
 * any details of its type. */
 | 
			
		||||
any details of its type. */
 | 
			
		||||
typedef void TCB_t;
 | 
			
		||||
extern volatile TCB_t * volatile pxCurrentTCB;
 | 
			
		||||
 | 
			
		||||
/* Each task maintains a count of the critical section nesting depth.  Each
 | 
			
		||||
 * time a critical section is entered the count is incremented.  Each time a
 | 
			
		||||
 * critical section is exited the count is decremented - with interrupts only
 | 
			
		||||
 * being re-enabled if the count is zero.
 | 
			
		||||
 *
 | 
			
		||||
 * usCriticalNesting will get set to zero when the scheduler starts, but must
 | 
			
		||||
 * not be initialised to zero as this will cause problems during the startup
 | 
			
		||||
 * sequence. */
 | 
			
		||||
time a critical section is entered the count is incremented.  Each time a
 | 
			
		||||
critical section is exited the count is decremented - with interrupts only
 | 
			
		||||
being re-enabled if the count is zero.
 | 
			
		||||
 | 
			
		||||
usCriticalNesting will get set to zero when the scheduler starts, but must
 | 
			
		||||
not be initialised to zero as this will cause problems during the startup
 | 
			
		||||
sequence. */
 | 
			
		||||
volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
@ -70,26 +70,24 @@ void prvSetupTimerInterrupt( void );
 | 
			
		||||
 *
 | 
			
		||||
 * See the header file portable.h.
 | 
			
		||||
 */
 | 
			
		||||
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
 | 
			
		||||
                                     TaskFunction_t pxCode,
 | 
			
		||||
                                     void * pvParameters )
 | 
			
		||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
 | 
			
		||||
{
 | 
			
		||||
    /*
 | 
			
		||||
     *  Place a few bytes of known values on the bottom of the stack.
 | 
			
		||||
     *  This is just useful for debugging and can be included if required.
 | 
			
		||||
     *
 | 
			
		||||
     * pxTopOfStack = ( StackType_t ) 0x1111;
 | 
			
		||||
     *  pxTopOfStack--;
 | 
			
		||||
     * pxTopOfStack = ( StackType_t ) 0x2222;
 | 
			
		||||
     *  pxTopOfStack--;
 | 
			
		||||
     * pxTopOfStack = ( StackType_t ) 0x3333;
 | 
			
		||||
     *  pxTopOfStack--;
 | 
			
		||||
        Place a few bytes of known values on the bottom of the stack.
 | 
			
		||||
        This is just useful for debugging and can be included if required.
 | 
			
		||||
 | 
			
		||||
        *pxTopOfStack = ( StackType_t ) 0x1111;
 | 
			
		||||
        pxTopOfStack--;
 | 
			
		||||
        *pxTopOfStack = ( StackType_t ) 0x2222;
 | 
			
		||||
        pxTopOfStack--;
 | 
			
		||||
        *pxTopOfStack = ( StackType_t ) 0x3333;
 | 
			
		||||
        pxTopOfStack--;
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    /* The msp430 automatically pushes the PC then SR onto the stack before
 | 
			
		||||
     * executing an ISR.  We want the stack to look just as if this has happened
 | 
			
		||||
     * so place a pointer to the start of the task on the stack first - followed
 | 
			
		||||
     * by the flags we want the task to use when it starts up. */
 | 
			
		||||
    executing an ISR.  We want the stack to look just as if this has happened
 | 
			
		||||
    so place a pointer to the start of the task on the stack first - followed
 | 
			
		||||
    by the flags we want the task to use when it starts up. */
 | 
			
		||||
    *pxTopOfStack = ( StackType_t ) pxCode;
 | 
			
		||||
    pxTopOfStack--;
 | 
			
		||||
    *pxTopOfStack = portFLAGS_INT_ENABLED;
 | 
			
		||||
@ -120,17 +118,17 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
 | 
			
		||||
    pxTopOfStack--;
 | 
			
		||||
 | 
			
		||||
    /* When the task starts is will expect to find the function parameter in
 | 
			
		||||
     * R15. */
 | 
			
		||||
    R15. */
 | 
			
		||||
    *pxTopOfStack = ( StackType_t ) pvParameters;
 | 
			
		||||
    pxTopOfStack--;
 | 
			
		||||
 | 
			
		||||
    /* A variable is used to keep track of the critical section nesting.
 | 
			
		||||
     * This variable has to be stored as part of the task context and is
 | 
			
		||||
     * initially set to zero. */
 | 
			
		||||
    This variable has to be stored as part of the task context and is
 | 
			
		||||
    initially set to zero. */
 | 
			
		||||
    *pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
 | 
			
		||||
 | 
			
		||||
    /* Return a pointer to the top of the stack we have generated so this can
 | 
			
		||||
     * be stored in the task control block for the task. */
 | 
			
		||||
    be stored in the task control block for the task. */
 | 
			
		||||
    return pxTopOfStack;
 | 
			
		||||
}
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
@ -138,7 +136,7 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
 | 
			
		||||
void vPortEndScheduler( void )
 | 
			
		||||
{
 | 
			
		||||
    /* It is unlikely that the MSP430 port will get stopped.  If required simply
 | 
			
		||||
     * disable the tick interrupt here. */
 | 
			
		||||
    disable the tick interrupt here. */
 | 
			
		||||
}
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
@ -170,3 +168,6 @@ void prvSetupTimerInterrupt( void )
 | 
			
		||||
    TACTL |= MC_1;
 | 
			
		||||
}
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -30,51 +30,51 @@
 | 
			
		||||
#define PORT_ASM_H
 | 
			
		||||
 | 
			
		||||
portSAVE_CONTEXT macro
 | 
			
		||||
/* Save the remaining registers. */
 | 
			
		||||
push r4
 | 
			
		||||
push r5
 | 
			
		||||
push r6
 | 
			
		||||
push r7
 | 
			
		||||
push r8
 | 
			
		||||
push r9
 | 
			
		||||
push r10
 | 
			
		||||
push r11
 | 
			
		||||
push r12
 | 
			
		||||
push r13
 | 
			
		||||
push r14
 | 
			
		||||
push r15
 | 
			
		||||
mov.w &_usCriticalNesting, r14
 | 
			
		||||
push r14
 | 
			
		||||
                /* Save the remaining registers. */
 | 
			
		||||
        push    r4
 | 
			
		||||
        push    r5
 | 
			
		||||
        push    r6
 | 
			
		||||
        push    r7
 | 
			
		||||
        push    r8
 | 
			
		||||
        push    r9
 | 
			
		||||
        push    r10
 | 
			
		||||
        push    r11
 | 
			
		||||
        push    r12
 | 
			
		||||
        push    r13
 | 
			
		||||
        push    r14
 | 
			
		||||
        push    r15
 | 
			
		||||
        mov.w   &_usCriticalNesting, r14
 | 
			
		||||
        push    r14
 | 
			
		||||
        mov.w   &_pxCurrentTCB, r12
 | 
			
		||||
        mov.w   r1, @r12
 | 
			
		||||
endm
 | 
			
		||||
        endm
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
portRESTORE_CONTEXT macro
 | 
			
		||||
        mov.w   &_pxCurrentTCB, r12
 | 
			
		||||
        mov.w   @r12, r1
 | 
			
		||||
pop r15
 | 
			
		||||
        pop     r15
 | 
			
		||||
        mov.w   r15, &_usCriticalNesting
 | 
			
		||||
pop r15
 | 
			
		||||
pop r14
 | 
			
		||||
pop r13
 | 
			
		||||
pop r12
 | 
			
		||||
pop r11
 | 
			
		||||
pop r10
 | 
			
		||||
pop r9
 | 
			
		||||
pop r8
 | 
			
		||||
pop r7
 | 
			
		||||
pop r6
 | 
			
		||||
pop r5
 | 
			
		||||
pop r4
 | 
			
		||||
        pop     r15
 | 
			
		||||
        pop     r14
 | 
			
		||||
        pop     r13
 | 
			
		||||
        pop     r12
 | 
			
		||||
        pop     r11
 | 
			
		||||
        pop     r10
 | 
			
		||||
        pop     r9
 | 
			
		||||
        pop     r8
 | 
			
		||||
        pop     r7
 | 
			
		||||
        pop     r6
 | 
			
		||||
        pop     r5
 | 
			
		||||
        pop     r4
 | 
			
		||||
 | 
			
		||||
/* The last thing on the stack will be the status register.
 | 
			
		||||
 *      Ensure the power down bits are clear ready for the next
 | 
			
		||||
 *      time this power down register is popped from the stack. */
 | 
			
		||||
       bic.w   # 0xf0, 0 ( SP )
 | 
			
		||||
        /* The last thing on the stack will be the status register.
 | 
			
		||||
                Ensure the power down bits are clear ready for the next
 | 
			
		||||
                time this power down register is popped from the stack. */
 | 
			
		||||
        bic.w   #0xf0,0(SP)
 | 
			
		||||
 | 
			
		||||
reti
 | 
			
		||||
endm
 | 
			
		||||
        reti
 | 
			
		||||
        endm
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#endif /* ifndef PORT_ASM_H */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -53,7 +53,7 @@ typedef short            BaseType_t;
 | 
			
		||||
typedef unsigned short UBaseType_t;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
 | 
			
		||||
#if( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
 | 
			
		||||
    typedef uint16_t TickType_t;
 | 
			
		||||
    #define portMAX_DELAY ( TickType_t ) 0xffff
 | 
			
		||||
#elif ( configTICK_TYPE_WIDTH_IN_BITS  == TICK_TYPE_WIDTH_32_BITS )
 | 
			
		||||
@ -74,8 +74,8 @@ typedef unsigned short   UBaseType_t;
 | 
			
		||||
#define portNO_CRITICAL_SECTION_NESTING     ( ( uint16_t ) 0 )
 | 
			
		||||
 | 
			
		||||
#define portENTER_CRITICAL()                                                    \
 | 
			
		||||
    {                                                                            \
 | 
			
		||||
        extern volatile uint16_t usCriticalNesting;                              \
 | 
			
		||||
{                                                                               \
 | 
			
		||||
extern volatile uint16_t usCriticalNesting;                         \
 | 
			
		||||
                                                                                \
 | 
			
		||||
    portDISABLE_INTERRUPTS();                                                   \
 | 
			
		||||
                                                                                \
 | 
			
		||||
@ -83,11 +83,11 @@ typedef unsigned short   UBaseType_t;
 | 
			
		||||
    /* directly.  Increment ulCriticalNesting to keep a count of how many */    \
 | 
			
		||||
    /* times portENTER_CRITICAL() has been called. */                           \
 | 
			
		||||
    usCriticalNesting++;                                                        \
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define portEXIT_CRITICAL()                                                     \
 | 
			
		||||
    {                                                                               \
 | 
			
		||||
        extern volatile uint16_t usCriticalNesting;                                 \
 | 
			
		||||
{                                                                               \
 | 
			
		||||
extern volatile uint16_t usCriticalNesting;                         \
 | 
			
		||||
                                                                                \
 | 
			
		||||
    if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING )                   \
 | 
			
		||||
    {                                                                           \
 | 
			
		||||
@ -101,7 +101,7 @@ typedef unsigned short   UBaseType_t;
 | 
			
		||||
            portENABLE_INTERRUPTS();                                            \
 | 
			
		||||
        }                                                                       \
 | 
			
		||||
    }                                                                           \
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Task utilities. */
 | 
			
		||||
@ -121,13 +121,13 @@ extern void vPortYield( void );
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
 | 
			
		||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters )    void vFunction( void * pvParameters )
 | 
			
		||||
#define portTASK_FUNCTION( vFunction, pvParameters )          void vFunction( void * pvParameters ) __toplevel
 | 
			
		||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
 | 
			
		||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) __toplevel
 | 
			
		||||
 | 
			
		||||
#if configINTERRUPT_EXAMPLE_METHOD == 2
 | 
			
		||||
 | 
			
		||||
    extern void vTaskSwitchContext( void );
 | 
			
		||||
    #define portYIELD_FROM_ISR( x )    do { if( x ) vTaskSwitchContext( ); } while( 0 )
 | 
			
		||||
extern void vTaskSwitchContext( void );
 | 
			
		||||
#define portYIELD_FROM_ISR( x ) do { if( x ) vTaskSwitchContext(); } while( 0 )
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user