SOES v1.0.0
Defines | Functions | Variables
esc_coe.c File Reference

CAN over EtherCAT (CoE) module. More...

#include <string.h>
#include "utypes.h"
#include "esc.h"
#include "esc_coe.h"
#include "objectlist.h"

Defines

#define BITS2BYTES(b)   ((b + 7) >> 3)
#define ODLISTSIZE   ((MBX1_sml - MBXHSIZE - sizeof(_COEh) - sizeof(_INFOh) - 2) & 0xfffe)

Functions

int32 SDO_findobject (uint16 index)
uint16 sizeTXPDO (void)
uint16 sizeRXPDO (void)
int16 SDO_findsubindex (int16 nidx, uint8 subindex)
void copy2mbx (void *source, void *dest, uint16 size)
void SDO_abort (uint16 index, uint8 subindex, uint32 abortcode)
void SDO_upload (void)
void SDO_uploadsegment (void)
int ESC_pre_objecthandler (uint16 index, uint8 subindex)
void SDO_download (void)
void SDO_infoerror (uint32 abortcode)
void SDO_getodlist (void)
void SDO_getodlistcont (void)
void SDO_getod (void)
void SDO_geted (void)
void ESC_coeprocess (void)

Variables

uint8 txpdoitems
uint8 rxpdoitems

Detailed Description

CAN over EtherCAT (CoE) module.

SDO read / write and SDO service functions


Define Documentation

#define BITS2BYTES (   b)    ((b + 7) >> 3)
#define ODLISTSIZE   ((MBX1_sml - MBXHSIZE - sizeof(_COEh) - sizeof(_INFOh) - 2) & 0xfffe)

Function Documentation

void copy2mbx ( void *  source,
void *  dest,
uint16  size 
)

Copy to mailbox.

Parameters:
[in]source= pointer to source
[in]dest= pointer to destination
[in]size= Size to copy
void ESC_coeprocess ( void  )

Main CoE function checking the status on current mailbox buffers carrying data, distributing the mailboxes to appropriate CoE functions. On Error an MBX_error or SDO Abort will be sent depending on error cause.

int ESC_pre_objecthandler ( uint16  index,
uint8  subindex 
)

Function to pre-qualify the incoming SDO download.

Parameters:
[in]index= index of SDO download request to check
[in]sub-index= sub-index of SDO download request to check
Returns:
1 if the SDO Download is correct. 0 If not correct.
void SDO_abort ( uint16  index,
uint8  subindex,
uint32  abortcode 
)

Function for sending an SDO Abort reply.

Parameters:
[in]index= index of object causing abort reply
[in]sub-index= sub-index of object causing abort reply
[in]abortcode= abort code to send in reply
void SDO_download ( void  )

Function for handling incoming requested SDO Download, validating the request and sending an response. On error an SDO Abort will be sent.

int32 SDO_findobject ( uint16  index)

Search for an object index matching the wanted value in the Object List.

Parameters:
[in]index= value on index of object we want to locate
Returns:
local array index if we succeed, -1 if we didn't find the index.
int16 SDO_findsubindex ( int16  nidx,
uint8  subindex 
)

Search for an object sub-index.

Parameters:
[in]nidx= local array index of object we want to find sub-index to
[in]subindex= value on sub-index of object we want to locate
Returns:
local array index if we succeed, -1 if we didn't find the index.
void SDO_geted ( void  )

Function for handling incoming requested SDO Get Entry Description, validating the request and sending an response. On error an SDO Info Error will be sent.

void SDO_getod ( void  )

Function for handling incoming requested SDO Get Object Description, validating the request and sending an response. On error an SDO Info Error will be sent.

void SDO_getodlist ( void  )

Function for handling incoming requested SDO Get OD List, validating the request and sending an response. On error an SDO Info Error will be sent.

void SDO_getodlistcont ( void  )

Function for continuing sending left overs from previous requested SDO Get OD List, validating the request and sending an response.

void SDO_infoerror ( uint32  abortcode)

Function for sending an SDO Info Error reply.

Parameters:
[in]abortcode= = abort code to send in reply
void SDO_upload ( void  )

Function for responding on requested SDO Upload, sending the content requested in a free Mailbox buffer. Depending of size of data expedited, normal or segmented transfer is used. On error an SDO Abort will be sent.

void SDO_uploadsegment ( void  )

Function for handling the following SDO Upload if previous SDOUpload response was flagged it needed to be segmented.

uint16 sizeRXPDO ( void  )

Calculate the size in Bytes of RxPDOs by adding the objects in SyncManager SDO 1C12.

Returns:
size of RxPDOs in Bytes.
uint16 sizeTXPDO ( void  )

Calculate the size in Bytes of TxPDOs by adding the objects in SyncManager SDO 1C13.

Returns:
size of TxPDOs in Bytes.

Variable Documentation

uint8 rxpdoitems
uint8 txpdoitems