www.beck-ipc.com

@CHIP-RTOS C Library V2.06 - CAN API


CAN_Event_Sleep

Await any one event from a specified set of CAN port events.

int CAN_Event_Sleep ( unsigned int events,

      int timeout );

Parameters

events

Bit field specifying a set of events to await

timeout

Time-out
    Negative value:   No wait, return immediately
    Zero:   Wait forever for the CAN event(s)
    Positive value:   Maximum milliseconds to wait for the CAN event(s)

Return Value

= 0 indicates no events occurred (time-out)
non-zero = event bits which came true among those that were specified in events input parameter

Comments

This function sleeps on the event group used internally by the CAN driver, awaiting specified CAN events.   Note that the events can be on either of the two CAN ports.   The events specified in the bit field input parameter events can be any combination of the following:

CAN0_EV_RX_RDY = 0x0001, CAN0 Receiver data ready
CAN0_EV_TX1_EMP = 0x0002, CAN0 Transmitter #1 queue empty
CAN0_EV_TX2_EMP = 0x0004, CAN0 Transmitter #2 queue empty
CAN0_EV_TX3_EMP = 0x0008, CAN0 Transmitter #3 queue empty
CAN0_EV_BUS_OFF = 0x0010, CAN0 Bus off condition

CAN1_EV_RX_RDY = 0x0100, CAN1 Receiver data ready
CAN1_EV_TX1_EMP = 0x0200, CAN1 Transmitter #1 queue empty
CAN1_EV_TX2_EMP = 0x0400, CAN1 Transmitter #2 queue empty
CAN1_EV_TX3_EMP = 0x0800, CAN1 Transmitter #3 queue empty
CAN1_EV_BUS_OFF = 0x1000, CAN1 Bus off condition

This function returns when any one of the specified events occurs.   If no events are specified the function returns immediately with a return value zero.   Any event bits in input parameter events which apply to a port which is not open will be ignored and treated as zeros.

This function has no affect on the event flags.   Event flags are not cleared as a side affect of this function call.

A port closing will cause this function to return if any event wait bits applied to that port which closed.   In this case the event flags returned for the closed port should be ignored, since they were created artificially.

Inside this API the interrupts are masked for a short period and then re-enabled.   This function is reentrant.

See Also

RTOS API

This library function uses a dynamic link to reach the service offered by RTOS software interrupt.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3
    n/an/an/aV0.90

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.01

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document