Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
arch.h File Reference

RISCV specific kernel interface header This header contains the RISCV specific kernel interface. It is included by the generic kernel interface header (arch/cpu.h) More...

#include <arch/riscv/thread.h>
#include <arch/riscv/exp.h>
#include <arch/common/sys_bitops.h>
#include <arch/common/sys_io.h>
#include <arch/common/ffs.h>
#include <arch/riscv/syscall.h>
#include <irq.h>
#include <sw_isr_table.h>
#include <soc.h>
#include <devicetree.h>
#include <arch/riscv/csr.h>
#include <sys/util.h>
#include <arch/riscv/error.h>

Go to the source code of this file.

Data Structures

struct  k_mem_partition_attr_t
 

Macros

#define ARCH_STACK_PTR_ALIGN   16
 
#define ARCH_THREAD_STACK_RESERVED   CONFIG_PRIVILEGED_STACK_SIZE
 
#define ARCH_THREAD_STACK_SIZE_ADJUST(size)    (ROUND_UP((size), Z_RISCV_PMP_ALIGN))
 
#define ARCH_THREAD_STACK_OBJ_ALIGN(size)   Z_RISCV_PMP_ALIGN
 
#define RV_OP_LOADREG   lw
 
#define RV_OP_STOREREG   sw
 
#define RV_REGSIZE   4
 
#define RV_REGSHIFT   2
 
#define RV_OP_LOADFPREG   flw
 
#define RV_OP_STOREFPREG   fsw
 
#define MSTATUS_IEN   (1UL << 3)
 
#define MSTATUS_MPP_M   (3UL << 11)
 
#define MSTATUS_MPIE_EN   (1UL << 7)
 
#define MSTATUS_FS_INIT   (1UL << 13)
 
#define MSTATUS_FS_MASK   ((1UL << 13) | (1UL << 14))
 
#define MSTATUS_DEF_RESTORE   (MSTATUS_MPP_M | MSTATUS_MPIE_EN)
 
#define STACK_ROUND_UP(x)   ROUND_UP(x, ARCH_STACK_PTR_ALIGN)
 
#define DO_TOSTR(s)   #s
 
#define TOSTR(s)   DO_TOSTR(s)
 
#define DO_CONCAT(x, y)   x ## y
 
#define CONCAT(x, y)   DO_CONCAT(x, y)
 
#define K_MEM_PARTITION_P_RW_U_RW
 
#define K_MEM_PARTITION_P_RW_U_RO
 
#define K_MEM_PARTITION_P_RW_U_NA
 
#define K_MEM_PARTITION_P_RO_U_RO
 
#define K_MEM_PARTITION_P_RO_U_NA
 
#define K_MEM_PARTITION_P_NA_U_NA
 
#define K_MEM_PARTITION_P_RWX_U_RWX
 
#define K_MEM_PARTITION_P_RX_U_RX
 
#define ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p)
 

Functions

void arch_irq_enable (unsigned int irq)
 
void arch_irq_disable (unsigned int irq)
 
int arch_irq_is_enabled (unsigned int irq)
 
void arch_irq_priority_set (unsigned int irq, unsigned int prio)
 
static ALWAYS_INLINE unsigned int arch_irq_lock (void)
 
static ALWAYS_INLINE void arch_irq_unlock (unsigned int key)
 
static ALWAYS_INLINE bool arch_irq_unlocked (unsigned int key)
 
static ALWAYS_INLINE void arch_nop (void)
 
uint32_t sys_clock_cycle_get_32 (void)
 
static uint32_t arch_k_cycle_get_32 (void)
 

Detailed Description

RISCV specific kernel interface header This header contains the RISCV specific kernel interface. It is included by the generic kernel interface header (arch/cpu.h)

Macro Definition Documentation

◆ ARCH_IRQ_CONNECT

#define ARCH_IRQ_CONNECT (   irq_p,
  priority_p,
  isr_p,
  isr_param_p,
  flags_p 
)
Value:
{ \
Z_ISR_DECLARE(irq_p, 0, isr_p, isr_param_p); \
}

◆ ARCH_STACK_PTR_ALIGN

#define ARCH_STACK_PTR_ALIGN   16

◆ ARCH_THREAD_STACK_OBJ_ALIGN

#define ARCH_THREAD_STACK_OBJ_ALIGN (   size)    Z_RISCV_PMP_ALIGN

◆ ARCH_THREAD_STACK_RESERVED

#define ARCH_THREAD_STACK_RESERVED   CONFIG_PRIVILEGED_STACK_SIZE

