master/datagram.c
changeset 2068 3001f6523e63
parent 2040 45706e3273fd
child 2080 42fbd117c3e3
equal deleted inserted replaced
2067:19732da2cf86 2068:3001f6523e63
    85 
    85 
    86 /** Constructor.
    86 /** Constructor.
    87  */
    87  */
    88 void ec_datagram_init(ec_datagram_t *datagram /**< EtherCAT datagram. */)
    88 void ec_datagram_init(ec_datagram_t *datagram /**< EtherCAT datagram. */)
    89 {
    89 {
       
    90     INIT_LIST_HEAD(&datagram->list); // mark as unqueued
    90     INIT_LIST_HEAD(&datagram->queue); // mark as unqueued
    91     INIT_LIST_HEAD(&datagram->queue); // mark as unqueued
       
    92     INIT_LIST_HEAD(&datagram->fsm_queue); // mark as unqueued
       
    93     INIT_LIST_HEAD(&datagram->sent); // mark as unqueued
    91     datagram->type = EC_DATAGRAM_NONE;
    94     datagram->type = EC_DATAGRAM_NONE;
    92     memset(datagram->address, 0x00, EC_ADDR_LEN);
    95     memset(datagram->address, 0x00, EC_ADDR_LEN);
    93     datagram->data = NULL;
    96     datagram->data = NULL;
    94     datagram->data_origin = EC_ORIG_INTERNAL;
    97     datagram->data_origin = EC_ORIG_INTERNAL;
    95     datagram->mem_size = 0;
    98     datagram->mem_size = 0;
    96     datagram->data_size = 0;
    99     datagram->data_size = 0;
       
   100     datagram->domain = NULL;
    97     datagram->index = 0x00;
   101     datagram->index = 0x00;
    98     datagram->working_counter = 0x0000;
   102     datagram->working_counter = 0x0000;
    99     datagram->state = EC_DATAGRAM_INIT;
   103     datagram->state = EC_DATAGRAM_INIT;
   100 #ifdef EC_HAVE_CYCLES
   104 #ifdef EC_HAVE_CYCLES
   101     datagram->cycles_sent = 0;
   105     datagram->cycles_sent = 0;
   128 
   132 
   129 /** Unqueue datagram.
   133 /** Unqueue datagram.
   130  */
   134  */
   131 void ec_datagram_unqueue(ec_datagram_t *datagram /**< EtherCAT datagram. */)
   135 void ec_datagram_unqueue(ec_datagram_t *datagram /**< EtherCAT datagram. */)
   132 {
   136 {
       
   137     if (!list_empty(&datagram->fsm_queue)) {
       
   138         list_del_init(&datagram->fsm_queue);
       
   139     }
   133     if (!list_empty(&datagram->queue)) {
   140     if (!list_empty(&datagram->queue)) {
   134         list_del_init(&datagram->queue);
   141         list_del_init(&datagram->queue);
   135     }
   142     }
   136 }
   143 }
   137 
   144