--- a/master/canopen.c Wed Sep 19 17:17:45 2007 +0000
+++ b/master/canopen.c Wed Sep 19 17:25:48 2007 +0000
@@ -51,10 +51,6 @@
void ec_sdo_clear(struct kobject *);
void ec_sdo_entry_clear(struct kobject *);
-void ec_sdo_request_init_read(ec_sdo_request_t *, ec_sdo_t *,
- ec_sdo_entry_t *);
-void ec_sdo_request_clear(ec_sdo_request_t *);
-
/*****************************************************************************/
/** \cond */
@@ -367,12 +363,11 @@
char *buffer /**< target buffer */
)
{
- ec_sdo_t *sdo = entry->sdo;
- ec_master_t *master = sdo->slave->master;
+ ec_master_t *master = entry->sdo->slave->master;
off_t off = 0;
ec_sdo_request_t request;
- ec_sdo_request_init_read(&request, sdo, entry);
+ ec_sdo_request_init_read(&request, entry);
// schedule request.
down(&master->sdo_sem);
@@ -431,11 +426,9 @@
*/
void ec_sdo_request_init_read(ec_sdo_request_t *req, /**< SDO request */
- ec_sdo_t *sdo, /**< SDO */
ec_sdo_entry_t *entry /**< SDO entry */
)
{
- req->sdo = sdo;
req->entry = entry;
req->data = NULL;
req->size = 0;
--- a/master/canopen.h Wed Sep 19 17:17:45 2007 +0000
+++ b/master/canopen.h Wed Sep 19 17:25:48 2007 +0000
@@ -109,7 +109,6 @@
typedef struct
{
struct list_head list; /**< list item */
- ec_sdo_t *sdo;
ec_sdo_entry_t *entry;
uint8_t *data; /**< pointer to SDO data */
size_t size; /**< size of SDO data */
@@ -125,6 +124,9 @@
int ec_sdo_entry_init(ec_sdo_entry_t *, uint8_t, ec_sdo_t *);
void ec_sdo_entry_destroy(ec_sdo_entry_t *);
+void ec_sdo_request_init_read(ec_sdo_request_t *, ec_sdo_entry_t *);
+void ec_sdo_request_clear(ec_sdo_request_t *);
+
/*****************************************************************************/
#endif
--- a/master/fsm_coe.c Wed Sep 19 17:17:45 2007 +0000
+++ b/master/fsm_coe.c Wed Sep 19 17:25:48 2007 +0000
@@ -1158,13 +1158,12 @@
ec_slave_t *slave = fsm->slave;
ec_master_t *master = slave->master;
ec_sdo_request_t *request = fsm->request;
- ec_sdo_t *sdo = request->sdo;
ec_sdo_entry_t *entry = request->entry;
uint8_t *data;
if (master->debug_level)
EC_DBG("Uploading SDO 0x%04X:%i from slave %i.\n",
- sdo->index, entry->subindex, slave->ring_position);
+ entry->sdo->index, entry->subindex, slave->ring_position);
if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) {
fsm->state = ec_fsm_coe_error;
@@ -1173,7 +1172,7 @@
EC_WRITE_U16(data, 0x2 << 12); // SDO request
EC_WRITE_U8 (data + 2, 0x2 << 5); // initiate upload request
- EC_WRITE_U16(data + 3, sdo->index);
+ EC_WRITE_U16(data + 3, entry->sdo->index);
EC_WRITE_U8 (data + 5, entry->subindex);
memset(data + 6, 0x00, 4);
@@ -1289,7 +1288,6 @@
uint8_t *data, mbox_prot;
size_t rec_size, data_size;
ec_sdo_request_t *request = fsm->request;
- ec_sdo_t *sdo = request->sdo;
ec_sdo_entry_t *entry = request->entry;
uint32_t complete_size;
unsigned int expedited, size_specified;
@@ -1340,7 +1338,7 @@
if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
EC_ERR("SDO upload 0x%04X:%X aborted on slave %i.\n",
- sdo->index, entry->subindex, slave->ring_position);
+ entry->sdo->index, entry->subindex, slave->ring_position);
ec_canopen_abort_msg(EC_READ_U32(data + 6));
fsm->state = ec_fsm_coe_error;
return;
@@ -1348,9 +1346,9 @@
if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
EC_READ_U8 (data + 2) >> 5 != 0x2 || // upload response
- EC_READ_U16(data + 3) != sdo->index || // index
+ EC_READ_U16(data + 3) != entry->sdo->index || // index
EC_READ_U8 (data + 5) != entry->subindex) { // subindex
- EC_ERR("SDO upload 0x%04X:%X failed:\n", sdo->index, entry->subindex);
+ EC_ERR("SDO upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
EC_ERR("Invalid SDO upload response at slave %i!\n",
slave->ring_position);
ec_print_data(data, rec_size);
@@ -1531,7 +1529,6 @@
uint8_t *data, mbox_prot;
size_t rec_size, data_size;
ec_sdo_request_t *request = fsm->request;
- ec_sdo_t *sdo = request->sdo;
ec_sdo_entry_t *entry = request->entry;
uint32_t seg_size;
unsigned int last_segment;
@@ -1582,7 +1579,7 @@
if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
EC_ERR("SDO upload 0x%04X:%X aborted on slave %i.\n",
- sdo->index, entry->subindex, slave->ring_position);
+ entry->sdo->index, entry->subindex, slave->ring_position);
ec_canopen_abort_msg(EC_READ_U32(data + 6));
fsm->state = ec_fsm_coe_error;
return;
@@ -1590,7 +1587,7 @@
if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
EC_READ_U8 (data + 2) >> 5 != 0x0) { // upload segment response
- EC_ERR("SDO upload 0x%04X:%X failed:\n", sdo->index, entry->subindex);
+ EC_ERR("SDO upload 0x%04X:%X failed:\n", entry->sdo->index, entry->subindex);
EC_ERR("Invalid SDO upload segment response at slave %i!\n",
slave->ring_position);
ec_print_data(data, rec_size);
--- a/master/fsm_master.c Wed Sep 19 17:17:45 2007 +0000
+++ b/master/fsm_master.c Wed Sep 19 17:25:48 2007 +0000
@@ -382,7 +382,7 @@
request->state = EC_REQUEST_IN_PROGRESS;
up(&master->sdo_sem);
- slave = request->sdo->slave;
+ slave = request->entry->sdo->slave;
if (slave->current_state == EC_SLAVE_STATE_INIT ||
slave->online_state == EC_SLAVE_OFFLINE ||
slave->error_flag) {