ca13734bf0
Add kernel (Cortex-M0/M3/M4, Tricore, S32K, RISC-V ports), drivers, middleware (CAN stack, diagnostics, safety), applications, board support, build/test tooling, and documentation.
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
/**
|
|
* @file portmacro.h
|
|
* @brief NXP S32K specific macros
|
|
*/
|
|
|
|
#ifndef PORTMACRO_H
|
|
#define PORTMACRO_H
|
|
|
|
#include <stdint.h>
|
|
#include "S32K144.h"
|
|
|
|
/* Data Types */
|
|
typedef uint32_t port_stack_type_t;
|
|
typedef uint32_t port_base_type_t;
|
|
|
|
/* Architecture Constants */
|
|
#define PORT_STACK_GROWTH_DIRECTION (-1)
|
|
#define PORT_BYTE_ALIGNMENT 8
|
|
#define PORT_MAX_SYSCALL_INTERRUPT_PRIORITY 0x50
|
|
|
|
/* Critical Section Macros */
|
|
#define portENTER_CRITICAL() __asm volatile("CPSID I" ::: "memory")
|
|
#define portEXIT_CRITICAL() __asm volatile("CPSIE I" ::: "memory")
|
|
|
|
/* Interrupt Control */
|
|
#define portENABLE_INTERRUPTS() __asm volatile("CPSIE I" ::: "memory")
|
|
#define portDISABLE_INTERRUPTS() __asm volatile("CPSID I" ::: "memory")
|
|
|
|
/* Context Switch */
|
|
#define portYIELD() SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk
|
|
#define portYIELD_FROM_ISR() SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk
|
|
|
|
/* Memory Barriers */
|
|
#define portMEMORY_BARRIER() __asm volatile("DMB" ::: "memory")
|
|
#define portSYNC_BARRIER() __asm volatile("DSB" ::: "memory")
|
|
#define portINSTRUCTION_BARRIER() __asm volatile("ISB" ::: "memory")
|
|
|
|
/* NOP */
|
|
#define portNOP() __asm volatile("NOP")
|
|
|
|
/* Watchdog Control */
|
|
#define portSERVICE_WATCHDOG() \
|
|
do { \
|
|
WDOG->CNT = 0xB480; \
|
|
WDOG->CNT = 0x4B80; \
|
|
} while(0)
|
|
|
|
/* Low Power Modes */
|
|
#define portENTER_SLEEP() __asm volatile("WFI")
|
|
#define portENTER_DEEP_SLEEP() __asm volatile("WFE")
|
|
|
|
/* Endian Definition */
|
|
#define portBYTE_ORDER LITTLE_ENDIAN
|
|
|
|
#endif /* PORTMACRO_H */
|