master/device.h
changeset 692 fe7cf37c33f1
parent 679 62fc387ec928
child 693 e341f1788608
equal deleted inserted replaced
691:77b79a29e0e7 692:fe7cf37c33f1
    49 
    49 
    50 #ifdef EC_DEBUG_IF
    50 #ifdef EC_DEBUG_IF
    51 #include "debug.h"
    51 #include "debug.h"
    52 #endif
    52 #endif
    53 
    53 
       
    54 #ifdef EC_DEBUG_RING
       
    55 #define EC_DEBUG_RING_SIZE 10
       
    56 
       
    57 typedef enum {
       
    58     TX, RX
       
    59 } ec_debug_frame_dir_t;
       
    60 
       
    61 typedef struct {
       
    62     ec_debug_frame_dir_t dir;
       
    63     struct timeval t;
       
    64     unsigned int addr;
       
    65     uint8_t data[EC_MAX_DATA_SIZE];
       
    66     unsigned int data_size;
       
    67 } ec_debug_frame_t;
       
    68 
       
    69 #endif
       
    70 
    54 /*****************************************************************************/
    71 /*****************************************************************************/
    55 
    72 
    56 /**
    73 /**
    57    EtherCAT device.
    74    EtherCAT device.
    58    An EtherCAT device is a network interface card, that is owned by an
    75    An EtherCAT device is a network interface card, that is owned by an
    68     uint8_t open; /**< true, if the net_device has been opened */
    85     uint8_t open; /**< true, if the net_device has been opened */
    69     uint8_t link_state; /**< device link state */
    86     uint8_t link_state; /**< device link state */
    70     struct sk_buff *tx_skb; /**< transmit socket buffer */
    87     struct sk_buff *tx_skb; /**< transmit socket buffer */
    71     struct ethhdr *eth; /**< pointer to ethernet header in socket buffer */
    88     struct ethhdr *eth; /**< pointer to ethernet header in socket buffer */
    72     cycles_t cycles_poll; /**< cycles of last poll */
    89     cycles_t cycles_poll; /**< cycles of last poll */
       
    90 #ifdef EC_DEBUG_RING
       
    91     struct timeval timeval_poll;
       
    92 #endif
    73     unsigned long jiffies_poll; /**< jiffies of last poll */
    93     unsigned long jiffies_poll; /**< jiffies of last poll */
    74     unsigned int tx_count; /**< number of frames sent */
    94     unsigned int tx_count; /**< number of frames sent */
    75     unsigned int rx_count; /**< number of frames received */
    95     unsigned int rx_count; /**< number of frames received */
    76 #ifdef EC_DEBUG_IF
    96 #ifdef EC_DEBUG_IF
    77     ec_debug_t dbg; /**< debug device */
    97     ec_debug_t dbg; /**< debug device */
       
    98 #endif
       
    99 #ifdef EC_DEBUG_RING
       
   100     ec_debug_frame_t debug_frames[EC_DEBUG_RING_SIZE];
       
   101     unsigned int debug_frame_index;
       
   102     unsigned int debug_frame_count;
    78 #endif
   103 #endif
    79 };
   104 };
    80 
   105 
    81 /*****************************************************************************/
   106 /*****************************************************************************/
    82 
   107 
    92 
   117 
    93 void ec_device_poll(ec_device_t *);
   118 void ec_device_poll(ec_device_t *);
    94 uint8_t *ec_device_tx_data(ec_device_t *);
   119 uint8_t *ec_device_tx_data(ec_device_t *);
    95 void ec_device_send(ec_device_t *, size_t);
   120 void ec_device_send(ec_device_t *, size_t);
    96 
   121 
       
   122 #ifdef EC_DEBUG_RING
       
   123 void ec_device_debug_ring_append(ec_device_t *, ec_debug_frame_dir_t,
       
   124         const void *, size_t);
       
   125 void ec_device_debug_ring_print(const ec_device_t *);
       
   126 #endif
       
   127 
    97 /*****************************************************************************/
   128 /*****************************************************************************/
    98 
   129 
    99 #endif
   130 #endif