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.
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
/**
|
|
* @file portmacro.h
|
|
* @brief RISC-V RV32 specific macros
|
|
*/
|
|
|
|
#ifndef PORTMACRO_H
|
|
#define PORTMACRO_H
|
|
|
|
#include <stdint.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 16
|
|
|
|
/* Critical Section Macros */
|
|
#define portENTER_CRITICAL() __asm volatile("csrci mstatus, 0x8")
|
|
#define portEXIT_CRITICAL() __asm volatile("csrsi mstatus, 0x8")
|
|
|
|
/* Interrupt Control */
|
|
#define portENABLE_INTERRUPTS() __asm volatile("csrsi mstatus, 0x8")
|
|
#define portDISABLE_INTERRUPTS() __asm volatile("csrci mstatus, 0x8")
|
|
|
|
/* Context Switch */
|
|
#define portYIELD() __asm volatile("li t0, 0x8\ncsrs mip, t0")
|
|
#define portYIELD_FROM_ISR() __asm volatile("li t0, 0x8\ncsrs mip, t0")
|
|
|
|
/* Memory Barriers */
|
|
#define portMEMORY_BARRIER() __asm volatile("fence")
|
|
#define portSYNC_BARRIER() __asm volatile("fence")
|
|
#define portINSTRUCTION_BARRIER() __asm volatile("fence.i")
|
|
|
|
/* NOP */
|
|
#define portNOP() __asm volatile("nop")
|
|
|
|
#endif /* PORTMACRO_H */
|