include/ecrt.h
changeset 1441 27a8d6f97a95
parent 1438 1d30b96bb04f
child 1448 d7ba0c408a07
equal deleted inserted replaced
1440:1b32fe09c689 1441:27a8d6f97a95
    53  * - Imlemented the Vendor-specific over EtherCAT mailbox protocol. See
    53  * - Imlemented the Vendor-specific over EtherCAT mailbox protocol. See
    54  *   ecrt_slave_config_create_voe_handler().
    54  *   ecrt_slave_config_create_voe_handler().
    55  * - Renamed ec_sdo_request_state_t to ec_request_state_t, because it is also
    55  * - Renamed ec_sdo_request_state_t to ec_request_state_t, because it is also
    56  *   used by VoE handlers.
    56  *   used by VoE handlers.
    57  * - Added ecrt_master_slave() to get information about a certain slave.
    57  * - Added ecrt_master_slave() to get information about a certain slave.
       
    58  * - Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download() methods to
       
    59  *   let an application transfer SDOs before activating the master.
    58  * - Removed 'const' from argument of ecrt_sdo_request_state(), because the
    60  * - Removed 'const' from argument of ecrt_sdo_request_state(), because the
    59  *   userspace library has to modify object internals.
    61  *   userspace library has to modify object internals.
    60  * - Added 64-bit data access macros.
    62  * - Added 64-bit data access macros.
    61  *
    63  *
    62  * @{
    64  * @{
   446         uint16_t position, /**< Slave position. */
   448         uint16_t position, /**< Slave position. */
   447         uint32_t vendor_id, /**< Expected vendor ID. */
   449         uint32_t vendor_id, /**< Expected vendor ID. */
   448         uint32_t product_code /**< Expected product code. */
   450         uint32_t product_code /**< Expected product code. */
   449         );
   451         );
   450 
   452 
       
   453 #ifndef __KERNEL__
       
   454 
   451 /** Obtains slave information.
   455 /** Obtains slave information.
   452  *
   456  *
   453  * Tries to find the slave with the given ring position. The obtained
   457  * Tries to find the slave with the given ring position. The obtained
   454  * information is stored in a structure. No memory is allocated on the heap in
   458  * information is stored in a structure. No memory is allocated on the heap in
   455  * this function.
   459  * this function.
   462         ec_master_t *master, /**< EtherCAT master */
   466         ec_master_t *master, /**< EtherCAT master */
   463         uint16_t position, /**< Slave position. */
   467         uint16_t position, /**< Slave position. */
   464         ec_slave_info_t *slave_info /**< Structure that will output the
   468         ec_slave_info_t *slave_info /**< Structure that will output the
   465                                       information */
   469                                       information */
   466         );
   470         );
       
   471 
       
   472 #endif /* ifndef __KERNEL__ */
   467 
   473 
   468 /** Finishes the configuration phase and prepares for cyclic operation.
   474 /** Finishes the configuration phase and prepares for cyclic operation.
   469  *
   475  *
   470  * This function tells the master that the configuration phase is finished and
   476  * This function tells the master that the configuration phase is finished and
   471  * the realtime operation will begin. The function allocates internal memory
   477  * the realtime operation will begin. The function allocates internal memory
   548  * All slave clocks synchronized to the reference clock.
   554  * All slave clocks synchronized to the reference clock.
   549  */
   555  */
   550 void ecrt_master_sync_slave_clocks(
   556 void ecrt_master_sync_slave_clocks(
   551         ec_master_t *master /**< EtherCAT master. */
   557         ec_master_t *master /**< EtherCAT master. */
   552         );
   558         );
       
   559 
       
   560 #ifndef __KERNEL__
       
   561 
       
   562 /** Executes an SDO write request to download data.
       
   563  *
       
   564  * This function operates aside of the normal way to request SDOs. Before the
       
   565  * activation of the master, these requests are processed by the master state
       
   566  * machine itself. After activation the user has to ensure cyclic processing.
       
   567  *
       
   568  * \retval  0 Success.
       
   569  * \retval -1 An error occured.
       
   570  */
       
   571 int ecrt_slave_sdo_download(
       
   572         ec_master_t* master, /**< EtherCAT master. */
       
   573         uint16_t slave_position, /**< Slave position. */
       
   574         uint16_t index, /**< Index of the SDO. */
       
   575         uint8_t subindex, /**< Subindex of the SDO. */
       
   576         uint8_t *data, /**< Data buffer to download. */
       
   577         size_t data_size, /**< Size of the data buffer. */
       
   578         uint32_t *abort_code /**< Abort code of the SDO download. */
       
   579         );
       
   580 
       
   581 /** Executes a SDO read request to upload data.
       
   582  *
       
   583  * This function operates aside of the normal way to request SDOs. Before the
       
   584  * activation of the master, these requests are processed by the master state
       
   585  * machine itself. After activation the user have to ensure cyclic
       
   586  * processing.
       
   587  *
       
   588  * \retval  0 Success.
       
   589  * \retval -1 Error occured.
       
   590  */
       
   591 int ecrt_slave_sdo_upload(
       
   592         ec_master_t* master, /**< EtherCAT master. */
       
   593         uint16_t slave_position, /**< Slave position. */
       
   594         uint16_t index, /**< Index of the SDO. */
       
   595         uint8_t subindex, /**< Subindex of the SDO. */
       
   596         uint8_t *target, /**< Target buffer for the upload. */
       
   597         size_t target_size, /**< Size of the target buffer. */
       
   598         size_t *result_size, /**< Uploaded data size. */
       
   599         uint32_t *abort_code /**< Abort code of the SDO upload. */
       
   600         );
       
   601 
       
   602 #endif /* ifndef __KERNEL__ */
   553 
   603 
   554 /******************************************************************************
   604 /******************************************************************************
   555  * Slave configuration methods
   605  * Slave configuration methods
   556  *****************************************************************************/
   606  *****************************************************************************/
   557 
   607