master/slave.c
changeset 1586 eb9185dfa8ac
parent 1543 373cd456dc26
parent 1583 017fa8fd9ac1
child 1606 6c5849669900
equal deleted inserted replaced
1581:e51cf2af3ff9 1586:eb9185dfa8ac
    65         uint16_t ring_position, /**< ring position */
    65         uint16_t ring_position, /**< ring position */
    66         uint16_t station_address /**< station address to configure */
    66         uint16_t station_address /**< station address to configure */
    67         )
    67         )
    68 {
    68 {
    69     unsigned int i;
    69     unsigned int i;
       
    70     int ret;
    70 
    71 
    71     slave->master = master;
    72     slave->master = master;
    72     slave->ring_position = ring_position;
    73     slave->ring_position = ring_position;
    73     slave->station_address = station_address;
    74     slave->station_address = station_address;
    74 
    75 
   145 
   146 
   146     INIT_LIST_HEAD(&slave->sdo_dictionary);
   147     INIT_LIST_HEAD(&slave->sdo_dictionary);
   147 
   148 
   148     slave->sdo_dictionary_fetched = 0;
   149     slave->sdo_dictionary_fetched = 0;
   149     slave->jiffies_preop = 0;
   150     slave->jiffies_preop = 0;
       
   151 
       
   152     // init state machine datagram
       
   153     ec_datagram_init(&slave->fsm_datagram);
       
   154     snprintf(slave->fsm_datagram.name, EC_DATAGRAM_NAME_SIZE, "slave%u-fsm",slave->ring_position);
       
   155     ret = ec_datagram_prealloc(&slave->fsm_datagram, EC_MAX_DATA_SIZE);
       
   156     if (ret < 0) {
       
   157         ec_datagram_clear(&slave->fsm_datagram);
       
   158         EC_ERR("Failed to allocate Slave %u FSM datagram.\n",slave->ring_position);
       
   159         return;
       
   160     }
       
   161 
       
   162     // create state machine object
       
   163     ec_fsm_slave_init(&slave->fsm, slave, &slave->fsm_datagram);
       
   164 
   150 }
   165 }
   151 
   166 
   152 /*****************************************************************************/
   167 /*****************************************************************************/
   153 
   168 
   154 /**
   169 /**
   189         kfree(pdo);
   204         kfree(pdo);
   190     }
   205     }
   191 
   206 
   192     if (slave->sii_words)
   207     if (slave->sii_words)
   193         kfree(slave->sii_words);
   208         kfree(slave->sii_words);
       
   209     ec_fsm_slave_clear(&slave->fsm);
       
   210     ec_datagram_clear(&slave->fsm_datagram);
       
   211 
   194 }
   212 }
   195 
   213 
   196 /*****************************************************************************/
   214 /*****************************************************************************/
   197 
   215 
   198 /** Clear the sync manager array. 
   216 /** Clear the sync manager array.