mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-06 20:01:44 +08:00
Centrally defined mailbox types.
This commit is contained in:
@@ -299,7 +299,7 @@ int ec_eoe_send(ec_eoe_t *eoe /**< EoE handler */)
|
||||
#endif
|
||||
|
||||
data = ec_slave_mbox_prepare_send(eoe->slave, &eoe->datagram,
|
||||
0x02, current_size + 4);
|
||||
EC_MBOX_TYPE_EOE, current_size + 4);
|
||||
if (IS_ERR(data))
|
||||
return PTR_ERR(data);
|
||||
|
||||
@@ -478,7 +478,7 @@ void ec_eoe_state_rx_fetch(ec_eoe_t *eoe /**< EoE handler */)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x02) { // EoE FIXME mailbox handler necessary
|
||||
if (mbox_prot != EC_MBOX_TYPE_EOE) { // FIXME mailbox handler necessary
|
||||
eoe->stats.rx_errors++;
|
||||
#if EOE_DEBUG_LEVEL >= 1
|
||||
EC_SLAVE_WARN(eoe->slave, "Other mailbox protocol response for %s.\n",
|
||||
|
||||
@@ -318,7 +318,8 @@ int ec_fsm_coe_prepare_dict(
|
||||
)
|
||||
{
|
||||
ec_slave_t *slave = fsm->slave;
|
||||
uint8_t *data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8);
|
||||
uint8_t *data = ec_slave_mbox_prepare_send(slave, datagram,
|
||||
EC_MBOX_TYPE_COE, 8);
|
||||
if (IS_ERR(data)) {
|
||||
return PTR_ERR(data);
|
||||
}
|
||||
@@ -470,7 +471,8 @@ int ec_fsm_coe_dict_prepare_desc(
|
||||
)
|
||||
{
|
||||
ec_slave_t *slave = fsm->slave;
|
||||
u8 *data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8);
|
||||
u8 *data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_COE,
|
||||
8);
|
||||
if (IS_ERR(data)) {
|
||||
return PTR_ERR(data);
|
||||
}
|
||||
@@ -532,7 +534,7 @@ void ec_fsm_coe_dict_response(
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x03) { // CoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_COE) {
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol 0x%02X as response.\n",
|
||||
mbox_prot);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
@@ -752,7 +754,8 @@ int ec_fsm_coe_dict_prepare_entry(
|
||||
)
|
||||
{
|
||||
ec_slave_t *slave = fsm->slave;
|
||||
u8 *data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10);
|
||||
u8 *data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_COE,
|
||||
10);
|
||||
if (IS_ERR(data)) {
|
||||
return PTR_ERR(data);
|
||||
}
|
||||
@@ -813,7 +816,7 @@ void ec_fsm_coe_dict_desc_response(
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x03) { // CoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_COE) {
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol 0x%02X as response.\n",
|
||||
mbox_prot);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
@@ -1049,7 +1052,7 @@ void ec_fsm_coe_dict_entry_response(
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x03) { // CoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_COE) {
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol"
|
||||
" 0x%02X as response.\n", mbox_prot);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
@@ -1200,7 +1203,7 @@ int ec_fsm_coe_prepare_down_start(
|
||||
uint8_t data_set_size;
|
||||
|
||||
if (request->data_size <= 4) { // use expedited transfer type
|
||||
data = ec_slave_mbox_prepare_send(slave, datagram, 0x03,
|
||||
data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_COE,
|
||||
EC_COE_DOWN_REQ_HEADER_SIZE);
|
||||
if (IS_ERR(data)) {
|
||||
request->errno = PTR_ERR(data);
|
||||
@@ -1241,7 +1244,7 @@ int ec_fsm_coe_prepare_down_start(
|
||||
data_size = required_data_size;
|
||||
}
|
||||
|
||||
data = ec_slave_mbox_prepare_send(slave, datagram, 0x03,
|
||||
data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_COE,
|
||||
data_size);
|
||||
if (IS_ERR(data)) {
|
||||
request->errno = PTR_ERR(data);
|
||||
@@ -1491,7 +1494,7 @@ void ec_fsm_coe_down_prepare_segment_request(
|
||||
+ EC_COE_DOWN_SEG_MIN_DATA_SIZE;
|
||||
}
|
||||
|
||||
data = ec_slave_mbox_prepare_send(slave, datagram, 0x03,
|
||||
data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_COE,
|
||||
data_size);
|
||||
if (IS_ERR(data)) {
|
||||
request->errno = PTR_ERR(data);
|
||||
@@ -1565,7 +1568,7 @@ void ec_fsm_coe_down_response(
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x03) { // CoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_COE) {
|
||||
request->errno = EIO;
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol 0x%02X as response.\n",
|
||||
@@ -1743,7 +1746,7 @@ void ec_fsm_coe_down_seg_response(
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x03) { // CoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_COE) {
|
||||
request->errno = EIO;
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol 0x%02X as response.\n",
|
||||
@@ -1844,7 +1847,8 @@ int ec_fsm_coe_prepare_up(
|
||||
ec_sdo_request_t *request = fsm->request;
|
||||
ec_master_t *master = slave->master;
|
||||
|
||||
u8 *data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10);
|
||||
u8 *data = ec_slave_mbox_prepare_send(slave, datagram, EC_MBOX_TYPE_COE,
|
||||
10);
|
||||
if (IS_ERR(data)) {
|
||||
request->errno = PTR_ERR(data);
|
||||
return PTR_ERR(data);
|
||||
@@ -2035,7 +2039,8 @@ void ec_fsm_coe_up_prepare_segment_request(
|
||||
)
|
||||
{
|
||||
uint8_t *data =
|
||||
ec_slave_mbox_prepare_send(fsm->slave, datagram, 0x03, 10);
|
||||
ec_slave_mbox_prepare_send(fsm->slave, datagram, EC_MBOX_TYPE_COE,
|
||||
10);
|
||||
if (IS_ERR(data)) {
|
||||
fsm->request->errno = PTR_ERR(data);
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
@@ -2108,7 +2113,7 @@ void ec_fsm_coe_up_response(
|
||||
ec_print_data(data, rec_size);
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x03) { // CoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_COE) {
|
||||
request->errno = EIO;
|
||||
fsm->state = ec_fsm_coe_error;
|
||||
EC_SLAVE_WARN(slave, "Received mailbox protocol 0x%02X"
|
||||
@@ -2413,7 +2418,7 @@ void ec_fsm_coe_up_seg_response(
|
||||
ec_print_data(data, rec_size);
|
||||
}
|
||||
|
||||
if (mbox_prot != 0x03) { // CoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_COE) {
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol 0x%02X as response.\n",
|
||||
mbox_prot);
|
||||
request->errno = EIO;
|
||||
|
||||
@@ -46,10 +46,6 @@
|
||||
*/
|
||||
#define EC_FSM_FOE_TIMEOUT 3000
|
||||
|
||||
/** Mailbox type FoE.
|
||||
*/
|
||||
#define EC_MBOX_TYPE_FILEACCESS 0x04
|
||||
|
||||
/** Size of the FoE header.
|
||||
*/
|
||||
#define EC_FOE_HEADER_SIZE 6
|
||||
@@ -253,8 +249,7 @@ int ec_foe_prepare_data_send(
|
||||
}
|
||||
|
||||
data = ec_slave_mbox_prepare_send(fsm->slave,
|
||||
datagram, EC_MBOX_TYPE_FILEACCESS,
|
||||
current_size + EC_FOE_HEADER_SIZE);
|
||||
datagram, EC_MBOX_TYPE_FOE, current_size + EC_FOE_HEADER_SIZE);
|
||||
if (IS_ERR(data)) {
|
||||
return -1;
|
||||
}
|
||||
@@ -291,7 +286,7 @@ int ec_foe_prepare_wrq_send(
|
||||
current_size = fsm->tx_filename_len;
|
||||
|
||||
data = ec_slave_mbox_prepare_send(fsm->slave, datagram,
|
||||
EC_MBOX_TYPE_FILEACCESS, current_size + EC_FOE_HEADER_SIZE);
|
||||
EC_MBOX_TYPE_FOE, current_size + EC_FOE_HEADER_SIZE);
|
||||
if (IS_ERR(data)) {
|
||||
return -1;
|
||||
}
|
||||
@@ -428,7 +423,7 @@ void ec_fsm_foe_state_ack_read(
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != EC_MBOX_TYPE_FILEACCESS) { // FoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_FOE) {
|
||||
ec_foe_set_tx_error(fsm, FOE_MBOX_PROT_ERROR);
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol 0x%02X as response.\n",
|
||||
mbox_prot);
|
||||
@@ -563,7 +558,7 @@ int ec_foe_prepare_rrq_send(
|
||||
current_size = fsm->rx_filename_len;
|
||||
|
||||
data = ec_slave_mbox_prepare_send(fsm->slave, datagram,
|
||||
EC_MBOX_TYPE_FILEACCESS, current_size + EC_FOE_HEADER_SIZE);
|
||||
EC_MBOX_TYPE_FOE, current_size + EC_FOE_HEADER_SIZE);
|
||||
if (IS_ERR(data)) {
|
||||
return -1;
|
||||
}
|
||||
@@ -594,7 +589,7 @@ int ec_foe_prepare_send_ack(
|
||||
uint8_t *data;
|
||||
|
||||
data = ec_slave_mbox_prepare_send(fsm->slave, datagram,
|
||||
EC_MBOX_TYPE_FILEACCESS, EC_FOE_HEADER_SIZE);
|
||||
EC_MBOX_TYPE_FOE, EC_FOE_HEADER_SIZE);
|
||||
if (IS_ERR(data)) {
|
||||
return -1;
|
||||
}
|
||||
@@ -767,7 +762,7 @@ void ec_fsm_foe_state_data_read(
|
||||
return;
|
||||
}
|
||||
|
||||
if (mbox_prot != EC_MBOX_TYPE_FILEACCESS) { // FoE
|
||||
if (mbox_prot != EC_MBOX_TYPE_FOE) {
|
||||
EC_SLAVE_ERR(slave, "Received mailbox protocol 0x%02X as response.\n",
|
||||
mbox_prot);
|
||||
ec_foe_set_rx_error(fsm, FOE_PROT_ERROR);
|
||||
|
||||
@@ -41,10 +41,6 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Mailbox type for SoE.
|
||||
*/
|
||||
#define EC_MBOX_TYPE_SOE 0x05
|
||||
|
||||
/** SoE operations
|
||||
*/
|
||||
enum ec_soe_opcodes {
|
||||
|
||||
@@ -45,6 +45,16 @@
|
||||
*/
|
||||
#define EC_MBOX_HEADER_SIZE 6
|
||||
|
||||
/** Mailbox types.
|
||||
*/
|
||||
enum ec_mbox_types {
|
||||
EC_MBOX_TYPE_EOE = 0x02,
|
||||
EC_MBOX_TYPE_COE = 0x03,
|
||||
EC_MBOX_TYPE_FOE = 0x04,
|
||||
EC_MBOX_TYPE_SOE = 0x05,
|
||||
EC_MBOX_TYPE_VOE = 0x0f,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
uint8_t *ec_slave_mbox_prepare_send(const ec_slave_t *, ec_datagram_t *,
|
||||
|
||||
@@ -40,10 +40,6 @@
|
||||
#include "mailbox.h"
|
||||
#include "voe_handler.h"
|
||||
|
||||
/** VoE mailbox type.
|
||||
*/
|
||||
#define EC_MBOX_TYPE_VOE 0x0f
|
||||
|
||||
/** VoE header size.
|
||||
*/
|
||||
#define EC_VOE_HEADER_SIZE 6
|
||||
|
||||
Reference in New Issue
Block a user