PORT按CPU型号更简单
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "cpu_clz.h"
|
||||
#include "os_config.h"
|
||||
#include "cpu.h"
|
||||
|
||||
#if !defined(OS_CFG_CPU_CLZ_ASM_PRESENT) || (!OS_CFG_CPU_CLZ_ASM_PRESENT)
|
||||
// 如果配置中没有提供汇编版本的clz函数,则使用C语言实现
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#cmakedefine OS_CFG_TICKS_PER_SECOND @OS_CFG_TICKS_PER_SECOND@
|
||||
#cmakedefine OS_CFG_SYSCALL_PRIORITY @OS_CFG_SYSCALL_PRIORITY@
|
||||
#cmakedefine OS_CFG_PRIORITY_MAX @OS_CFG_PRIORITY_MAX@
|
||||
#cmakedefine OS_CFG_CPU_CLZ_ASM_PRESENT @OS_CFG_CPU_CLZ_ASM_PRESENT@
|
||||
|
||||
#cmakedefine OS_CFG_IDLE_TASK_STACK_SIZE @OS_CFG_IDLE_TASK_STACK_SIZE@
|
||||
#cmakedefine OS_CFG_IDLE_TASK_TICKS @OS_CFG_IDLE_TASK_TICKS@
|
||||
@@ -18,6 +17,12 @@
|
||||
#cmakedefine OS_CFG_DEVICE_MAX @OS_CFG_DEVICE_MAX@
|
||||
|
||||
|
||||
#cmakedefine OS_CFG_CPU_CLZ_ASM_PRESENT @OS_CFG_CPU_CLZ_ASM_PRESENT@
|
||||
#cmakedefine OS_CFG_CPU_CORE_NAME @OS_CFG_CPU_CORE_NAME@
|
||||
#cmakedefine OS_CFG_CPU_FPU_PRESENT @OS_CFG_CPU_FPU_PRESENT@
|
||||
#cmakedefine OS_CFG_CPU_MPU_PRESENT @OS_CFG_CPU_MPU_PRESENT@
|
||||
|
||||
|
||||
|
||||
/* ==================================================================================================== */
|
||||
/* DEFAULT */
|
||||
@@ -58,4 +63,13 @@
|
||||
#define OS_CFG_IDLE_TASK_PRIORITY OS_PRIORITY_IDLE
|
||||
#endif /*OS_CFG_IDLE_TASK_PRIORITY*/
|
||||
|
||||
#ifndef OS_CFG_CPU_FPU_PRESENT
|
||||
#define OS_CFG_CPU_FPU_PRESENT 0
|
||||
#endif /* OS_CFG_CPU_FPU_PRESENT */
|
||||
|
||||
#ifndef OS_CFG_CPU_MPU_PRESENT
|
||||
#define OS_CFG_CPU_MPU_PRESENT 0
|
||||
#endif /* OS_CFG_CPU_MPU_PRESENT */
|
||||
|
||||
|
||||
#endif /*INCLUDED_OS_CONFIG_H*/
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifndef INCLUDED_OS_PORT_H
|
||||
#define INCLUDED_OS_PORT_H
|
||||
|
||||
#ifndef INCLUDED_CPU_H
|
||||
#include <cpu.h>
|
||||
#endif /*INCLUDED_CPU_H*/
|
||||
|
||||
#ifndef INCLUDED_OS_TYPES_H
|
||||
#include <os_types.h>
|
||||
#endif /*INCLUDED_OS_TYPES_H*/
|
||||
@@ -9,7 +13,6 @@
|
||||
#include <os_task.h>
|
||||
#endif /*INCLUDED_OS_TASK_H*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
@@ -56,17 +59,37 @@ void os_port_on_switch_success(void);
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* 中断管理 */
|
||||
|
||||
void os_port_disable_irq(void);
|
||||
|
||||
void os_port_enable_irq(void);
|
||||
//void os_port_disable_irq(void);
|
||||
//void os_port_enable_irq(void);
|
||||
//os_uint_t os_port_save_disable_irq(void);
|
||||
//void os_port_restore_irq(os_uint_t level);
|
||||
//os_uint_t os_port_save_disable_irq_in_isr(void);
|
||||
//void os_port_restore_irq_in_isr(os_uint_t level);
|
||||
|
||||
os_uint_t os_port_save_disable_irq(void);
|
||||
#ifndef os_port_disable_irq
|
||||
#define os_port_disable_irq
|
||||
#endif
|
||||
|
||||
void os_port_restore_irq(os_uint_t level);
|
||||
#ifndef os_port_enable_irq
|
||||
#define os_port_enable_irq
|
||||
#endif
|
||||
|
||||
os_uint_t os_port_save_disable_irq_in_isr(void);
|
||||
#ifndef os_port_save_disable_irq
|
||||
#define os_port_save_disable_irq
|
||||
#endif
|
||||
|
||||
void os_port_restore_irq_in_isr(os_uint_t level);
|
||||
#ifndef os_port_restore_irq
|
||||
#define os_port_restore_irq
|
||||
#endif
|
||||
|
||||
#ifndef os_port_save_disable_irq_in_isr
|
||||
#define os_port_save_disable_irq_in_isr
|
||||
#endif
|
||||
|
||||
#ifndef os_port_restore_irq_in_isr
|
||||
#define os_port_restore_irq_in_isr
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* 初始化和启动 */
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#include <os_sched.h>
|
||||
#endif /*INCLUDED_OS_SCHED_H*/
|
||||
|
||||
#ifndef INCLUDED_OS_ALIGN_H
|
||||
#include <os_align.h>
|
||||
#endif /*INCLUDED_OS_ALIGN_H*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
@@ -76,6 +79,18 @@ os_task_t* os_task_self(void){
|
||||
return (os_task_t*)g_os_sched_current_task_p;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
#define OS_TASK_DEF(Name, StackSize) \
|
||||
OS_ALIGNED(OS_ALIGN_SIZE) \
|
||||
static uint8_t Name##_Stack[StackSize]; \
|
||||
static os_task_t Name; \
|
||||
OS_NORETURN \
|
||||
static void Name##_TaskEntry(void* param)
|
||||
|
||||
#define OS_TASK_RUN(Name, Param, Ticks, Priority) \
|
||||
os_task_init(&Name, Name##_TaskEntry, Param, Name##_Stack, OS_ARRAY_SIZE(Name##_Stack), Ticks, Priority)
|
||||
|
||||
|
||||
#endif /*INCLUDED_OS_TASK_H*/
|
||||
|
||||
Reference in New Issue
Block a user