mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 11:09:01 +01:00 
			
		
		
		
	Remove hardware dependence in portmacros.h (#1112)
* Remove hardware dependence in portmacros.h The IAR MSP430X port `#include "msp430.h"` which pulls all the hardware register definitions into anything which `#include "FreeRTOS.h"`. This removes that hardware dependency "leak" by removing the header file and re-defining the `portDISABLE_INTERRUPTS()` and `portENABLE_INTERRUPTS()` macros in terms of `__asm`. * Code review suggestions Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> --------- Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
		
							parent
							
								
									49e88310be
								
							
						
					
					
						commit
						2faa8bc154
					
				@ -26,6 +26,9 @@
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Hardware includes. */
 | 
			
		||||
#include "msp430.h"
 | 
			
		||||
 | 
			
		||||
/* Scheduler includes. */
 | 
			
		||||
#include "FreeRTOS.h"
 | 
			
		||||
#include "task.h"
 | 
			
		||||
 | 
			
		||||
@ -39,9 +39,6 @@
 | 
			
		||||
 *-----------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Hardware includes. */
 | 
			
		||||
#include "msp430.h"
 | 
			
		||||
 | 
			
		||||
/* Type definitions. */
 | 
			
		||||
#define portCHAR        char
 | 
			
		||||
#define portFLOAT       float
 | 
			
		||||
@ -75,8 +72,8 @@ typedef unsigned short UBaseType_t;
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Interrupt control macros. */
 | 
			
		||||
#define portDISABLE_INTERRUPTS()    _disable_interrupt(); _nop()
 | 
			
		||||
#define portENABLE_INTERRUPTS()     _enable_interrupt(); _nop()
 | 
			
		||||
#define portDISABLE_INTERRUPTS()    __asm volatile ( " DINT\n" " NOP" )
 | 
			
		||||
#define portENABLE_INTERRUPTS()     __asm volatile ( " NOP\n" " EINT\n" " NOP" )
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Critical section control macros. */
 | 
			
		||||
@ -126,7 +123,7 @@ extern void vPortYield( void );
 | 
			
		||||
#define portBYTE_ALIGNMENT          2
 | 
			
		||||
#define portSTACK_GROWTH            ( -1 )
 | 
			
		||||
#define portTICK_PERIOD_MS          ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
 | 
			
		||||
#define portNOP()                   __no_operation()
 | 
			
		||||
#define portNOP()                   __asm volatile ( " NOP" )
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
 | 
			
		||||
 | 
			
		||||
@ -30,6 +30,9 @@
 | 
			
		||||
#include "FreeRTOS.h"
 | 
			
		||||
#include "task.h"
 | 
			
		||||
 | 
			
		||||
/* Hardware includes. */
 | 
			
		||||
#include "msp430.h"
 | 
			
		||||
 | 
			
		||||
/*-----------------------------------------------------------
 | 
			
		||||
* Implementation of functions defined in portable.h for the MSP430X port.
 | 
			
		||||
*----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
@ -39,9 +39,6 @@
 | 
			
		||||
 *-----------------------------------------------------------
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* Hardware includes. */
 | 
			
		||||
#include "msp430.h"
 | 
			
		||||
 | 
			
		||||
/* Type definitions. */
 | 
			
		||||
#define portCHAR         char
 | 
			
		||||
#define portFLOAT        float
 | 
			
		||||
@ -75,8 +72,8 @@ typedef unsigned short   UBaseType_t;
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Interrupt control macros. */
 | 
			
		||||
#define portDISABLE_INTERRUPTS()    _DINT(); _NOP()
 | 
			
		||||
#define portENABLE_INTERRUPTS()     _EINT(); _NOP()
 | 
			
		||||
#define portDISABLE_INTERRUPTS()    __asm volatile ( "DINT\n" "NOP" )
 | 
			
		||||
#define portENABLE_INTERRUPTS()     __asm volatile ( "NOP\n" "EINT\n" "NOP" )
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Critical section control macros. */
 | 
			
		||||
@ -126,7 +123,7 @@ extern void vPortYield( void );
 | 
			
		||||
#define portBYTE_ALIGNMENT    2
 | 
			
		||||
#define portSTACK_GROWTH      ( -1 )
 | 
			
		||||
#define portTICK_PERIOD_MS    ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
 | 
			
		||||
#define portNOP()    __no_operation()
 | 
			
		||||
#define portNOP()             __asm volatile ( "NOP" )
 | 
			
		||||
/*-----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user