📄 mk_irtos.h
字号:
MK_S32_t (*d_Read)(struct mk_dev_struct *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
MK_S32_t (*d_Write)(struct mk_dev_struct *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
MK_S32_t (*d_Seek)(struct mk_dev_struct *pDev, MK_S32_t Position);
MK_S8_t (*d_Getc)(struct mk_dev_struct *pDev);
MK_Status_t (*d_Putc)(struct mk_dev_struct *pDev, MK_S8_t Ch);
MK_S32_t (*d_Ctrl)(struct mk_dev_struct *pDev, MK_S32_t Function, MK_S8_t *pAddr1, MK_S8_t *pAddr2);
MK_Void_t (*d_InInterrupt)(MK_Void_t);
MK_Void_t (*d_Old_InInterrupt)(MK_Void_t);
MK_Void_t (*d_OutInterrupt)(MK_Void_t);
MK_Void_t (*d_Old_OutInterrupt)(MK_Void_t);
MK_S32_t d_InVector;
MK_S32_t d_OutVector;
MK_S32_t d_Minor;
MK_S8_t *d_pName;
MK_S8_t *d_pIOBlock;
MK_U16_t d_Port;
struct mk_dev_struct *d_pPrev;
struct mk_dev_struct *d_pNext;
} MK_DEV;
#endif /* 0 */
#if 0
typedef struct {
MK_U32_t Field[23+MK_STRUCT_FIELD_MARGIN];
} MK_DEV;
#endif /* 0 */
#if 0
typedef struct mk_shell_vars_struct {
MK_DEV *sv_pDev;
MK_U32_t sv_CommandCount;
MK_S8_t sv_Prompt[MK_SHELL_BUF_MAX];
MK_S8_t sv_RxBuffer[MK_SHELL_BUF_MAX];
MK_S8_t sv_Command[MK_SHELL_BUF_MAX];
MK_S32_t sv_Argc;
MK_S8_t *sv_Args[MK_ARGC_MAX];
} MK_SHELL_VARS;
#endif /* 0 */
#if 0
typedef int (*MK_SHELL_FUNCTION)(MK_DEV *pDev, MK_S32_t, char **);
typedef struct mk_shell_command_struct{
char sc_Name[MK_SHELL_BUF_MAX];
char sc_Help[MK_SHELL_BUF_MAX];
MK_SHELL_FUNCTION sc_Funtion;
struct mk_shell_command_struct *sv_pNext;
struct mk_shell_command_struct *sv_pPrev;
} MK_SHELL_COMMAND;
#endif /* 0 */
typedef MK_Void_t (*MK_SIG_FUNCTION)(MK_U32_t);
typedef MK_Void_t (*MK_HISR_FUNC_T)(MK_Void_t);
//typedef MK_Void_t(*MK_IRQ_FUNCTION)(MK_INT_t);
typedef MK_Void_t(*MK_INT_FUNCTION)(MK_INT_t);
/*-----------------------------------------------------------------
* String Library API Function
*-----------------------------------------------------------------*/
MK_S8_t *MK_Strcpy(MK_S8_t *pDst, MK_S8_t *pSrc);
MK_U32_t MK_Strlen(MK_S8_t *pString);
MK_U32_t MK_Strcmp(MK_S8_t *pStr1, MK_S8_t *pStr2);
MK_S8_t *MK_Strcat(MK_S8_t *pStr1, MK_S8_t *pStr2);
MK_S8_t *MK_BlockCopy(MK_S8_t *pDst, MK_S8_t *pSrc, MK_U32_t Lenth);
MK_S8_t *MK_MemCopy(MK_S8_t *pDst, MK_S8_t Ch, MK_U32_t Length);
/*-----------------------------------------------------------------
* Interrupt API Function
*-----------------------------------------------------------------*/
MK_INT_t MK_InterruptDisable(MK_Void_t);
MK_Void_t MK_InterruptRestore(MK_INT_t);
MK_INT_t MK_InterruptEnable(MK_Void_t);
MK_INT_t MK_LocalControlInterrupt(MK_INT_t);
MK_INT_FUNCTION MK_IRQInstall(MK_INT_t Num, MK_Void_t(*lisr_entry)(MK_INT_t));
MK_INT_FUNCTION MK_FIQInstall(MK_INT_t Num, MK_Void_t(*lisr_entry)(MK_INT_t));
/*-----------------------------------------------------------------
* Task API Function
*-----------------------------------------------------------------*/
MK_TASK *MK_CreateTask(MK_TASK *pTask, MK_Void_t(*task_entry)(MK_U32_t, MK_Void_t*), MK_U32_t Priority,
MK_S8_t *pTaskName, MK_S32_t TimeSlice, MK_S8_t *pStackArea,
MK_U32_t StackLength, MK_U32_t Arg1, MK_Void_t *Arg2);
MK_Status_t MK_DeleteTask(MK_TASK *pTask);
MK_Status_t MK_ResetTask(MK_TASK *pTask, MK_U32_t Arg1, MK_Void_t *Arg2);
MK_U32_t MK_ChangePriority(MK_TASK *pTask, MK_U32_t NewPrio);
MK_U32_t MK_GetPriority(MK_TASK *pTask);
MK_TASK *MK_GetCurrentTask(MK_Void_t);
MK_Status_t MK_Suspend(MK_TASK *pTask);
MK_Status_t MK_Resume(MK_TASK *pTask);
MK_Void_t MK_SleepTicks(MK_S32_t Ticks);
MK_Status_t MK_Unsleep(MK_TASK *pTask);
MK_INT_t MK_ContextSwitchDisable(MK_Void_t);
MK_INT_t MK_ContextSwitchEnable(MK_Void_t);
MK_Void_t MK_ContextSwitchRestore(MK_INT_t ContextSwitchFlags);
MK_INT_t MK_GetContextSwitchFlags(MK_Void_t);
MK_Bool_t MK_GetSchedulePolicy(MK_Void_t);
MK_Bool_t MK_SetSchedulePolicy(MK_Bool_t NewPolicy);
MK_S8_t *MK_GetTaskName(MK_TASK *pTask);
MK_S32_t MK_ChangeTimeSlice(MK_TASK *pTask, MK_S32_t newTimeSlice);
MK_U32_t MK_GetTotalTasks(MK_Void_t);
#if 0
/* coded by ympark */
MK_Void_t MK_Protect(MK_PROTECT *p_struct);
#endif /* 0 */
/*-----------------------------------------------------------------
* Timer API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_CreateTimer(MK_TIMER *pTimer, MK_S8_t *pName, MK_TIMER_FUNC_T Function, MK_S32_t Arg1, MK_Void_t *Arg2,
MK_U32_t InitialTime, MK_U32_t RepeateTime, MK_Bool_t Enable);
MK_U32_t MK_GetTimerRepeateTime(MK_TIMER *pTimer);
MK_U32_t MK_SetTimerRepeateTime(MK_TIMER *pTimer, MK_U32_t NewTime);
MK_Bool_t MK_GetTimerStatus(MK_TIMER *pTimer);
MK_Status_t MK_ControlTimer(MK_TIMER *pTimer, MK_Bool_t Enable);
MK_Status_t MK_DeleteTimer(MK_TIMER *pTimer);
MK_Status_t MK_GetRemainingTime( MK_TIMER *pTimer, MK_U32_t *remainTime);
MK_Status_t MK_ResetTimer(MK_TIMER *pTimer, MK_TIMER_FUNC_T Function,
MK_U32_t InitialTime, MK_U32_t RepeateTime, MK_Bool_t Enable);
MK_U32_t MK_GetSystemClock(MK_Void_t);
MK_Void_t MK_SetSystemClock(MK_U32_t newTicks);
/*-----------------------------------------------------------------
* Task Port API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_TaskPortSend(MK_TASK *pTask, MK_U32_t Value, MK_Bool_t Ignore);
MK_Status_t MK_TaskPortReceive(MK_U32_t *Value, MK_S32_t Ticks);
MK_Void_t MK_TaskPortClear(MK_Void_t);
/*-----------------------------------------------------------------
* Signal API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_RegisterSignalHandler(MK_Void_t(*signal_entry)(MK_U32_t));
MK_U32_t MK_GetSignalMask(MK_Void_t);
MK_U32_t MK_SetSignalMask(MK_U32_t SigMask);
MK_Void_t MK_ClearSignal(MK_Void_t);
MK_Status_t MK_SignalSend(MK_TASK *pTask, MK_U32_t Signal);
MK_U32_t MK_ReceiveSignals(MK_Void_t);
/*-----------------------------------------------------------------
* Semaphore API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_CreateSemaphore(MK_SEMAPHORE *pSemaphore, MK_S8_t *pName, MK_S32_t Count, MK_Bool_t Options);
MK_S32_t MK_GetSemaphoreCount(MK_SEMAPHORE *pSemaphore);
MK_INT_t MK_DeleteSemaphore(MK_SEMAPHORE *pSemaphore);
MK_Status_t MK_SemaphorePend(MK_SEMAPHORE *pSemaphore, long Ticks);
MK_Status_t MK_SemaphorePost(MK_SEMAPHORE *pSemaphore);
MK_Status_t MK_SemaphoreReset(MK_SEMAPHORE *pSemaphore, MK_S32_t Count);
/*-----------------------------------------------------------------
* Queue API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_CreateMsgQueue(MK_QUEUE *pQueue, MK_S8_t *pName, MK_Void_t *pAddr, MK_U32_t Size, MK_Bool_t Type,
MK_U32_t MsgSize, MK_Bool_t Options);
MK_Status_t MK_DeleteMsgQueue(MK_QUEUE *pQueue);
MK_Status_t MK_MsgQueuePend(MK_QUEUE *pMsgQueue, MK_Void_t *pMsg,
MK_U32_t BufSize, MK_U32_t *pLength, long Ticks);
MK_Status_t MK_MsgQueuePost(MK_QUEUE *pMsgQueue, MK_Void_t *pMsg, MK_U32_t Length,
MK_S32_t Ticks);
MK_Status_t MK_MsgQueueReset(MK_QUEUE *pQueue);
MK_Status_t MK_MsgQueueFrontPost(MK_QUEUE *pQueue, MK_Void_t *pMsg, MK_U32_t Length, long Ticks);
MK_Status_t MK_MsgQueueBroadcastPost(MK_QUEUE *pQueue, MK_Void_t *pMsg, MK_U32_t Length, long Ticks);
MK_U32_t MK_GetMsgQueueAvailableSize(MK_QUEUE *pQueue);
MK_U32_t MK_GetFixedMsgQueueNeededSize(MK_U32_t Count, MK_U32_t Size);
MK_U32_t MK_GetFixedMsgQueueBufferSize(MK_QUEUE *pQueue);
MK_U32_t MK_GetFixedMsgQueueCount(MK_QUEUE *pQueue);
/*-----------------------------------------------------------------
* Message Port API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_CreateMsgPort(MK_PORT *pPort, MK_S8_t *pName, MK_Void_t *pAddr,
MK_INT_t MsgCount, MK_Bool_t Options);
MK_U32_t MK_GetMsgPortMemorySize(MK_U32_t MsgCount);
MK_Status_t MK_DeleteMsgPort(MK_PORT *pPort);
MK_U32_t MK_GetMsgPortCount(MK_PORT *pPort);
MK_Status_t MK_MsgPortPend(MK_PORT *pPort, MK_Void_t **pMessage, MK_S32_t *pMsgLength,
MK_S32_t *pBufLength, long Ticks);
MK_Status_t MK_MsgPortPost(MK_PORT *pPort, MK_S8_t *pMessage, MK_S32_t pMsgLength,
MK_S32_t pBufLength, long Ticks);
/*-----------------------------------------------------------------
* Memory Management API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_CreateHeapManager(MK_HEAP *pHeap, MK_S8_t *pName, MK_Void_t *pAddr, MK_U32_t Length,
MK_U32_t MinSize, MK_Bool_t Options);
MK_Status_t MK_DeleteHeapManager(MK_HEAP *pHeap);
MK_Status_t MK_ResetHeapManager(MK_HEAP *pHeap);
MK_Status_t MK_GetHeapInformation(MK_HEAP *pHeap, MK_Void_t **pStartAddr, MK_U32_t *pSize,
MK_U32_t *pMinSize, MK_U32_t *pAvailableSize);
MK_Status_t MK_GetMemory(MK_HEAP *pHeap, MK_Void_t **pAddr, MK_U32_t Size, long Ticks);
MK_Status_t MK_FreeMemory(MK_Void_t *pAddr);
MK_U32_t MK_GetHeapMaxMemorySize(MK_HEAP *pHeap);
MK_Status_t MK_CreateBufferPool(MK_POOL *pPool, MK_S8_t *pName, MK_Void_t *pAddr, MK_U32_t Count,
MK_U32_t Size, MK_Bool_t Options);
MK_Status_t MK_DeleteBufferPool(MK_POOL *pPool);
MK_Status_t MK_ResetBufferPool(MK_POOL *pPool);
MK_Status_t MK_GetBuf(MK_POOL *pPool, MK_Void_t **pAddr, long Ticks);
MK_Status_t MK_FreeBuf(MK_Void_t *pAddr);
MK_U32_t MK_GetPoolNeededSize(MK_U32_t Count, MK_U32_t Size);
MK_U32_t MK_GetPoolBufferSize(MK_POOL *pPool);
MK_U32_t MK_GetPoolBufferFreeCount(MK_POOL *pPool);
/*-----------------------------------------------------------------
* Message Mailbox API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_CreateMsgMailBox(MK_MBOX *pMBox, MK_S8_t *pName, MK_Void_t *pAddr, MK_U32_t Size,
MK_Bool_t Options);
MK_U32_t MK_GetMsgMailBoxMemorySize(MK_U32_t Size);
MK_Status_t MK_DeleteMsgMailBox(MK_MBOX *pMBox);
MK_Status_t MK_MsgMailBoxReset(MK_MBOX *pMBox);
MK_Status_t MK_MsgMailBoxPend(MK_MBOX *pMBox, MK_Void_t **pMsg, MK_U32_t BufSize, MK_U32_t *pLength,
MK_S32_t Ticks);
MK_Status_t MK_MsgMailBoxPost(MK_MBOX *pMBox, MK_Void_t *pMsg, MK_U32_t Length, MK_S32_t Ticks);
MK_Status_t MK_MsgMailBoxBroadcastPost(MK_MBOX *pMBox, MK_Void_t *pMsg, MK_U32_t Length, MK_S32_t Ticks);
/*-----------------------------------------------------------------
* HISR API Function
*-----------------------------------------------------------------*/
MK_HISR *MK_CreateHISR(MK_HISR *pHisr, MK_S8_t *name, MK_Void_t(*hisr_entry)(MK_Void_t), MK_U32_t Priority,
MK_S8_t *StackPtr, MK_U32_t StackLength);
MK_Void_t MK_ActivateHISR(MK_HISR *pHisr);
MK_Void_t MK_DeleteHISR(MK_HISR *pHisr);
MK_HISR *MK_GetCurrentHISR(MK_Void_t);
/*-----------------------------------------------------------------
* API Function
*-----------------------------------------------------------------*/
MK_Status_t MK_CreateEvent(MK_EVENT *pEvent, MK_S8_t *pName);
MK_Status_t MK_DeleteEvent(MK_EVENT *pEvent);
MK_Status_t MK_SetEvent(MK_EVENT *pEvent, MK_U32_t Events, MK_U32_t operation);
MK_Status_t MK_EventPend(MK_EVENT *pEvent, MK_U32_t Request, MK_U32_t Operation, MK_U32_t *Events, MK_S32_t Ticks);
/*-----------------------------------------------------------------
* API Function
*-----------------------------------------------------------------*/
#define MK_SYSTEM_INFO 0x10000001
#define MK_TASK_INFO 0x20000001
#define MK_TASK_WARNING 0x20000002
#define MK_TASK_ERROR 0x20000004
#define MK_TASK_CRITICAL 0x20000008
#define MK_NO_PUTS 0
#define MK_PUTS_DIRECT 1
#define MK_PUTS_INDIRECT 2
MK_INT_t MK_Set_PutsMode(MK_INT_t Mode);
MK_INT_t MK_Get_PutsMode(MK_Void_t);
MK_Void_t MK_Printf(MK_S8_t *, ...);
MK_Void_t MK_InfoPrintf(MK_Loglevle_t ErrorInfo, MK_S8_t *, ...);
MK_Void_t MK_Panic(MK_S8_t *fmt, ...);
//MK_Void_t MK_Fprintf(MK_DEV *pDev, MK_S8_t *fmt,...);
MK_INT_t MK_Sprintf(MK_S8_t * buf, MK_S8_t *fmt, ...);
MK_Void_t MK_SystemInitialize(MK_Void_t);
MK_Void_t MK_RTOSInitialize(MK_Void_t);
MK_Void_t MK_RTOSTimerInitialize(MK_Void_t);
MK_Void_t MK_Start(MK_Void_t);
/*-----------------------------------------------------------------
* API Function
*-----------------------------------------------------------------*/
//MK_Status_t MK_DeviceInitialize(MK_Void_t);
//MK_Status_t MK_DeviceInformation(MK_DEV *pDev);
//MK_Void_t MK_DeviceFieldInitialize(MK_DEV_FIELD *pField);
//MK_Status_t MK_CreateDevice(MK_DEV *pDev, MK_DEV_FIELD *pField);
//MK_Status_t MK_DeleteDevice(MK_DEV *pDev);
//MK_S32_t MK_OpenDevice(MK_DEV *pDev, MK_S8_t *pFileName, MK_S8_t *pMode);
//MK_S32_t MK_CloseDevice(MK_DEV *pDev);
//MK_S32_t MK_Open(struct mk_dev_struct *pDev, MK_S8_t *pName, MK_S8_t *pMode);
//MK_S32_t MK_Close(struct mk_dev_struct *pDev);
//MK_S32_t MK_Read(struct mk_dev_struct *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
//MK_S32_t MK_Write(struct mk_dev_struct *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
//MK_S32_t MK_Seek(struct mk_dev_struct *pDev, MK_S32_t Position);
//MK_S8_t MK_Getc(struct mk_dev_struct *pDev);
//MK_S32_t MK_Putc(struct mk_dev_struct *pDev, MK_S8_t Ch);
//MK_S32_t MK_Ctrl(struct mk_dev_struct *pDev, MK_S32_t Function, MK_S8_t *pAddr1, MK_S8_t *pAddr2);
/* Null Device */
#if 0
MK_S32_t MK_NULLInit(MK_DEV *pDev, MK_U32_t Options);
MK_S32_t MK_NULLOpen(MK_DEV *pDev, MK_S8_t *pName, MK_S8_t *pMode);
MK_S32_t MK_NULLClose(MK_DEV *pDev);
MK_S32_t MK_NULLRead(MK_DEV *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
MK_S32_t MK_NULLWrite(MK_DEV *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
MK_S32_t MK_NULLSeek(MK_DEV *pDev, MK_S32_t Position);
MK_S8_t MK_NULLGetc(MK_DEV *pDev);
MK_S32_t MK_NULLPutc(MK_DEV *pDev, MK_S8_t Ch);
MK_S32_t MK_NULLCtrl(MK_DEV *pDev, MK_S32_t Function, MK_S8_t *pAddr1, MK_S8_t *pAddr2);
MK_Void_t MK_NULLInInterrupt(MK_Void_t);
MK_Void_t MK_NULLOutInterrupt(MK_Void_t);
#endif /* 0 */
/* IO Error Device */
#if 0
MK_S32_t MK_ErrorInit(MK_DEV *pDev, MK_U32_t Options);
MK_S32_t MK_ErrorOpen(MK_DEV *pDev, MK_S8_t *pName, MK_S8_t *pMode);
MK_S32_t MK_ErrorClose(MK_DEV *pDev);
MK_S32_t MK_ErrorRead(MK_DEV *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
MK_S32_t MK_ErrorWrite(MK_DEV *pDev, MK_S8_t *pBuffer, MK_S32_t Count);
MK_S32_t MK_ErrorSeek(MK_DEV *pDev, MK_S32_t Position);
MK_S8_t MK_ErrorGetc(MK_DEV *pDev);
MK_S32_t MK_ErrorPutc(MK_DEV *pDev, MK_S8_t Ch);
MK_S32_t MK_ErrorCtrl(MK_DEV *pDev, MK_S32_t Function, MK_S8_t *pAddr1, MK_S8_t *pAddr2);
MK_Void_t MK_ErrorInInterrupt(MK_Void_t);
MK_Void_t MK_ErrorOutInterrupt(MK_Void_t);
#endif /* 0 */
/*-----------------------------------------------------------------
* API Function
*-----------------------------------------------------------------*/
#if 0
MK_Status_t MK_ShellInitalize(MK_Void_t);
MK_Status_t MK_RegisterShellCommand(MK_SHELL_COMMAND *pShellCommand, MK_S8_t *pName,
MK_S8_t *pHelp, MK_SHELL_FUNCTION Funtion);
MK_Void_t MK_Shell(MK_U32_t pDefaultShellVars, MK_Void_t *pDefaultDev);
#endif /* 0 */
#endif /* _MK_IRTOS_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -