master/fsm_slave_scan.c
changeset 1942 cd6ff5adae84
parent 1934 f00951ab7399
child 1951 a1a6d7719f97
equal deleted inserted replaced
1941:e12266a4f473 1942:cd6ff5adae84
    50 void ec_fsm_slave_scan_state_dc_cap(ec_fsm_slave_scan_t *);
    50 void ec_fsm_slave_scan_state_dc_cap(ec_fsm_slave_scan_t *);
    51 void ec_fsm_slave_scan_state_dc_times(ec_fsm_slave_scan_t *);
    51 void ec_fsm_slave_scan_state_dc_times(ec_fsm_slave_scan_t *);
    52 void ec_fsm_slave_scan_state_datalink(ec_fsm_slave_scan_t *);
    52 void ec_fsm_slave_scan_state_datalink(ec_fsm_slave_scan_t *);
    53 void ec_fsm_slave_scan_state_sii_size(ec_fsm_slave_scan_t *);
    53 void ec_fsm_slave_scan_state_sii_size(ec_fsm_slave_scan_t *);
    54 void ec_fsm_slave_scan_state_sii_data(ec_fsm_slave_scan_t *);
    54 void ec_fsm_slave_scan_state_sii_data(ec_fsm_slave_scan_t *);
       
    55 #ifdef EC_REGALIAS
    55 void ec_fsm_slave_scan_state_regalias(ec_fsm_slave_scan_t *);
    56 void ec_fsm_slave_scan_state_regalias(ec_fsm_slave_scan_t *);
       
    57 #endif
    56 void ec_fsm_slave_scan_state_preop(ec_fsm_slave_scan_t *);
    58 void ec_fsm_slave_scan_state_preop(ec_fsm_slave_scan_t *);
    57 void ec_fsm_slave_scan_state_sync(ec_fsm_slave_scan_t *);
    59 void ec_fsm_slave_scan_state_sync(ec_fsm_slave_scan_t *);
    58 void ec_fsm_slave_scan_state_pdos(ec_fsm_slave_scan_t *);
    60 void ec_fsm_slave_scan_state_pdos(ec_fsm_slave_scan_t *);
    59 
    61 
    60 void ec_fsm_slave_scan_state_end(ec_fsm_slave_scan_t *);
    62 void ec_fsm_slave_scan_state_end(ec_fsm_slave_scan_t *);
    61 void ec_fsm_slave_scan_state_error(ec_fsm_slave_scan_t *);
    63 void ec_fsm_slave_scan_state_error(ec_fsm_slave_scan_t *);
    62 
    64 
    63 void ec_fsm_slave_scan_enter_datalink(ec_fsm_slave_scan_t *);
    65 void ec_fsm_slave_scan_enter_datalink(ec_fsm_slave_scan_t *);
       
    66 #ifdef EC_REGALIAS
    64 void ec_fsm_slave_scan_enter_regalias(ec_fsm_slave_scan_t *);
    67 void ec_fsm_slave_scan_enter_regalias(ec_fsm_slave_scan_t *);
       
    68 #endif
    65 void ec_fsm_slave_scan_enter_preop(ec_fsm_slave_scan_t *);
    69 void ec_fsm_slave_scan_enter_preop(ec_fsm_slave_scan_t *);
    66 void ec_fsm_slave_scan_enter_pdos(ec_fsm_slave_scan_t *);
    70 void ec_fsm_slave_scan_enter_pdos(ec_fsm_slave_scan_t *);
    67 
    71 
    68 /*****************************************************************************/
    72 /*****************************************************************************/
    69 
    73 
   692                     " Next category header missing.\n");
   696                     " Next category header missing.\n");
   693             goto end;
   697             goto end;
   694         }
   698         }
   695     }
   699     }
   696 
   700 
       
   701 #ifdef EC_REGALIAS
   697     ec_fsm_slave_scan_enter_regalias(fsm);
   702     ec_fsm_slave_scan_enter_regalias(fsm);
       
   703 #else
       
   704     if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
       
   705         ec_fsm_slave_scan_enter_preop(fsm);
       
   706     } else {
       
   707         fsm->state = ec_fsm_slave_scan_state_end;
       
   708     }
       
   709 #endif
   698     return;
   710     return;
   699 
   711 
   700 end:
   712 end:
   701     EC_SLAVE_ERR(slave, "Failed to analyze category data.\n");
   713     EC_SLAVE_ERR(slave, "Failed to analyze category data.\n");
   702     fsm->slave->error_flag = 1;
   714     fsm->slave->error_flag = 1;
   703     fsm->state = ec_fsm_slave_scan_state_error;
   715     fsm->state = ec_fsm_slave_scan_state_error;
   704 }
   716 }
   705 
   717 
   706 
   718 /*****************************************************************************/
   707 /*****************************************************************************/
   719 
   708 
   720 #ifdef EC_REGALIAS
   709 /**
   721 
   710    Slave scan entry function: REGALIAS.
   722 /** Slave scan entry function: REGALIAS.
   711 */
   723  */
   712 
       
   713 void ec_fsm_slave_scan_enter_regalias(
   724 void ec_fsm_slave_scan_enter_regalias(
   714         ec_fsm_slave_scan_t *fsm /**< slave state machine */
   725         ec_fsm_slave_scan_t *fsm /**< slave state machine */
   715         )
   726         )
   716 {
   727 {
   717     ec_datagram_t *datagram = fsm->datagram;
   728     ec_datagram_t *datagram = fsm->datagram;
   725     fsm->state = ec_fsm_slave_scan_state_regalias;
   736     fsm->state = ec_fsm_slave_scan_state_regalias;
   726 }
   737 }
   727 
   738 
   728 /*****************************************************************************/
   739 /*****************************************************************************/
   729 
   740 
   730 /**
   741 /** Slave scan state: REGALIAS.
   731    Slave scan state: REGALIAS.
   742  */
   732 */
       
   733 void ec_fsm_slave_scan_state_regalias(
   743 void ec_fsm_slave_scan_state_regalias(
   734         ec_fsm_slave_scan_t *fsm /**< slave state machine */
   744         ec_fsm_slave_scan_t *fsm /**< slave state machine */
   735         )
   745         )
   736 {
   746 {
   737     ec_datagram_t *datagram = fsm->datagram;
   747     ec_datagram_t *datagram = fsm->datagram;
   752     } else {
   762     } else {
   753         slave->effective_alias = EC_READ_U16(datagram->data);
   763         slave->effective_alias = EC_READ_U16(datagram->data);
   754         EC_SLAVE_DBG(slave, 1, "Read alias %u from register.\n",
   764         EC_SLAVE_DBG(slave, 1, "Read alias %u from register.\n",
   755                 slave->effective_alias);
   765                 slave->effective_alias);
   756     }
   766     }
       
   767 
   757     if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
   768     if (slave->sii.mailbox_protocols & EC_MBOX_COE) {
   758         ec_fsm_slave_scan_enter_preop(fsm);
   769         ec_fsm_slave_scan_enter_preop(fsm);
   759     } else {
   770     } else {
   760         fsm->state = ec_fsm_slave_scan_state_end;
   771         fsm->state = ec_fsm_slave_scan_state_end;
   761     }
   772     }
   762 }
   773 }
       
   774 
       
   775 #endif // defined EC_REGALIAS
   763 
   776 
   764 /*****************************************************************************/
   777 /*****************************************************************************/
   765 
   778 
   766 /** Enter slave scan state PREOP.
   779 /** Enter slave scan state PREOP.
   767  */
   780  */