Beispiel #1
0
/*!
 * \brief Used by a task to destroy an instance of a lightweight event.
 *
 * This function is an equivalent to the _lwevent_destroy() API call but it can be
 * executed from within the User task or other code running in the CPU User mode.
 * Parameters passed to this function by pointer are required to meet the memory
 * protection requirements as described in the parameter list below.
 *
 * \param[in] event_ptr Read only. Pointer to the event to be deinitialized.
 *
 * \return MQX_OK
 * \return MQX_LWEVENT_INVALID (Lightweight event was not valid.)
 * \return MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from an ISR.)
 *
 * \warning Cannot be called from an ISR.
 *
 * \see _lwevent_destroy
 * \see _usr_lwevent_create
 * \see _usr_lwevent_set
 * \see _usr_lwevent_set_auto_clear
 * \see _usr_lwevent_clear
 * \see _usr_lwevent_wait_for
 * \see _usr_lwevent_wait_ticks
 * \see _usr_lwevent_wait_until
 * \see _usr_lwevent_get_signalled
 * \see LWEVENT_STRUCT
 */
_mqx_uint _usr_lwevent_destroy
(
    LWEVENT_STRUCT_PTR  event_ptr
)
{
    MQX_API_CALL_PARAMS params = {(uint32_t)event_ptr, 0, 0, 0, 0};

    return _mqx_api_call(MQX_API_LWEVENT_DESTROY, &params);
}
Beispiel #2
0
_mqx_uint _usr_lwsem_wait
   (
      /* [IN] the semaphore address */
      LWSEM_STRUCT_PTR sem_ptr
   )
{
    MQX_API_CALL_PARAMS params = {(uint_32)sem_ptr, 0, 0, 0, 0};
    return _mqx_api_call(MQX_API_LWSEM_WAIT, &params);
}
Beispiel #3
0
/*!
 * \brief Used by a task to set the specified event bits in an event.
 *
 * This function is an equivalent to the _lwevent_set() API call but it can be
 * executed from within the User task or other code running in the CPU User mode.
 * Parameters passed to this function by pointer are required to meet the memory
 * protection requirements as described in the parameter list below.
 *
 * \param[in] event_ptr Read only. Pointer to the lightweight event to set bits in.
 * \param[in] bit_mask  Bit mask. Each bit represents an event bit to be set.
 *
 * \return MQX_OK
 * \return MQX_LWEVENT_INVALID (Lightweight event was invalid.)
 *
 * \see _lwevent_set
 * \see _usr_lwevent_create
 * \see _usr_lwevent_destroy
 * \see _usr_lwevent_set_auto_clear
 * \see _usr_lwevent_clear
 * \see _usr_lwevent_wait_for
 * \see _usr_lwevent_wait_ticks
 * \see _usr_lwevent_wait_until
 * \see _usr_lwevent_get_signalled
 * \see LWEVENT_STRUCT
 */
_mqx_uint _usr_lwevent_set
(
    LWEVENT_STRUCT_PTR  event_ptr,
    _mqx_uint           bit_mask
)
{
    MQX_API_CALL_PARAMS params = {  (uint32_t)event_ptr,
                                    (uint32_t)bit_mask, 0, 0, 0};

    return _mqx_api_call(MQX_API_LWEVENT_SET, &params);
}
Beispiel #4
0
/*!
 * \brief Sets autoclearing behavior of event bits in the lightweight event.
 *
 * This function is an equivalent to the _lwevent_set_auto_clear() API call but it
 * can be executed from within the User task or other code running in the CPU User
 * mode. Parameters passed to this function by pointer are required to meet the
 * memory protection requirements as described in the parameter list below.
 *
 * \param[in] event_ptr Read only. Pointer to the lightweight event to set bits in.
 * \param[in] auto_mask Mask of events, that is set auto-clear (if corresponding
 * bit of mask is set) or manual-clear (if corresponding bit of mask is clear).
 *
 * \return MQX_OK
 * \return MQX_LWEVENT_INVALID (Lightweight event was invalid.)
 *
 * \see _lwevent_set_auto_clear
 * \see _usr_lwevent_create
 * \see _usr_lwevent_destroy
 * \see _usr_lwevent_set
 * \see _usr_lwevent_clear
 * \see LWEVENT_STRUCT
 */