◆ ARCH_THREAD_STACK_SIZE_ADJUST

#define ARCH_THREAD_STACK_SIZE_ADJUST (   size)     (ROUND_UP((size), Z_RISCV_PMP_ALIGN))

◆ CONCAT

#define CONCAT (   x,
 
)    DO_CONCAT(x, y)

◆ DO_CONCAT

#define DO_CONCAT (   x,
 
)    x ## y

◆ DO_TOSTR

#define DO_TOSTR (   s)    #s

◆ K_MEM_PARTITION_P_NA_U_NA

#define K_MEM_PARTITION_P_NA_U_NA
Value:
{0})
uint32_t k_mem_partition_attr_t
Definition: arch.h:267

◆ K_MEM_PARTITION_P_RO_U_NA

#define K_MEM_PARTITION_P_RO_U_NA
Value:

◆ K_MEM_PARTITION_P_RO_U_RO

#define K_MEM_PARTITION_P_RO_U_RO
Value:
{PMP_R})
#define PMP_R
Definition: csr.h:134

◆ K_MEM_PARTITION_P_RW_U_NA

#define K_MEM_PARTITION_P_RW_U_NA
Value:

◆ K_MEM_PARTITION_P_RW_U_RO

#define K_MEM_PARTITION_P_RW_U_RO
Value:

◆ K_MEM_PARTITION_P_RW_U_RW

#define K_MEM_PARTITION_P_RW_U_RW
Value:
{PMP_R | PMP_W})
#define PMP_W
Definition: csr.h:135

◆ K_MEM_PARTITION_P_RWX_U_RWX

#define K_MEM_PARTITION_P_RWX_U_RWX
Value:
{PMP_R | PMP_W | PMP_X})
#define PMP_X
Definition: csr.h:136

◆ K_MEM_PARTITION_P_RX_U_RX

#define K_MEM_PARTITION_P_RX_U_RX

◆ MSTATUS_DEF_RESTORE

#define MSTATUS_DEF_RESTORE   (MSTATUS_MPP_M | MSTATUS_MPIE_EN)

◆ MSTATUS_FS_INIT

#define MSTATUS_FS_INIT   (1UL << 13)

◆ MSTATUS_FS_MASK

#define MSTATUS_FS_MASK   ((1UL << 13) | (1UL << 14))

◆ MSTATUS_IEN

#define MSTATUS_IEN   (1UL << 3)

◆ MSTATUS_MPIE_EN

#define MSTATUS_MPIE_EN   (1UL << 7)

◆ MSTATUS_MPP_M

#define MSTATUS_MPP_M   (3UL << 11)

◆ RV_OP_LOADFPREG

#define RV_OP_LOADFPREG   flw

◆ RV_OP_LOADREG

#define RV_OP_LOADREG   lw

◆ RV_OP_STOREFPREG

#define RV_OP_STOREFPREG   fsw

◆ RV_OP_STOREREG

#define RV_OP_STOREREG   sw

◆ RV_REGSHIFT

#define RV_REGSHIFT   2

◆ RV_REGSIZE

#define RV_REGSIZE   4

◆ STACK_ROUND_UP

#define STACK_ROUND_UP (   x)    ROUND_UP(x, ARCH_STACK_PTR_ALIGN)

◆ TOSTR

#define TOSTR (   s)    DO_TOSTR(s)

Function Documentation

◆ arch_irq_disable()

void arch_irq_disable ( unsigned int  irq)

◆ arch_irq_enable()

void arch_irq_enable ( unsigned int  irq)

◆ arch_irq_is_enabled()

int arch_irq_is_enabled ( unsigned int  irq)

◆ arch_irq_lock()

static ALWAYS_INLINE unsigned int arch_irq_lock ( void  )
static

◆ arch_irq_priority_set()

void arch_irq_priority_set ( unsigned int  irq,
unsigned int  prio 
)

◆ arch_irq_unlock()

static ALWAYS_INLINE void arch_irq_unlock ( unsigned int  key)
static

◆ arch_irq_unlocked()

static ALWAYS_INLINE bool arch_irq_unlocked ( unsigned int  key)
static

◆ arch_k_cycle_get_32()

static uint32_t arch_k_cycle_get_32 ( void  )
inlinestatic

◆ arch_nop()

static ALWAYS_INLINE void arch_nop ( void  )
static

◆ sys_clock_cycle_get_32()

uint32_t sys_clock_cycle_get_32 ( void  )