master/ethernet.c
changeset 2094 83e9160319ec
parent 2045 ff2a13a4603c
child 2240 b45438edf869
equal deleted inserted replaced
2093:c7e7d80e49ea 2094:83e9160319ec
   324     if (!eoe->opened)
   324     if (!eoe->opened)
   325         return;
   325         return;
   326 
   326 
   327     // if the datagram was not sent, or is not yet received, skip this cycle
   327     // if the datagram was not sent, or is not yet received, skip this cycle
   328     if (eoe->queue_datagram ||
   328     if (eoe->queue_datagram ||
   329         ec_mbox_is_datagram_state(&eoe->mbox,EC_DATAGRAM_QUEUED) ||
   329         ec_mbox_is_datagram_state(&eoe->mbox, EC_DATAGRAM_QUEUED) ||
   330         ec_mbox_is_datagram_state(&eoe->mbox,EC_DATAGRAM_SENT))
   330         ec_mbox_is_datagram_state(&eoe->mbox, EC_DATAGRAM_SENT)) {
   331         return;
   331         return;
       
   332     }
   332 
   333 
   333     // call state function
   334     // call state function
   334     eoe->state(eoe);
   335     eoe->state(eoe);
   335 
   336 
   336     // update statistics
   337     // update statistics
   410  * Processes the checking datagram sent in RX_START and issues a receive
   411  * Processes the checking datagram sent in RX_START and issues a receive
   411  * datagram, if new data is available.
   412  * datagram, if new data is available.
   412  */
   413  */
   413 void ec_eoe_state_rx_check(ec_eoe_t *eoe /**< EoE handler */)
   414 void ec_eoe_state_rx_check(ec_eoe_t *eoe /**< EoE handler */)
   414 {
   415 {
   415     if (!ec_mbox_is_datagram_state(&eoe->mbox,EC_DATAGRAM_RECEIVED)) {
   416     if (!ec_mbox_is_datagram_state(&eoe->mbox, EC_DATAGRAM_RECEIVED)) {
   416         eoe->stats.rx_errors++;
   417         eoe->stats.rx_errors++;
   417 #if EOE_DEBUG_LEVEL >= 1
   418 #if EOE_DEBUG_LEVEL >= 1
   418         EC_SLAVE_WARN(eoe->slave, "Failed to receive mbox"
   419         EC_SLAVE_WARN(eoe->slave, "Failed to receive mbox"
   419                 " check datagram for %s.\n", eoe->dev->name);
   420                 " check datagram for %s.\n", eoe->dev->name);
   420 #endif
   421 #endif
   449     off_t offset;
   450     off_t offset;
   450 #if EOE_DEBUG_LEVEL >= 3
   451 #if EOE_DEBUG_LEVEL >= 3
   451     unsigned int i;
   452     unsigned int i;
   452 #endif
   453 #endif
   453 
   454 
   454     if (!ec_mbox_is_datagram_state(&eoe->mbox,EC_DATAGRAM_RECEIVED)) {
   455     if (!ec_mbox_is_datagram_state(&eoe->mbox, EC_DATAGRAM_RECEIVED)) {
   455         eoe->stats.rx_errors++;
   456         eoe->stats.rx_errors++;
   456 #if EOE_DEBUG_LEVEL >= 1
   457 #if EOE_DEBUG_LEVEL >= 1
   457         EC_SLAVE_WARN(eoe->slave, "Failed to receive mbox"
   458         EC_SLAVE_WARN(eoe->slave, "Failed to receive mbox"
   458                 " fetch datagram for %s.\n", eoe->dev->name);
   459                 " fetch datagram for %s.\n", eoe->dev->name);
   459 #endif
   460 #endif
   686  * Checks is the previous transmit datagram succeded and sends the next
   687  * Checks is the previous transmit datagram succeded and sends the next
   687  * fragment, if necessary.
   688  * fragment, if necessary.
   688  */
   689  */
   689 void ec_eoe_state_tx_sent(ec_eoe_t *eoe /**< EoE handler */)
   690 void ec_eoe_state_tx_sent(ec_eoe_t *eoe /**< EoE handler */)
   690 {
   691 {
   691     if (!ec_mbox_is_datagram_state(&eoe->mbox,EC_DATAGRAM_RECEIVED)) {
   692     if (!ec_mbox_is_datagram_state(&eoe->mbox, EC_DATAGRAM_RECEIVED)) {
   692         if (eoe->tries) {
   693         if (eoe->tries) {
   693             eoe->tries--; // try again
   694             eoe->tries--; // try again
   694             eoe->queue_datagram = 1;
   695             eoe->queue_datagram = 1;
   695         } else {
   696         } else {
   696             eoe->stats.tx_errors++;
   697             eoe->stats.tx_errors++;
   702             eoe->state = ec_eoe_state_rx_start;
   703             eoe->state = ec_eoe_state_rx_start;
   703         }
   704         }
   704         return;
   705         return;
   705     }
   706     }
   706 
   707 
   707     if (!ec_mbox_is_datagram_wc(&eoe->mbox,1)) {
   708     if (!ec_mbox_is_datagram_wc(&eoe->mbox, 1)) {
   708         if (eoe->tries) {
   709         if (eoe->tries) {
   709             eoe->tries--; // try again
   710             eoe->tries--; // try again
   710             eoe->queue_datagram = 1;
   711             eoe->queue_datagram = 1;
   711         } else {
   712         } else {
   712             eoe->stats.tx_errors++;
   713             eoe->stats.tx_errors++;