?? syscall.s
字號:
;**************************************************************************************************
; EDL RTOS Kernel
; (c) Copyright 2005, Wu Jun
; All Rights Reserved
; For further information, please visit http://www.enjoydigitallife.com
;
; Description: None
; History:
; Date Remarks
; 2005-01-06 Created initial version
; 2005-12-12 Finished the version 2.01
;**************************************************************************************************
EXPORT edl_createTask
EXPORT edl_deleteTask
EXPORT edl_suspendTask
EXPORT edl_resumeTask
EXPORT edl_sleep
EXPORT edl_wakeTask
EXPORT edl_sendEvent
EXPORT edl_getEvent
EXPORT edl_trunkAlloc
EXPORT edl_trunkFree
EXPORT edl_heapCreate
EXPORT edl_heapDelete
EXPORT edl_heapAlloc
EXPORT edl_heapFree
EXPORT edl_heapReAlloc
EXPORT edl_createSem
EXPORT edl_deleteSem
EXPORT edl_getSem
EXPORT edl_releaseSem
EXPORT edl_sendMsg
EXPORT edl_getMsg
EXPORT edl_createMutex
EXPORT edl_deleteMutex
EXPORT edl_getMutex
EXPORT edl_releaseMutex
CODE32
AREA SYSTEM_CALLS, CODE,READONLY
;/**************************************************************************************************
;* Description: create a task
;* Parameters: tskProc pointer to task's starting code
; pdata Pointer to a data block which could be used by task's
; routine
; prio task's priority, start at 1
; stackSize Specifies the stack size in unit of word( 4 bytes ).
; tskMode Specifies the task mode
; TSK_MODE_SYS For kernel task
; TSK_MODE_USR For user task
; tskID pointer to a U32 type variable to store task's ID
;* return values: ERR_INVALID_PRIO Invalid priority
; ERR_INVALID_STACK_SIZE Invalid stack size
; ERR_ALLOC_STACK_FAIL Failed to allocate stack
; ERR_ALLOC_TCB_FAIL No TCB is available
; ERR_OUT_OF_TASK_MAX_NUM Out of max task number
; ERR_SUCCESS OK
;**************************************************************************************************/
edl_createTask
STMFD SP!, {R4,R5} ; Save the registers modified in the function
add r5,sp,#8
LDMFD r5, {R4} ; Get the fifth parameter from stack and assign it to r4 as the fifth
; parameter in system call
swi 0 ; Software interrupt
LDMFD SP!, {R4,R5} ; Restore the registers modified in the function
mov pc,lr
;/**************************************************************************************************
;* Description: Delete a task
;* Parameters: r0 Specifies the task's ID to be deleted
;* return values: ERR_INVALID_TSK_ID Invalid task ID
; ERR_SUCCESS OK
;**************************************************************************************************/
edl_deleteTask
swi 1
mov pc,lr
;/**************************************************************************************************
;* Description: Suspend a task
;* Parameters: r0 Specifies the task's ID to be suspended
;* Return values: ERR_INVALID_PARAM Invalid parameters
; ERR_SUCCESS OK
; ERR_TASK_SUSPENDED The specified task has already been suspended.
;* Notes: This function is externally called to block a task.
;**************************************************************************************************/
edl_suspendTask
swi 2
mov pc,lr
;/**************************************************************************************************
;* Description: Resume a task
;* Parameters: r0 Specifies the task's ID to be suspended
;* Return values: ERR_INVALID_PARAM Invalid parameters
; ERR_SUCCESS OK
; ERR_TASK_READY The specified task has already been ready.
; ERR_TSK_STATUS_ERROR The task to be resumed is not in the specified status.
;* Notes: This function is externally called to resume a task.
;**************************************************************************************************/
edl_resumeTask
swi 3
mov pc,lr
;/**************************************************************************************************
;* Description: sleep for a period of time
;* Parameters: r0 specify how long the task should sleep, in unit of timer
; tick
;**************************************************************************************************/
edl_sleep
swi 4
mov pc,lr
;/**************************************************************************************************
;* Description: wake up a task
;* Parameters: tskID Specifies the task's ID to be woken up.
;* Notes: This function is designed for user task
;**************************************************************************************************/
edl_wakeTask
swi 5
mov pc,lr
;/**************************************************************************************************
;* Description: Send events to a specified task
;* Parameters: tskID task ID
; event bitmaped events to be sent
;* return values: ERR_INVALID_EVENT invalid event
; ERR_SUCCESS OK
;**************************************************************************************************/
edl_sendEvent
swi 6
mov pc,lr
;/**************************************************************************************************
;* Description: Receive events
;* Parameters: timeOut wait time in unit of timer tick,
; If wait time is 0, this function just peeks at the event
; buffer, if events arrived,it gets it and go back,otherwise
; just return.
; Else if wait time is INFINITE_TIME(0xffffffff), the task
; does not wake up until the events arrive.
; Else sleep for a period of time to wait for the wanted events.
; evMask event mask specifying the wanted events.
; waitAll specify whether the task need to get all events
; TRUE this function returns only when all events arrive
; FALSE as long as events arrive, this function returns.
; event a pointer to a data structure of type U32.
;* Return values: ERR_INVALID_PARAM invalid parameter.
; ERR_NO_EVENT No event
; ERR_SUCCESS OK.
; ERR_TIMEOUT time is out
;**************************************************************************************************/
edl_getEvent
swi 7
mov pc,lr
;/**************************************************************************************************
;* Description: Allocate a trunk of memory block.
;* Parameters: zone_id Specifies the zone ID where the free page would be allocated
; size Specifies the block size to allocate, if its value is zero,
; then system allocate the max free block in the zone.
;* Return Values: Allocated address
;* Note(s): This function is only called by user application through system call
;**************************************************************************************************/
edl_trunkAlloc
swi 8
mov pc,lr
;/**************************************************************************************************
;* Description: Free a trunk of memory block.
;* Parameters: addr The block's start address
;* return values: ERR_INVALID_PARAM Invalid parameter
; ERR_SUCCESS OK
;* Note(s): This function is only called by user application through system call
;**************************************************************************************************/
edl_trunkFree
swi 9
mov pc,lr
;/**************************************************************************************************
;* Description: Create a heap.
;* Parameters: start Heap's start address
; heapSize Specifies the heap size in unit of byte
; unitSize Specifies the unit size in unit of byte. Each allocated memory
; block is composed by these unit
; maxUnitNbr Specifies the max number of unit the heap could allocate
; heapID Pointer to a variable to stores the heap ID
;* return values: ERR_INVALID_PARAM Invalid parameter
; ERR_OUT_OF_MEM_MAX_NUM No heap control block is available
; ERR_SUCCESS OK
;**************************************************************************************************/
edl_heapCreate
STMFD SP!, {R4,R5} ; Save the registers modified in the function
add r5,sp,#8
LDMFD r5, {R4} ; Get the fifth parameter from stack and assign it to r4 as the fifth
; parameter in system call
swi 10 ; Software interrupt
LDMFD SP!, {R4,R5} ; Restore the registers modified in the function
mov pc,lr
;/**************************************************************************************************
;* Description: Destroy a heap.
;* Parameters: heapID Specifies the heap ID
;* return values: ERR_INVALID_PARAM Invalid parameter
; ERR_SUCCESS OK
;**************************************************************************************************/
edl_heapDelete
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -