master/command.h
changeset 144 fdc24bf62f80
parent 98 f564d0929292
child 195 674071846ee3
equal deleted inserted replaced
143:f6c4f38b699f 144:fdc24bf62f80
    82    EtherCAT-Kommando.
    82    EtherCAT-Kommando.
    83 */
    83 */
    84 
    84 
    85 typedef struct
    85 typedef struct
    86 {
    86 {
    87     struct list_head list; /**< Nötig für Liste */
    87     struct list_head list; /**< Kommando-Listeneintrag */
       
    88     struct list_head queue; /**< Master-Kommando-Queue */
    88     ec_command_type_t type; /**< Typ des Kommandos (APRD, NPWR, etc) */
    89     ec_command_type_t type; /**< Typ des Kommandos (APRD, NPWR, etc) */
    89     ec_address_t address; /**< Adresse des/der Empfänger */
    90     ec_address_t address; /**< Adresse des/der Empfänger */
    90     uint8_t data[EC_MAX_DATA_SIZE]; /**< Kommandodaten */
    91     uint8_t *data; /**< Kommandodaten */
       
    92     size_t mem_size; /**< Größe des Speichers */
    91     size_t data_size; /**< Länge der zu sendenden und/oder empfangenen Daten */
    93     size_t data_size; /**< Länge der zu sendenden und/oder empfangenen Daten */
    92     uint8_t index; /**< Kommando-Index, wird vom Master beim Senden gesetzt. */
    94     uint8_t index; /**< Kommando-Index, wird vom Master beim Senden gesetzt. */
    93     uint16_t working_counter; /**< Working-Counter */
    95     uint16_t working_counter; /**< Working-Counter */
    94     ec_command_state_t state; /**< Zustand */
    96     ec_command_state_t state; /**< Zustand */
    95 }
    97 }
    96 ec_command_t;
    98 ec_command_t;
    97 
    99 
    98 /*****************************************************************************/
   100 /*****************************************************************************/
    99 
   101 
   100 void ec_command_init_nprd(ec_command_t *, uint16_t, uint16_t, size_t);
   102 void ec_command_init(ec_command_t *);
   101 void ec_command_init_npwr(ec_command_t *, uint16_t, uint16_t, size_t,
   103 void ec_command_clear(ec_command_t *);
   102                           const uint8_t *);
   104 
   103 void ec_command_init_aprd(ec_command_t *, uint16_t, uint16_t, size_t);
   105 int ec_command_nprd(ec_command_t *, uint16_t, uint16_t, size_t);
   104 void ec_command_init_apwr(ec_command_t *, uint16_t, uint16_t, size_t,
   106 int ec_command_npwr(ec_command_t *, uint16_t, uint16_t, size_t);
   105                           const uint8_t *);
   107 int ec_command_aprd(ec_command_t *, uint16_t, uint16_t, size_t);
   106 void ec_command_init_brd(ec_command_t *, uint16_t, size_t);
   108 int ec_command_apwr(ec_command_t *, uint16_t, uint16_t, size_t);
   107 void ec_command_init_bwr(ec_command_t *, uint16_t, size_t, const uint8_t *);
   109 int ec_command_brd(ec_command_t *, uint16_t, size_t);
   108 void ec_command_init_lrw(ec_command_t *, uint32_t, size_t, uint8_t *);
   110 int ec_command_bwr(ec_command_t *, uint16_t, size_t);
       
   111 int ec_command_lrw(ec_command_t *, uint32_t, size_t);
   109 
   112 
   110 /*****************************************************************************/
   113 /*****************************************************************************/
   111 
   114 
   112 #endif
   115 #endif
   113 
   116