_mqx_uint _usr_lwevent_set_auto_clear
(
    LWEVENT_STRUCT_PTR  event_ptr,
    _mqx_uint           auto_mask
)
{
    MQX_API_CALL_PARAMS params = {  (uint32_t)event_ptr,
                                    (uint32_t)auto_mask, 0, 0, 0};

    return _mqx_api_call(MQX_API_LWEVENT_SET_AUTO_CLEAR, &params);
}
Beispiel #5
0
/*!
 * \brief Used by a task to create an instance of a lightweight event.
 *
 * This function is an equivalent to the _lwevent_create() API call but it can be
 * executed from within the User task or other code running in the CPU User mode.
 * Parameters passed to this function by pointer required to meet the memory
 * protection requirements as described in the parameter list below
 *
 * \param[in] event_ptr Read only. Pointer to the lightweight event to initialize.
 * \param[in] flags     Creation flag; one of the following:
 * \n - LWEVENT_AUTO_CLEAR - all bits in the lightweight event are made autoclearing.
 * \n - 0 - lightweight event bits are not set as autoclearing by default.
 * \n Note: The autoclearing bits can be changed any time later by calling
 * _usr_lwevent_set_auto_clear.
 *
 * \return MQX_OK
 * \return MQX_EINVAL (lwevent is already initialized.)
 * \return MQX_LWEVENT_INVALID (In case of user mode, MQX tries to access
 * a lwevent with inappropriate access rights.)
 *
 * \see _lwevent_create
 * \see _usr_lwevent_destroy
 * \see _usr_lwevent_set
 * \see _usr_lwevent_set_auto_clear
 * \see _usr_lwevent_clear
 * \see _usr_lwevent_wait_for
 * \see _usr_lwevent_wait_ticks
 * \see _usr_lwevent_wait_until
 * \see _usr_lwevent_get_signalled
 * \see LWEVENT_STRUCT
 */
_mqx_uint _usr_lwevent_create
(
    LWEVENT_STRUCT_PTR  event_ptr,
    _mqx_uint           flags
)
{
    MQX_API_CALL_PARAMS params = {  (uint32_t)event_ptr,
                                    (uint32_t)flags, 0, 0, 0};

    return _mqx_api_call(MQX_API_LWEVENT_CREATE, &params);
}
Beispiel #6
0
/*!
 * \brief Used by a task to clear the specified event bits in the ligtweight event.
 *
 * This function is an equivalent to the _lwevent_clear() API call but it can be
 * executed from within the User task or other code running in the CPU User mode.
 * Parameters passed to this function by pointer are required to meet the memory
 * protection requirements as described in the parameter list below.
 *
 * \param[in] event_ptr Read only. Pointer to the event.
 * \param[in] bit_mask   Bit mask. Each bit represents an event bit to clear.
 *
 * \return MQX_OK
 * \return MQX_LWEVENT_INVALID (Lightweight event is not valid.)
 *
 * \see _lwevent_clear
 * \see _usr_lwevent_create
 * \see _usr_lwevent_destroy
 * \see _usr_lwevent_set
 * \see _usr_lwevent_set_auto_clear
 * \see _usr_lwevent_wait_for
 * \see _usr_lwevent_wait_ticks
 * \see _usr_lwevent_wait_until
 * \see _usr_lwevent_get_signalled
 * \see LWEVENT_STRUCT
 */
