EtherCAT master driver module.
More...
Go to the source code of this file.
|
int __init | ec_init_module (void) |
| Module initialization. More...
|
|
void __exit | ec_cleanup_module (void) |
| Module cleanup. More...
|
|
static int | ec_mac_parse (uint8_t *mac, const char *src, int allow_empty) |
| Parse a MAC address from a string. More...
|
|
int | ec_mac_equal (const uint8_t *mac1, const uint8_t *mac2) |
|
int | ec_mac_is_broadcast (const uint8_t *mac) |
|
unsigned int | ec_master_count (void) |
| Get the number of masters.
|
|
ssize_t | ec_mac_print (const uint8_t *mac, char *buffer) |
| Print a MAC address to a buffer. More...
|
|
int | ec_mac_is_zero (const uint8_t *mac) |
|
void | ec_print_data (const uint8_t *data, size_t size) |
| Outputs frame contents for debugging purposes. More...
|
|
void | ec_print_data_diff (const uint8_t *d1, const uint8_t *d2, size_t size) |
| Outputs frame contents and differences for debugging purposes. More...
|
|
size_t | ec_state_string (uint8_t states, char *buffer, uint8_t multi) |
| Prints slave states in clear text. More...
|
|
ec_device_t * | ecdev_offer (struct net_device *net_dev, ec_pollfunc_t poll, struct module *module) |
| Offers an EtherCAT device to a certain master. More...
|
|
ec_master_t * | ecrt_request_master_err (unsigned int master_index) |
| Request a master. More...
|
|
ec_master_t * | ecrt_request_master (unsigned int master_index) |
| Requests an EtherCAT master for realtime operation. More...
|
|
void | ecrt_release_master (ec_master_t *master) |
| Releases a requested EtherCAT master. More...
|
|
unsigned int | ecrt_version_magic (void) |
| Returns the version magic of the realtime interface. More...
|
|
EtherCAT master driver module.
Definition in file module.c.
◆ ec_init_module()
int __init ec_init_module |
( |
void |
| ) |
|
Module initialization.
Initializes master_count masters.
- Returns
- 0 on success, else < 0
Definition at line 97 of file module.c.
◆ ec_cleanup_module()
void __exit ec_cleanup_module |
( |
void |
| ) |
|
Module cleanup.
Clears all master instances.
Definition at line 184 of file module.c.
◆ ec_mac_parse()
static int ec_mac_parse |
( |
uint8_t * |
mac, |
|
|
const char * |
src, |
|
|
int |
allow_empty |
|
) |
| |
|
static |
Parse a MAC address from a string.
The MAC address must match the regular expression "([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}".
- Returns
- 0 on success, else < 0
Definition at line 306 of file module.c.
◆ ec_mac_equal()
int ec_mac_equal |
( |
const uint8_t * |
mac1, |
|
|
const uint8_t * |
mac2 |
|
) |
| |
- Returns
- true, if two MAC addresses are equal.
- Parameters
-
mac1 | First MAC address. |
mac2 | Second MAC address. |
Definition at line 219 of file module.c.
◆ ec_mac_is_broadcast()
int ec_mac_is_broadcast |
( |
const uint8_t * |
mac | ) |
|
- Returns
- true, if the given MAC address is the broadcast address.
- Parameters
-
Definition at line 284 of file module.c.
◆ ec_mac_print()
ssize_t ec_mac_print |
( |
const uint8_t * |
mac, |
|
|
char * |
buffer |
|
) |
| |
Print a MAC address to a buffer.
The buffer size must be at least EC_MAX_MAC_STRING_SIZE.
- Returns
- number of bytes written.
- Parameters
-
mac | MAC address |
buffer | Target buffer. |
Definition at line 245 of file module.c.
◆ ec_mac_is_zero()
int ec_mac_is_zero |
( |
const uint8_t * |
mac | ) |
|
- Returns
- true, if the MAC address is all-zero.
- Parameters
-
Definition at line 266 of file module.c.
◆ ec_print_data()
void ec_print_data |
( |
const uint8_t * |
data, |
|
|
size_t |
size |
|
) |
| |
Outputs frame contents for debugging purposes.
If the data block is larger than 256 bytes, only the first 128 and the last 128 bytes will be shown
- Parameters
-
data | pointer to data |
size | number of bytes to output |
Definition at line 344 of file module.c.
◆ ec_print_data_diff()
void ec_print_data_diff |
( |
const uint8_t * |
d1, |
|
|
const uint8_t * |
d2, |
|
|
size_t |
size |
|
) |
| |
Outputs frame contents and differences for debugging purposes.
- Parameters
-
d1 | first data |
d2 | second data |
size | number of bytes to output |
Definition at line 372 of file module.c.
◆ ec_state_string()
size_t ec_state_string |
( |
uint8_t |
states, |
|
|
char * |
buffer, |
|
|
uint8_t |
multi |
|
) |
| |
Prints slave states in clear text.
- Returns
- Size of the created string.
- Parameters
-
states | slave states |
buffer | target buffer (min. EC_STATE_STRING_SIZE bytes) |
multi | Show multi-state mask. |
Definition at line 401 of file module.c.
◆ ecrt_request_master_err()
ec_master_t* ecrt_request_master_err |
( |
unsigned int |
master_index | ) |
|
Request a master.
Same as ecrt_request_master(), but with ERR_PTR() return value.
- Returns
- Requested master.
- Parameters
-
master_index | Master index. |
Definition at line 537 of file module.c.
◆ main_devices
Main devices parameter.
Definition at line 51 of file module.c.
◆ master_count
unsigned int master_count |
|
static |
Number of masters.
Definition at line 52 of file module.c.
◆ backup_devices
Backup devices parameter.
Definition at line 53 of file module.c.
◆ backup_count
unsigned int backup_count |
|
static |
Number of backup devices.
Definition at line 54 of file module.c.
◆ debug_level
Debug level parameter.
Definition at line 55 of file module.c.
◆ run_on_cpu
unsigned int run_on_cpu = 0xffffffff |
|
static |
Bind created kernel threads to a cpu.
Default do not bind.
Definition at line 56 of file module.c.
◆ masters
Array of masters.
Definition at line 60 of file module.c.
◆ master_sem
struct semaphore master_sem |
|
static |
Master semaphore.
Definition at line 61 of file module.c.
◆ device_number
Device number for master cdevs.
Definition at line 63 of file module.c.
◆ class
Device class.
Definition at line 64 of file module.c.
◆ macs
MAC addresses.
Definition at line 66 of file module.c.
◆ ec_master_version_str
char* ec_master_version_str = EC_MASTER_VERSION |
Version string.
Definition at line 68 of file module.c.
◆ ec_device_names
const char* ec_device_names[2] |
Initial value:
Device names.
Definition at line 465 of file module.c.
◆ ec_request_state_translation_table
Initial value:= {
}
Request is being processed.
Request was processed successfully.
Request processing failed.
Global request state type translation table.
Translates an internal request state to an external one.
Definition at line 658 of file module.c.