SOES v1.0.0
|
Base EtherCAT functions for handling the Data Link Layer and Malilboxes. More...
Functions | |
void | ESC_ALerror (uint16 errornumber) |
void | ESC_ALstatus (uint8 status) |
void | ESC_SMack (uint8 n) |
void | ESC_SMstatus (uint8 n) |
void | ESC_SMwritepdi (uint8 n) |
void | ESC_SMenable (uint8 n) |
void | ESC_SMdisable (uint8 n) |
void | ESC_address (void) |
uint8 | ESC_WDstatus (void) |
uint8 | ESC_checkmbx (uint8 state) |
uint8 | ESC_startmbx (uint8 state) |
uint8 | ESC_checkmbxboot (uint8 state) |
uint8 | ESC_startmbxboot (uint8 state) |
void | ESC_stopmbx (void) |
void | ESC_readmbx (void) |
void | ESC_writembx (uint8 n) |
void | ESC_ackmbxread (void) |
uint8 | ESC_claimbuffer (void) |
uint8 | ESC_outreqbuffer (void) |
void | MBX_error (uint16 error) |
uint8 | ESC_mbxprocess (void) |
void | ESC_xoeprocess (void) |
uint8 | ESC_checkSM23 (uint8 state) |
uint8 | ESC_startinput (uint8 state) |
void | ESC_stopinput (void) |
uint8 | ESC_startoutput (uint8 state) |
void | ESC_stopoutput (void) |
void | ESC_state (void) |
void | ESC_config (esc_cfg_t *cfg) |
Variables | |
static esc_cfg_t * | esc_cfg = NULL |
Base EtherCAT functions for handling the Data Link Layer and Malilboxes.
State machine and mailbox support.
void ESC_ackmbxread | ( | void | ) |
TBD
void ESC_address | ( | void | ) |
Read Configured Station Address register 0x010 assigned by the Master.
void ESC_ALerror | ( | uint16 | errornumber | ) |
Write AL Status Code to the ESC.
[in] | errornumber | = Write an by EtherCAT specified Error number register 0x134 AL Status Code |
void ESC_ALstatus | ( | uint8 | status | ) |
Write AL Status to the ESC.
[in] | status | = Write current slave status to register 0x130 AL Status reflecting actual state and error indication if present |
uint8 ESC_checkmbx | ( | uint8 | state | ) |
Check mailbox status by reading all SyncManager 0 and 1 data. The read values are compared with local definitions for SM Physical Address, SM Length and SM Control. If we check fails we disable Mailboxes by disabling SyncManager 0 and 1 and return state Init with Error flag set.
[in] | state | = Current state request read from ALControl 0x0120 |
uint8 ESC_checkmbxboot | ( | uint8 | state | ) |
Check boostrap mailbox status by reading all SyncManager 0 and 1 data. The read values are compared with local definitions for SM Physical Address, SM Length and SM Control. If we check fails we disable Mailboxes by disabling SyncManager 0 and 1 and return state Init with Error flag set.
[in] | state | = Current state request read from ALControl 0x0120 |
uint8 ESC_checkSM23 | ( | uint8 | state | ) |
Validate the values of Sync Manager 2 & 3 that the current ESC values is equal to configured and calculated local values.
[in] | state | = Requested state. |
uint8 ESC_claimbuffer | ( | void | ) |
Allocate and prepare a mailbox buffer. Take the first Idle buffer from the End. Set Mailbox control state to be used for outbox and fill the mailbox buffer with address master and mailbox next CNT value between 1-7.
void ESC_config | ( | esc_cfg_t * | cfg | ) |
Function copying the application configuration variable to the stack local pointer variable.
[in] | cfg | = Pointer to by the Application static declared configuration variable holding application specific details. Ex. post- and pre state change hooks |
uint8 ESC_mbxprocess | ( | void | ) |
Mailbox routine for implementing the low-level part of the mailbox protocol used by Application Layers running on-top of mailboxes. It takes care of sending a mailbox, re-sending a mailbox, reading a mailbox and handles a mailbox full event.
uint8 ESC_outreqbuffer | ( | void | ) |
Look for any present requests for posting to the outbox.
void ESC_readmbx | ( | void | ) |
Read Receive mailbox and store data in local ESCvar.MBX variable. Combined function for bootstrap and other states. State check decides which one to read.
void ESC_SMack | ( | uint8 | n | ) |
Read SM Status register 0x805(+ offset to SyncManager n) to acknowledge a Sync Manager event Bit 3 in ALevent. The result is not used.
[in] | n | = Read Sync Manager no. n |
void ESC_SMdisable | ( | uint8 | n | ) |
Write 1 to Bit0 in SM PDI control register 0x807(+ offset to SyncManager n) to De-activte the Sync Manager n.
[in] | n | = Write to Sync Manager no. n |
void ESC_SMenable | ( | uint8 | n | ) |
Write 0 to Bit0 in SM PDI control register 0x807(+ offset to SyncManager n) to Activate the Sync Manager n.
[in] | n | = Write to Sync Manager no. n |
void ESC_SMstatus | ( | uint8 | n | ) |
Read SM Status register 0x805(+ offset to SyncManager n) and save the result in global variable ESCvar.SM[n].
[in] | n | = Read Sync Manager no. n |
void ESC_SMwritepdi | ( | uint8 | n | ) |
Write ESCvar.SM[n] data to ESC PDI control register 0x807(+ offset to SyncManager n).
[in] | n | = Write to Sync Manager no. n |
uint8 ESC_startinput | ( | uint8 | state | ) |
Function trying to enable start updating the process data inputs. It calls the check SM 2 & 3 routine, based on the result from there if enables or disables the Input SyncManager, in addition it updates the ALStatusCode case something didn't pass the check.
[in] | state | = Requested state. |
uint8 ESC_startmbx | ( | uint8 | state | ) |
Try to start mailboxes for current ALControl state request by enabling SyncManager 0 and 1. If all mailbox settings is correct we return incoming state request, otherwise we return state Init with Error flag set and update local ALerror with code 0x16 Invalid mailbox configuration.
[in] | state | = Current state request read from ALControl 0x0120 |
uint8 ESC_startmbxboot | ( | uint8 | state | ) |
Try to start bootstrap mailboxes for current ALControl state request by enabling SyncManager 0 and 1. If all mailbox settings is correct we return incoming state request, otherwise we return state Init with Error flag set and update local ALerror with code 0x16 Invalid mailbox configuration.
[in] | state | = Current state request read from ALControl 0x0120 |
uint8 ESC_startoutput | ( | uint8 | state | ) |
Unconditional start of updating outputs by enabling Sync Manager 2. Set the App.state to APPSTATE_OUTPUT.
[in] | state | = Not used. |
void ESC_state | ( | void | ) |
The state handler acting on ALControl Bit(0) and SyncManager Activation BIT(4) events in the Al Event Request register 0x220.
void ESC_stopinput | ( | void | ) |
Unconditional stop of updating inputs by disabling Sync Manager 2 & 3. Set the App.state to APPSTATE_IDLE.
void ESC_stopmbx | ( | void | ) |
Stop mailboxes by disabling SyncManager 0 and 1. Clear local mailbox variables stored in ESCvar.
void ESC_stopoutput | ( | void | ) |
Unconditional stop of updating outputs by disabling Sync Manager 2. Set the App.state to APPSTATE_ONPUT. Call application hook APP_safeoutput letting the user to set safe state values on outputs.
uint8 ESC_WDstatus | ( | void | ) |
Read Watchdog Status register 0x440. Result Bit0 0= Expired, 1= Active or disabled.
void ESC_writembx | ( | uint8 | n | ) |
Write local mailbox buffer ESCvar.MBX[n] to Send mailbox. Combined function for bootstrap and other states. State check decides which one to write.
[in] | n | = Which local mailbox buffer n to send. |
void ESC_xoeprocess | ( | void | ) |
Handler for incorrect or unsupported mailbox data. Write error response in Mailbox.
void MBX_error | ( | uint16 | error | ) |
Allocate and prepare a mailbox buffer for sending an error message. Take the first Idle buffer from the end. Set Mailbox control state to be used for outbox and fill the mailbox buffer with error information.
[in] | n | = Error number to be sent in mailbox error message. |