_mqx_uint _usr_lwevent_clear
(
    LWEVENT_STRUCT_PTR  event_ptr,
    _mqx_uint           bit_mask
)
{
    MQX_API_CALL_PARAMS params = {  (uint_32)event_ptr,
                                    (uint_32)bit_mask, 0, 0, 0};

    return _mqx_api_call(MQX_API_LWEVENT_CLEAR, &params);
}
Beispiel #7
0
_mqx_uint _usr_lwsem_wait_ticks
   (
      /* [IN] the semaphore address */
      LWSEM_STRUCT_PTR sem_ptr,

      /* [IN] the number of ticks to delay, if 0, delay forever */
      _mqx_uint time_in_ticks
   )
{
    MQX_API_CALL_PARAMS params = {(uint_32)sem_ptr, (uint_32)time_in_ticks, 0, 0, 0};
    return _mqx_api_call(MQX_API_LWSEM_WAIT_TICKS, &params);
}
Beispiel #8
0
_mqx_uint _usr_lwevent_set
   (
      /* [IN] - The address of the light weight event */
      LWEVENT_STRUCT_PTR   event_ptr, 

      /* [IN] - bit mask, each bit of which represents an event. */
      _mqx_uint bit_mask
   )
{
    MQX_API_CALL_PARAMS params = {(uint_32)event_ptr, (uint_32)bit_mask, 0, 0, 0};
    return _mqx_api_call(MQX_API_LWEVENT_SET, &params);
}
Beispiel #9
0
/*!
 * \brief Used by a task to wait until the specified time (in tick time).
 *
 * This function is an equivalent to the _lwevent_wait_until() API call but it can
 * be executed from within the User task or other code running in the CPU User mode.
 * Parameters passed to this function by pointer are required to meet the memory
 * protection requirements as described in the parameter list below.
 *
 * \param[in] event_ptr Read only. Pointer to the lightweight event.
 * \param[in] bit_mask  Bit mask. Each set bit represents an event bit to wait for.
 * \param[in] all       TRUE (wait for all bits in bit_mask to be set), FALSE
 * (wait for any bit in bit_mask to be set).
 * \param[in] tick_ptr  Pointer to time until the function waits.
 *
 * \return MQX_OK
 * \return LWEVENT_WAIT_TIMEOUT (The time elapsed before an event signalled.)
 * \return MQX_LWEVENT_INVALID (Lightweight event is no longer valid or was never
 * valid.)
 * \return MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from an ISR.)
 *
 * \see _lwevent_wait_until
 * \see _usr_lwevent_create
 * \see _usr_lwevent_destroy
 * \see _usr_lwevent_set
 * \see _usr_lwevent_set_auto_clear
 * \see _usr_lwevent_clear
 * \see _usr_lwevent_wait_for
 * \see _usr_lwevent_wait_ticks
 * \see _usr_lwevent_get_signalled
 * \see LWEVENT_STRUCT
 * \see MQX_TICK_STRUCT
 */
_mqx_uint _usr_lwevent_wait_until
(
    LWEVENT_STRUCT_PTR  event_ptr,
    _mqx_uint           bit_mask,
    bool             all,
    MQX_TICK_STRUCT_PTR tick_ptr
)
{
    MQX_API_CALL_PARAMS params = {  (uint32_t)event_ptr, (uint32_t)bit_mask,
                                    (uint32_t)all,       (uint32_t)tick_ptr, 0};

    return _mqx_api_call(MQX_API_LWEVENT_WAIT_UNTIL, &params);
}
Beispiel #10
0
pointer _usr_lwmem_alloc_from
   (
      /* [IN] the pool to allocate from */
      _lwmem_pool_id  pool_id,

      /* [IN] the size of the memory block */
      _mem_size       requested_size

   )
{
    MQX_API_CALL_PARAMS params = {(uint_32)pool_id, (uint_32)requested_size, 0, 0, 0};
    return (pointer)_mqx_api_call(MQX_API_LWMEM_ALLOC_FROM, &params);
}
Beispiel #11
0
/*!
 * \brief Used by a task to wait for the event for the number of ticks.
 *
 * This function is an equivalent to the _lwevent_wait_ticks() API call but it can be\
 * executed from within the User task or other code running in the CPU User mode.
 * Parameters passed to this function by pointer are required to meet the memory
 * protection requirements as described in the parameter list below.
 *
 * \param[in] event_ptr        Read only. Pointer to the lightweight event.
 * \param[in] bit_mask         Bit mask. Each set bit represents an event bit to wait for.
 * \param[in] all              TRUE (wait for all bits in bit_mask to be set),
 * FALSE (wait for any bit in bit_mask to be set).
 * \param[in] timeout_in_ticks The maximum number of ticks to wait for the events
 * to be set. If the value is 0, then the timeout will be infinite.
 *
 * \return MQX_OK
 * \return LWEVENT_WAIT_TIMEOUT (The time elapsed before an event signalled.)
 * \return MQX_LWEVENT_INVALID (Lightweight event is no longer valid or was never
 * valid.)
 * \return MQX_CANNOT_CALL_FUNCTION_FROM_ISR (Function cannot be called from an ISR.)
 *
 * \see _lwevent_wait_ticks
 * \see _usr_lwevent_create
 * \see _usr_lwevent_destroy
 * \see _usr_lwevent_set
 * \see _usr_lwevent_set_auto_clear
 * \see _usr_lwevent_clear
 * \see _usr_lwevent_wait_for
 * \see _usr_lwevent_wait_until
 * \see _usr_lwevent_get_signalled
 * \see LWEVENT_STRUCT
 */
