[ Pobierz całość w formacie PDF ]
Lightweight semaphores
Table 2-38. _lwsem_test arguments
Name Type Direction Description
pointer_PTR_ lwsem_error_ptr output Pointer to the lightweight semaphore in error (NULL if no error
is found)
pointer_PTR_ td_error_ptr output Pointer to the task descriptor of waiting task that has an error
(NULL if no error is found).
Returns :
" MQX_OK
" MQX_INVALID_LWSEM (Results of _queue_test().)
" MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from
an ISR.)
See also :
" _lwsem_create
" _lwsem_destroy
" _queue_test
CAUTION
Cannot be called from an ISR. Disables and enables interrupts.
2.6.6 _lwsem_wait
Waits (in FIFO order) for the lightweight semaphore until it is available.
Source :
Prototype :_mqx_uint _lwsem_wait(LWSEM_STRUCT_PTR sem_ptr);
Table 2-39. _lwsem_wait arguments
Name Type Direction Description
LWSEM_STRUCT_PT sem_ptr input Pointer to the lightweight semaphore.
R
Returns :
" MQX_OK
" MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from
an ISR.)
Freescale MQX"! Lite RTOS, Rev. Version 1.1
50 Freescale Semiconductor, Inc.
Chapter 2 MQX Lite Functions
" MQX_INVALID_LWSEM (Sem_ptr is for a lightweight semaphore that is not
longer valid.)
" MQX_LWSEM_WAIT_TIMEOUT (Timeout expired before the task could get the
lightweight semaphore.)
See also :
" _lwsem_create
" _lwsem_post
" LWSEM_STRUCT
Note
Because priority inversion might occur if tasks with different
priorities access the same lightweight semaphore, we
recommend under these circumstances that you use the
semaphore component.
CAUTION
Might block the calling task. Cannot be called from an ISR.
2.6.7 _lwsem_wait_for
Waits (in FIFO order) for the lightweight semaphore for the number of ticks (in tick
time).
Source :
Prototype :_mqx_uint _lwsem_wait_for(LWSEM_STRUCT_PTR sem_ptr, MQX_TICK_STRUCT_PTR ticks);
Table 2-40. _lwsem_wait_for arguments
Name Type Direction Description
LWSEM_STRUCT_PT sem_ptr input Pointer to the lightweight semaphore.
R
MQX_TICK_STRUCT_ ticks input Pointer to the maximum number of ticks to wait or NULL
PTR (unlimited wait).
Returns :
" MQX_OK
" MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from
an ISR.)
Freescale MQX"! Lite RTOS, Rev. Version 1.1
Freescale Semiconductor, Inc. 51
Lightweight semaphores
" MQX_INVALID_LWSEM (Sem_ptr is for a lightweight semaphore that is not
longer valid.)
" MQX_LWSEM_WAIT_TIMEOUT (Timeout expired before the task could get the
lightweight semaphore.)
See also :
" _lwsem_create
" _lwsem_post
" LWSEM_STRUCT
" MQX_TICK_STRUCT
Note
Because priority inversion might occur if tasks with different
priorities access the same lightweight semaphore, we
recommend under these circumstances that you use the
semaphore component.
CAUTION
Might block the calling task. Cannot be called from an ISR.
2.6.8 _lwsem_wait_ticks
Waits (in FIFO order) for the lightweight semaphore for the number of ticks.
Source :
Prototype :_mqx_uint _lwsem_wait_ticks(LWSEM_STRUCT_PTR sem_ptr, _mqx_uint time_in_ticks);
Table 2-41. _lwsem_wait_ticks arguments
Name Type Direction Description
LWSEM_STRUCT_PT sem_ptr input Pointer to the lightweight semaphore.
R
_mqx_uint time_in_ticks input Maximum number of ticks to wait or 0 (unlimited wait).
Returns :
" MQX_OK
" MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from
an ISR.)
Freescale MQX"! Lite RTOS, Rev. Version 1.1
52 Freescale Semiconductor, Inc.
Chapter 2 MQX Lite Functions
" MQX_INVALID_LWSEM (Sem_ptr is for a lightweight semaphore that is not
longer valid.)
" MQX_LWSEM_WAIT_TIMEOUT (Timeout expired before the task could get the
lightweight semaphore.)
See also :
" _lwsem_create
" _lwsem_post
" LWSEM_STRUCT
Note
Because priority inversion might occur if tasks with different
priorities access the same lightweight semaphore, we
recommend under these circumstances that you use the
semaphore component.
CAUTION
Might block the calling task. Cannot be called from an ISR.
2.6.9 _lwsem_wait_until
Waits (in FIFO order) for the lightweight semaphore until the specified time (in tick
time).
Source :
Prototype :_mqx_uint _lwsem_wait_until(LWSEM_STRUCT_PTR sem_ptr, MQX_TICK_STRUCT_PTR
ticks);
Table 2-42. _lwsem_wait_until arguments
Name Type Direction Description
LWSEM_STRUCT_PT sem_ptr input Pointer to the lightweight semaphore.
R
MQX_TICK_STRUCT_ ticks input Pointer to the time (in tick time) until which to wait or NULL
PTR (unlimited wait).
Returns :
" MQX_OK
" MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from
an ISR.)
Freescale MQX"! Lite RTOS, Rev. Version 1.1
Freescale Semiconductor, Inc. 53
Lightweight timers
" MQX_INVALID_LWSEM (Sem_ptr is for a lightweight semaphore that is not
longer valid.)
" MQX_LWSEM_WAIT_TIMEOUT (Timeout expired before the task could get the
lightweight semaphore.)
See also :
" _lwsem_create
" _lwsem_post
" LWSEM_STRUCT
" MQX_TICK_STRUCT
Note
Because priority inversion might occur if tasks with different
priorities access the same lightweight semaphore, we
recommend under these circumstances that you use the
semaphore component.
CAUTION
Might block the calling task. Cannot be called from an ISR.
2.7 Lightweight timers
2.7.1 _lwtimer_add_timer_to_queue
Adds the lightweight timer to the periodic queue.
Source :
Prototype :_mqx_uint _lwtimer_add_timer_to_queue(LWTIMER_PERIOD_STRUCT_PTR period_ptr,
[ Pobierz całość w formacie PDF ]