• Home • Files • Structures         • Download

canpie_hal.h File Reference


Detailed Description

Include dependency graph for canpie_hal.h:


Data Structures

struct  CpMsgQueue_s
 Message Queue. More...

Functions

int can_register_driver (int slLogIfV, int slPhyIfV, _TsCpHal *ptsCpHalV)
_TsCpPort * can_queue_create (int slLogIfV, int slRcvFifoSizeV, int slTrmFifoSizeV)
int can_queue_rcv_pop (_TsCpPort *ptsCanPortV, _TsCpCanMsg *ptsCanMsgV, int slMsgNumV)

Function Documentation

_TsCpPort* can_queue_create ( int  slLogIfV,
int  slRcvFifoSizeV,
int  slTrmFifoSizeV 
)

Create a message queue.

Parameters:
slPortV Requested port number
slSizeV Size of Receive/Transmit FIFO
Returns:
Pointer to message queue
This function tries to open a message queue on the selected port. If the operation fails, a zero pointer (0L) is returned. Upon success, a pointer to the message queue structure is returned. This pointer is required for further message queue operations. The parameter size determines the maximum number of messages in the receive/transmit FIFO. The maximum number of messages is limited to 65535. For values < CP_MSG_QUEUE_MIN the default FIFO size (CP_MSG_QUEUE_DEF) is used.

int can_queue_rcv_pop ( _TsCpPort *  ptsCanPortV,
_TsCpCanMsg ptsCanMsgV,
int  slMsgNumV 
)

Read data from receive queue.

Parameters:
slPortV Requested port number
This function tries to read slMsgNumV CAN messages out of the queue. It returns the actual number of messages that have been read from the queue.

int can_register_driver ( int  slLogIfV,
int  slPhyIfV,
_TsCpHal *  ptsCpHalV 
)

Register CAN driver.

Parameters:
slPortV Requested port number
ptsCpHalV Pointer to CANpie HAL
Returns:
A positive value returns the assigned port number. A negative value is an error code.
This function registers a CAN hardware driver. The driver will be assigned to the logical CAN interface given by the parameter slLogIfV. The first interface number starts at index 0 (CP_CHANNEL_1). If the driver shall be assigned to the next free port, the value -1 must be used for slLogIfV. The function returns the port number that has been assigned for the CANpie driver. If the assigment fails, the function returns a negative CANpie error code, e.g.
  • -CpErr_CHANNEL : port is already assigned, out of range
  • -CpErr_GENERIC : failure in ptsCpHalV


SourceForge.net Logo

© MicroControl GmbH & Co. KG

CANpie - V1.93