master/slave.c
changeset 2045 ff2a13a4603c
parent 2032 57c618557912
child 2589 2b9c78543663
equal deleted inserted replaced
2044:1ae0491b2f6b 2045:ff2a13a4603c
   157     init_waitqueue_head(&slave->foe_queue);
   157     init_waitqueue_head(&slave->foe_queue);
   158 
   158 
   159     INIT_LIST_HEAD(&slave->soe_requests);
   159     INIT_LIST_HEAD(&slave->soe_requests);
   160     init_waitqueue_head(&slave->soe_queue);
   160     init_waitqueue_head(&slave->soe_queue);
   161 
   161 
   162     // init state machine datagram
   162     // init datagram
   163     ec_datagram_init(&slave->fsm_datagram);
   163     ec_datagram_init(&slave->datagram);
   164     snprintf(slave->fsm_datagram.name, EC_DATAGRAM_NAME_SIZE,
   164     snprintf(slave->datagram.name, EC_DATAGRAM_NAME_SIZE,
   165             "slave%u-fsm", slave->ring_position);
   165             "slave%u-fsm", slave->ring_position);
   166     ret = ec_datagram_prealloc(&slave->fsm_datagram, EC_MAX_DATA_SIZE);
   166     ret = ec_datagram_prealloc(&slave->datagram, EC_MAX_DATA_SIZE);
   167     if (ret < 0) {
   167     if (ret < 0) {
   168         ec_datagram_clear(&slave->fsm_datagram);
   168         ec_datagram_clear(&slave->datagram);
   169         EC_SLAVE_ERR(slave, "Failed to allocate FSM datagram.\n");
   169         EC_SLAVE_ERR(slave, "Failed to allocate FSM datagram.\n");
   170         return;
   170         return;
   171     }
   171     }
       
   172     ec_mbox_init(&slave->mbox,&slave->datagram);
   172 
   173 
   173     // create state machine object
   174     // create state machine object
   174     ec_fsm_slave_init(&slave->fsm, slave, &slave->fsm_datagram);
   175     ec_fsm_slave_init(&slave->fsm, slave, &slave->mbox);
   175 }
   176 }
   176 
   177 
   177 /*****************************************************************************/
   178 /*****************************************************************************/
   178 
   179 
   179 /**
   180 /**
   253     }
   254     }
   254 
   255 
   255     if (slave->sii_words)
   256     if (slave->sii_words)
   256         kfree(slave->sii_words);
   257         kfree(slave->sii_words);
   257     ec_fsm_slave_clear(&slave->fsm);
   258     ec_fsm_slave_clear(&slave->fsm);
   258     ec_datagram_clear(&slave->fsm_datagram);
   259     ec_mbox_clear(&slave->mbox);
   259 }
   260 }
   260 
   261 
   261 /*****************************************************************************/
   262 /*****************************************************************************/
   262 
   263 
   263 /** Clear the sync manager array. 
   264 /** Clear the sync manager array.