#include <wg_eeprom.h>
|
boost::mutex | mutex_ |
| Only one eeprom transaction can occur at a time. More...
|
|
Definition at line 48 of file wg_eeprom.h.
◆ WGEeprom()
ethercat_hardware::WGEeprom::WGEeprom |
( |
| ) |
|
◆ readEepromPage()
bool ethercat_hardware::WGEeprom::readEepromPage |
( |
EthercatCom * |
com, |
|
|
WGMailbox * |
mbx, |
|
|
unsigned |
page, |
|
|
void * |
data, |
|
|
unsigned |
length |
|
) |
| |
Read data from single eeprom page.
Data should be less than 264 bytes. Note that some eeproms only support 256 byte pages. If 264 bytes of data are read from a 256 byte eeprom, then last 8 bytes of data will be zeros. Function may block for extended periods of time (is not realtime safe).
- Parameters
-
com | EtherCAT communication class used for communicating with device |
mbx | Mailbox for used communication with device |
page | EEPROM page number to read from. Should be 0 to 4095. |
data | pointer to data buffer |
length | length of data in buffer |
- Returns
- true if there is success, false if there is an error
Definition at line 223 of file wg_eeprom.cpp.
◆ readEepromStatusReg()
Reads EEPROM status register.
Amoung other things, eeprom status register provide information about whether eeprom is busy performing a write.
- Parameters
-
com | EtherCAT communication class used for communicating with device |
reg | reference to EepromStatusReg struct where eeprom status will be stored |
- Returns
- true if there is success, false if there is an error
Definition at line 401 of file wg_eeprom.cpp.
◆ readSpiEepromCmd()
Reads SPI state machine command register.
For communicating with EEPROM, there is a simple state machine that transfers data to/from FPGA buffer over SPI. When any type of comunication is done with EEPROM:
- Write command or write data into FPGA buffer.
- Have state machine start transfer bytes from buffer to EEPROM, and write data from EEPROM into buffer
- Wait for state machine to complete (by reading its status)
- Read EEPROM response from FPGA buffer.
- Parameters
-
com | EtherCAT communication class used for communicating with device |
reg | reference to WG0XSpiEepromCmd struct where read data will be stored |
- Returns
- true if there is success, false if there is an error
Definition at line 456 of file wg_eeprom.cpp.
◆ sendSpiEepromCmd()
Sends command to SPI EEPROM state machine.
This function makes sure SPI EEPROM state machine is idle before sending new command. It also waits for state machine to be idle before returning.
- Parameters
-
com | EtherCAT communication class used for communicating with device |
- Returns
- true if command was send, false if there is an error
Definition at line 158 of file wg_eeprom.cpp.
◆ waitForEepromReady()
Waits for EEPROM to become ready.
Certain eeprom operations (such as page reads), are complete immediately after data is trasferred. Other operations (such as page writes) take some amount of time after data is trasfered to complete. This polls the EEPROM status register until the 'ready' bit is set.
- Parameters
-
com | EtherCAT communication class used for communicating with device |
- Returns
- true if there is success, false if there is an error or wait takes too long
Definition at line 359 of file wg_eeprom.cpp.
◆ waitForSpiEepromReady()
Waits for SPI eeprom state machine to be idle.
Polls busy SPI bit of SPI state machine.
- Parameters
-
com | EtherCAT communication class used for communicating with device |
- Returns
- true if state machine is free, false if there is an error, or we timed out waiting
Definition at line 121 of file wg_eeprom.cpp.
◆ writeEepromPage()
bool ethercat_hardware::WGEeprom::writeEepromPage |
( |
EthercatCom * |
com, |
|
|
WGMailbox * |
mbx, |
|
|
unsigned |
page, |
|
|
const void * |
data, |
|
|
unsigned |
length |
|
) |
| |
Write data to single eeprom page.
Data should be less than 264 bytes. If data size is less than 264 bytes, then the page will be padded with 0xFF. Note that some eeproms only support 256 byte pages. With 256 byte eeproms, the eeprom FW with ingore last 8 bytes of requested write. Function may block for extended periods of time (is not realtime safe).
- Parameters
-
com | EtherCAT communication class used for communicating with device |
page | EEPROM page number to write to. Should be 0 to 4095. |
data | pointer to data buffer |
length | length of data in buffer. If length < 264, eeprom page will be padded out to 264 bytes. |
- Returns
- true if there is success, false if there is an error
Definition at line 289 of file wg_eeprom.cpp.
◆ MAX_EEPROM_PAGE_SIZE
const unsigned ethercat_hardware::WGEeprom::MAX_EEPROM_PAGE_SIZE = 264 |
|
staticprotected |
◆ mutex_
boost::mutex ethercat_hardware::WGEeprom::mutex_ |
|
protected |
Only one eeprom transaction can occur at a time.
Definition at line 69 of file wg_eeprom.h.
◆ NUM_EEPROM_PAGES
const unsigned ethercat_hardware::WGEeprom::NUM_EEPROM_PAGES = 4096 |
|
staticprotected |
The documentation for this class was generated from the following files: