master/globals.h
branchstable-1.3
changeset 1744 7bc131b92039
parent 1739 5fcbd29151d2
child 1745 07fd94c5119d
equal deleted inserted replaced
1743:1a7067207637 1744:7bc131b92039
    47 
    47 
    48 /******************************************************************************
    48 /******************************************************************************
    49  *  EtherCAT master
    49  *  EtherCAT master
    50  *****************************************************************************/
    50  *****************************************************************************/
    51 
    51 
    52 /** maximum number of FMMUs per slave */
       
    53 #define EC_MAX_FMMUS 16
       
    54 
       
    55 /** size of the EoE tx queue */
       
    56 #define EC_EOE_TX_QUEUE_SIZE 100
       
    57 
       
    58 /** clock frequency for the EoE state machines */
    52 /** clock frequency for the EoE state machines */
    59 #define EC_EOE_FREQUENCY 1000
    53 #define EC_EOE_FREQUENCY 1000
    60 
    54 
    61 /** datagram timeout in microseconds */
    55 /** datagram timeout in microseconds */
    62 #define EC_IO_TIMEOUT 500
    56 #define EC_IO_TIMEOUT 500
    69 #define EC_WAIT_SDO_DICT 3
    63 #define EC_WAIT_SDO_DICT 3
    70 
    64 
    71 /** minimum size of a buffer used with ec_state_string() */
    65 /** minimum size of a buffer used with ec_state_string() */
    72 #define EC_STATE_STRING_SIZE 32
    66 #define EC_STATE_STRING_SIZE 32
    73 
    67 
       
    68 /** maximum EEPROM size in words, to avoid infinite reading. */
       
    69 #define EC_MAX_EEPROM_SIZE 512
       
    70 
    74 /******************************************************************************
    71 /******************************************************************************
    75  *  EtherCAT protocol
    72  *  EtherCAT protocol
    76  *****************************************************************************/
    73  *****************************************************************************/
    77 
    74 
    78 /** size of an EtherCAT frame header */
    75 /** size of an EtherCAT frame header */
    82 #define EC_DATAGRAM_HEADER_SIZE 10
    79 #define EC_DATAGRAM_HEADER_SIZE 10
    83 
    80 
    84 /** size of an EtherCAT datagram footer */
    81 /** size of an EtherCAT datagram footer */
    85 #define EC_DATAGRAM_FOOTER_SIZE 2
    82 #define EC_DATAGRAM_FOOTER_SIZE 2
    86 
    83 
    87 /** size of a sync manager configuration page */
       
    88 #define EC_SYNC_SIZE 8
       
    89 
       
    90 /** size of an FMMU configuration page */
       
    91 #define EC_FMMU_SIZE 16
       
    92 
       
    93 /** resulting maximum data size of a single datagram in a frame */
    84 /** resulting maximum data size of a single datagram in a frame */
    94 #define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \
    85 #define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \
    95                           - EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE)
    86                           - EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE)
       
    87 
       
    88 /** word offset of first EEPROM category. */
       
    89 #define EC_FIRST_EEPROM_CATEGORY_OFFSET 0x40
    96 
    90 
    97 /*****************************************************************************/
    91 /*****************************************************************************/
    98 
    92 
    99 /**
    93 /**
   100    Convenience macro for printing EtherCAT-specific information to syslog.
    94    Convenience macro for printing EtherCAT-specific information to syslog.
   167 /*****************************************************************************/
   161 /*****************************************************************************/
   168 
   162 
   169 void ec_print_data(const uint8_t *, size_t);
   163 void ec_print_data(const uint8_t *, size_t);
   170 void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t);
   164 void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t);
   171 size_t ec_state_string(uint8_t, char *);
   165 size_t ec_state_string(uint8_t, char *);
       
   166 ssize_t ec_mac_print(const uint8_t *, char *);
       
   167 int ec_mac_is_zero(const uint8_t *);
   172 
   168 
   173 /*****************************************************************************/
   169 /*****************************************************************************/
   174 
   170 
   175 /**
   171 /**
   176    Code - Message pair.
   172    Code - Message pair.
   185 }
   181 }
   186 ec_code_msg_t;
   182 ec_code_msg_t;
   187 
   183 
   188 /*****************************************************************************/
   184 /*****************************************************************************/
   189 
   185 
       
   186 /**
       
   187  * Master request state.
       
   188  */
       
   189 
       
   190 typedef enum
       
   191 {
       
   192     EC_REQUEST_QUEUED,
       
   193     EC_REQUEST_IN_PROGRESS,
       
   194     EC_REQUEST_COMPLETE,
       
   195     EC_REQUEST_FAILURE
       
   196 }
       
   197 ec_request_state_t;
       
   198 
       
   199 /*****************************************************************************/
       
   200 
   190 #endif
   201 #endif