📄 mk_irtos.h
字号:
#ifndef _MK_IRTOS_H_
#define _MK_IRTOS_H_
#define MK_STRUCT_FIELD_MARGIN 0
#define MK_IRTOS_VERSION "iRTOS V1.1006"
/* #include "mk_conf.h" */
/* Kernel Debug Module */
#define MK_DEBUG 0
/* Kernel Debug Print Service - MK_Panic(), MK_InfoPrintf() */
#define MK_DEBUG_PRINT 0
/* Debug Print Service - MK_Printf() */
#define MK_KERNEL_PRINT 0
//#define MK_PRINT_INDIRECT 1
#define MK_PRINT_INDIRECT 0
//#define MK_PRINT_TASK_PRIORITY 254
#define MK_PRINT_TASK_PRIORITY 1
//#define MK_PRINT_TASK_PRIORITY 0
#define MK_TTY_TASK_STACK_SIZE (1024*8)
#define MK_TTY_TX_MSG_BUFFER_SIZE (8*256)
//#define MK_STACK_CHECK 1
#define MK_STACK_CHECK 0
#define MK_STACK_CHECK_SIMPLE 1
#define MK_STACK_CHECK_DETAIL 0
#define MK_FREESTACK_MIN 20 /* Stack Overflow */
/* processor selection */
#define MK_CALMRISC16 0
#define MK_CALMRISC32 0
#define MK_80x86 0
#define MK_ARM9TM 1
/* Board selection */
#define MK_S5H5002_BASIC 1
#define MK_S5L3200_EVA 0
#define MK_S5L3200_R2500 0
#define MK_S5L5001_DVDChina 0
#define MK_S5L5001_DLAN_DVD 0
/* PCLK, UART bps setting */
//#define MK_PCLK 135000000 /* System PCLK */
//#define MK_PCLK 117000000 /* System PCLK */
/* <<< @: 5008CHN-XXX.cklee 050520 : OS Tick timer change */
#if defined(_USE_5008)
#define MK_PCLK 135000000 /* System PCLK */
#elif defined(_USE_5009)
//#define MK_PCLK 133000000 /* System PCLK */
#define MK_PCLK 132000000 /* System PCLK */
#elif defined(_USE_5010)
#define MK_PCLK 130000000 /* System PCLK */
#elif (defined(_USE_5005) || defined(_USE_5015))
#define MK_PCLK 125000000 /* System PCLK */
#else
#define MK_PCLK 116000000 /* System PCLK */
#endif
/* >>> @: 5008CHN-XXX.cklee 050520 */
#define MK_BPS 115200 /* UART Baud rate */
/* Timer */
//#define MK_RTOS_TIMER_INTERVAL 2000000 /* 2000 us */
//#define MK_RTOS_TIMER_INTERVAL 1000000 /* 1000 us */
/* <<< @: 5008CHN-XXX.cklee 050520 : OS Tick timer change */
#if (defined(_USE_5008) || defined(_USE_5005) || defined(_USE_5010) || defined(_USE_5009) || defined(_USE_5015))
#define MK_RTOS_TIMER_INTERVAL 2000000 /* 2000 us */
#else
#define MK_RTOS_TIMER_INTERVAL 500000 /* 500 us */
#endif
/* >>> @: 5008CHN-XXX.cklee 050520 */
#if (defined(_USE_5005) || defined(_USE_5015))
#define MK_TIMER_HISR 0
#else
#define MK_TIMER_HISR 0
#endif
#define MK_TIMER_HISR_STACK_SIZE (1024*8) /* Must be multiple of 4 */
#define MK_uTimeToTicks(uTime) (uTime/MK_RTOS_TIMER_INTERVAL)
/* Idle Task */
#define MK_IDLE_TASK_STACK_SIZE 256//(1024*4*10) /* Must be multiple of 4 */
#define MK_SHELL_BUF_MAX 256
#define MK_ARGC_MAX 16
#define MK_USE_FIQ 1 /* enable (20050720, ishan) */
/* operating system and application mode selection */
/* #define MK_THUMB_MODE 0 */
/* Service Selection */
#define _MK_HISR /* Must be always defined */
#define _MK_MSGQUEUE
#define _MK_SEMAPHORE
#define _MK_EVENT
#define _MK_TIMER
#if 1 /* Minimum API */
//#define _MK_MAILBOX
//#define _MK_SIGNAL
/* #define _MK_MPORT */
/* #define _MK_TPORT */
/* #define _MK_DEV */
/* #define _MK_SHELL */
#else /* Maximum API */
#define _MK_MAILBOX
#define _MK_SIGNAL
#define _MK_MPORT
#define _MK_TPORT
#define _MK_DEV
#define _MK_SHELL
#define _MK_UART
#define _MK_TTY
#endif /* 0 */
/*-----------------------------------------------------------------
* Data Type Definition
*-----------------------------------------------------------------*/
#ifndef __MK_S8__
#define __MK_S8__
typedef char MK_S8_t;
#endif
#ifndef __MK_U8__
#define __MK_U8__
typedef unsigned char MK_U8_t;
#endif
#if 0
#ifndef __UNSIGNED_CHAR
#define __UNSIGNED_CHAR
typedef unsigned char UNSIGNED_CHAR;
#endif
#endif /* 0 */
#if 0
#ifndef __MK_OPTION__
#define __MK_OPTION__
typedef unsigned char MK_Option_t;
#endif
#endif /* 0 */
#ifndef __MK_S16__
#define __MK_S16__
typedef short MK_S16_t;
#endif
#ifndef __MK_U16__
#define __MK_U16__
typedef unsigned short MK_U16_t;
#endif
#ifndef __MK_STATUS__
#define __MK_STATUS__
typedef int MK_Status_t;
#endif
#ifndef __MK_BOOLEAN__
#define __MK_BOOLEAN__
typedef int MK_Bool_t;
#endif
#ifndef __MK_INT__
#define __MK_INT__
typedef int MK_INT_t;
#endif
#ifndef __MK_UINT__
#define __MK_UINT__
typedef unsigned int MK_UINT_t;
#endif
#if 0
#ifndef __UNSIGNED
#define __UNSIGNED
typedef unsigned UNSIGNED;
#endif
#endif /* 0 */
#ifndef __MK_S32__
#define __MK_S32__
typedef long MK_S32_t;
#endif
#ifndef __MK_U32__
#define __MK_U32__
typedef unsigned long MK_U32_t;
#endif
#ifndef __VOID__
#define __VOID__
typedef void MK_Void_t;
#endif
#ifndef __MK_LOGLEVEL__
#define __MK_LOGLEVEL__
typedef long MK_Loglevle_t;
#endif
#if 0
#ifndef TRUE
#define TRUE 1
#endif
#endif /* 0 */
#if 0
#ifndef FALSE
#define FALSE 0
#endif
#endif /* 0 */
#if 0
#ifndef __INT8
#define __INT8
typedef char INT8;
#endif
#ifndef __UINT8
#define __UINT8
typedef unsigned char UINT8;
#endif
#ifndef __INT16
#define __INT16
typedef signed short INT16;
#endif
#ifndef __UINT16
#define __UINT16
typedef unsigned short UINT16;
#endif
#ifndef __INT32
#define __INT32
typedef signed long INT32;
#endif
#ifndef __UINT32
#define __UINT32
typedef unsigned long UINT32;
#endif
#endif /* 0 */
#if 0
#ifndef __MK_STACK_T
#define __MK_STACK_T
typedef unsigned long MK_STACK_T;
#endif
#endif /* 0 */
#ifndef MK_NULL
#define MK_NULL (void *)0
#endif
/*-----------------------------------------------------------------
* Constant Definition
*-----------------------------------------------------------------*/
#define MK_NO_ERROR 0
#define MK_ERROR -1
#define MK_TRUE 1
#define MK_FALSE 0
#define MK_TIMEOUT -2
#define MK_RESOURCE_ERROR -3
#define MK_WORDALIGN_ERROR -4
#define MK_SMALLMEMORY_ERROR -5
/* #define MK_NAME_MAX 16 */
#define MK_TASK_MIN_PRIORITY 0
#define MK_TASK_MAX_PRIORITY 255
/* #define Idle_Task 255 */
#define MK_DEFAULT_TIMESLICE 1
#define MK_TASK_FIFO 0 /* FIFO Schedule in Same Priority Task */
#define MK_TASK_RR 1 /* Round-Robin Schedule in Same Priority Task */
#define MK_SERVICE_FIFO 0
#define MK_SERVICE_PRIORITY 1
#define MK_WAIT_FOREVER -1
#define MK_NO_WAIT 0
#define MK_TIMER_DISABLE 0
#define MK_TIMER_ENABLE 1
#if 1
#define MK_INTERRUPT_DISABLE 0xc0
#define MK_INTERRUPT_ENABLE 0x00
#endif /* 0 */
#if 1
#define MK_UPDATE_NORMAL 0
#define MK_UPDATE_IGNORE 1
#endif /* 0 */
#define MK_FIXED_SIZE 0
#define MK_VARIABLE_SIZE 1
#define MK_EVENT_OR 0x00000000
#define MK_OR_CONSUME 0x00000001
#define MK_EVENT_AND 0x00000002
#define MK_AND_CONSUME 0x00000003
/*-----------------------------------------------------------------
* Structure Definition
*-----------------------------------------------------------------*/
struct mk_semaphore_struct;
struct mk_event_struct;
struct mk_heap_struct;
typedef struct mk_pending_list_struct {
struct mk_task_struct *p_Head;
struct mk_task_struct *p_Tail;
union {
struct mk_semaphore_struct *ps_pSem;
struct mk_event_struct *ps_pEvent;
struct mk_heap_struct *ps_pHeap;
MK_U32_t ps_Default;
} p_PendigSource;
MK_Bool_t p_Options;
} MK_PENDING_LIST;
typedef MK_Void_t(*MK_TASK_FUNC_T)(MK_U32_t, MK_Void_t *);
typedef struct mk_task_struct {
MK_U32_t t_Magic; /* Magic Value of Task Control Block */
MK_U32_t t_CurrentOfStack; /* Current Pointer of Stack */
MK_U32_t t_TopOfStack; /* Top Pointer of Stack */
MK_U32_t t_BottomOfStack; /* Bottom Pointer of Stack */
MK_U32_t t_PreviousCurrentOfStack; /* Used in Signal */
MK_U32_t t_LengthofStackArea; /* Length of Reserved Stack Area */
MK_U32_t t_Status; /* Status of Task */
MK_U32_t t_Priority; /* Priority of Task */
MK_Void_t (*t_Function)(MK_U32_t, MK_Void_t*); /* Fucntion for Task */
MK_S32_t t_RemainedTimeSlice; /* Remained Time Slice */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -