Classes |
struct | CanFrame |
Defines |
#define | MAX_DROPPING_SOURCE 20 |
Typedefs |
typedef int(* | AsebaCanIntVoidFP )() |
typedef void(* | AsebaCanSendFrameFP )(const CanFrame *frame) |
typedef void(* | AsebaCanVoidVoidFP )() |
Functions |
void | AsebaCanFlushQueue (void) |
void | AsebaCanFrameReceived (const CanFrame *frame) |
void | AsebaCanFrameSent () |
uint16 | AsebaCanGetMinMultipleOfHeight (uint16 v) |
void | AsebaCanInit (uint16 id, AsebaCanSendFrameFP sendFrameFP, AsebaCanIntVoidFP isFrameRoomFP, AsebaCanVoidVoidFP receivedPacketDroppedFP, AsebaCanVoidVoidFP sentPacketDroppedFP, CanFrame *sendQueue, size_t sendQueueSize, CanFrame *recvQueue, size_t recvQueueSize) |
uint16 | AsebaCanRecv (uint8 *data, size_t size, uint16 *source) |
uint16 | AsebaCanRecvBufferEmpty (void) |
void | AsebaCanRecvFreeQueue (void) |
static void | AsebaCanRecvQueueFreeFrames (uint16 id) |
static void | AsebaCanRecvQueueGarbageCollect () |
static uint16 | AsebaCanRecvQueueGetMaxUsedFrames () |
static uint16 | AsebaCanRecvQueueGetMinFreeFrames () |
uint16 | AsebaCanSend (const uint8 *data, size_t size) |
static uint16 | AsebaCanSendQueueGetFreeFrames () |
static uint16 | AsebaCanSendQueueGetUsedFrames () |
static void | AsebaCanSendQueueInsert (uint16 canid, const uint8 *data, size_t size) |
static void | AsebaCanSendQueueToPhysicalLayer () |
uint16 | AsebaCanSendSpecificSource (const uint8 *data, size_t size, uint16 source) |
void | AsebaIdle (void) |
uint16 | AsebaShouldDropPacket (uint16 source, const uint8 *data) |
Variables |
static uint16 | dropping [MAX_DROPPING_SOURCE] |
Detailed Description
This layer is able to transmit messages of arbitrary length (up to the available amount of memory) over a serie of 8 bytes CAN frames. If the message is under 8 bytes, the layer uses a single frame.
The layer does not uses acknowledgment, instead it trusts the CAN checksum mechanism to ensure that other nodes on the CAN bus received the data correctly.
This transport layer only works on little-endian systems for now, as it does not perform endian correction.
Define Documentation
Typedef Documentation
Pointer to a void function returning int
Definition at line 62 of file can-net.h.
Pointer to a function that sends a CAN frame (max 8 bytes)
Definition at line 65 of file can-net.h.
Pointer to a void function
Definition at line 59 of file can-net.h.
Function Documentation
Wait until the send queue is empty
Definition at line 266 of file can-net.c.
Data layer should call this function when a new CAN frame (max 8 bytes) is available
Definition at line 350 of file can-net.c.
Data layer should call this function when the CAN frame (max 8 bytes) was sent successfully
Definition at line 259 of file can-net.c.
Returned the minimum number of multiple of height to fit v
Definition at line 69 of file can-net.c.
Init the CAN connection.
- Parameters:
-
id | the identifier of this node on the aseba CAN network |
sendFrameFP | pointer to a function that sends CAN frames to the data layer |
isFrameRoomFP | pointer to a function that returns if the data layer is ready to send frames |
receivedPacketDroppedFP | pointer to a function that is called when a received packet has been dropped, for various reasons but mostly related to insufficient memory |
sentPacketDroppedFP | pointer to a function that is called when a sent packet has been dropped (AsebaCanSend() returned 0), for various reasons but mostly related to insufficient memory |
sendQueue | pointer to send queue data |
sendQueueSize | number of frame in sendQueue |
recvQueue | pointer to receive queue data |
recvQueueSize | number of frame in recvQueue |
Definition at line 189 of file can-net.c.
Copy data from a received packet to the caller-provided buffer. Remove the packet from the reception queue afterwards.
- Parameters:
-
data | pointer where to copy the data |
size | makimum number of byte to copy. Actual number of byte might be smaller if packet was smaller. If packet was bigger, the rest of the data are dropped. |
source | the identifier of the source of the received packet |
- Returns:
- the amount of data copied. 0 if no data were available.
Definition at line 272 of file can-net.c.
Return true if the recv buffer is empty, false otherwise
Definition at line 254 of file can-net.c.
Free everything in the Rx queue. Warning, this is a low-level function which should only be called if the underlaying CAN driver is disabled.
Definition at line 414 of file can-net.c.
Free frames associated with an id in the reception queue
Definition at line 171 of file can-net.c.
Readjust the fifo pointers
Definition at line 155 of file can-net.c.
Returned the maximum number of used frames in the reception queue
Definition at line 137 of file can-net.c.
Returned the minimum number of free frames in the reception queue
Definition at line 149 of file can-net.c.
Send data as an aseba packet.
- Parameters:
-
data | pointer to the data to send |
size | amount of data to send |
- Returns:
- 1 on success, 0 on failure
Definition at line 211 of file can-net.c.
Returned the number of free frames in the send queue
Definition at line 91 of file can-net.c.
Returned the number of used frames in the send queue
Definition at line 78 of file can-net.c.
Insert a frame in the send queue, do not check for overwrite
Definition at line 97 of file can-net.c.
Send frames in send queue to physical layer until it is full
Definition at line 112 of file can-net.c.
Send data as an aseba packet.
- Parameters:
-
data | pointer to the data to send |
size | amount of data to send |
source | identifier to use as source |
- Returns:
- 1 on success, 0 on failure
Definition at line 216 of file can-net.c.
Busy wait until the can buffer has room. At worst, can be an empty function
Definition at line 187 of file can-translator/main.c.
Variable Documentation