_mqx_uint _usr_lwevent_wait_ticks
(
    LWEVENT_STRUCT_PTR  event_ptr,
    _mqx_uint           bit_mask,
    bool             all,
    _mqx_uint           timeout_in_ticks
)
{
    MQX_API_CALL_PARAMS params = {  (uint32_t)event_ptr,
                                    (uint32_t)bit_mask,
                                    (uint32_t)all,
                                    (uint32_t)timeout_in_ticks, 0};

    return _mqx_api_call(MQX_API_LWEVENT_WAIT_FOR_TICKS, &params);
}
Beispiel #12
0
_mqx_uint _usr_lwmsgq_send
   (
      /* Handle to the queue */
      pointer           handle,

      /* location of message to copy in */
      _mqx_max_type_ptr message,

      /* flags for blocking on full, blocking on send */
      _mqx_uint         flags
   )
{
    MQX_API_CALL_PARAMS params = {(uint_32)handle, (uint_32)message, (uint_32)flags, 0, 0};
    return _mqx_api_call(MQX_API_LWMSGQ_SEND, &params);
}
Beispiel #13
0
_mqx_uint _usr_lwmsgq_receive
   (
      /* Handle to the queue */
      pointer             handle,

      /* location of message to copy to */
      _mqx_max_type_ptr   message,

      /* flags for blocking on empty */
      _mqx_uint           flags,

      /* Timeout for receive if using ticks if 0, ignored */
      _mqx_uint           ticks,

      /* Timeout if receive timout using tick struct must have flags set */
      
      MQX_TICK_STRUCT_PTR tick_ptr
   )
{
    MQX_API_CALL_PARAMS params = {(uint_32)handle, (uint_32)message, (uint_32)flags, (uint_32)ticks, (uint_32)tick_ptr};
    return _mqx_api_call(MQX_API_LWMSGQ_RECEIVE, &params);
}
Beispiel #14
0
/*!
 * \brief Gets mask of event bits in the lwevent which unblocked the most recent call
 * executed by the current task.
 *
 * This function is an equivalent to the _lwevent_get_signalled() API call but it
 * can be executed from within the User task or other code running in the CPU User
 * mode. Parameters passed to this function by pointer are required to meet the
 * memory protection requirements as described in the parameter list below.
 *
 * \return bit_mask Bit mask of the last task's lwevent_wait_xxx call that
 * unblocked the task.
 *
 * \see _lwevent_get_signalled
 * \see _usr_lwevent_create
 * \see _usr_lwevent_destroy
 * \see _usr_lwevent_set
 * \see _usr_lwevent_set_auto_clear
 * \see _usr_lwevent_clear
 * \see _usr_lwevent_wait_for
 * \see _usr_lwevent_wait_ticks
 * \see _usr_lwevent_wait_until
 */
_mqx_uint _usr_lwevent_get_signalled(void)
{
    MQX_API_CALL_PARAMS params = {0, 0, 0, 0, 0};

    return _mqx_api_call(MQX_API_LWEVENT_GET_SIGNALLED, &params);
}