master/datagram.c
branchredundancy
changeset 2269 1d0711235a61
parent 2268 5e1d3c9430e0
child 2421 bc2d4bf9cbe5
equal deleted inserted replaced
2268:5e1d3c9430e0 2269:1d0711235a61
   426 
   426 
   427 /*****************************************************************************/
   427 /*****************************************************************************/
   428 
   428 
   429 /** Initializes an EtherCAT LRD datagram.
   429 /** Initializes an EtherCAT LRD datagram.
   430  *
   430  *
       
   431  * \return Return value of ec_datagram_prealloc().
       
   432  */
       
   433 int ec_datagram_lrd(
       
   434         ec_datagram_t *datagram, /**< EtherCAT datagram. */
       
   435         uint32_t offset, /**< Logical address. */
       
   436         size_t data_size /**< Number of bytes to read/write. */
       
   437         )
       
   438 {
       
   439     int ret;
       
   440     EC_FUNC_HEADER;
       
   441     datagram->type = EC_DATAGRAM_LRD;
       
   442     EC_WRITE_U32(datagram->address, offset);
       
   443     EC_FUNC_FOOTER;
       
   444 }
       
   445 
       
   446 /*****************************************************************************/
       
   447 
       
   448 /** Initializes an EtherCAT LWR datagram.
       
   449  *
       
   450  * \return Return value of ec_datagram_prealloc().
       
   451  */
       
   452 int ec_datagram_lwr(
       
   453         ec_datagram_t *datagram, /**< EtherCAT datagram. */
       
   454         uint32_t offset, /**< Logical address. */
       
   455         size_t data_size /**< Number of bytes to read/write. */
       
   456         )
       
   457 {
       
   458     int ret;
       
   459     EC_FUNC_HEADER;
       
   460     datagram->type = EC_DATAGRAM_LWR;
       
   461     EC_WRITE_U32(datagram->address, offset);
       
   462     EC_FUNC_FOOTER;
       
   463 }
       
   464 
       
   465 /*****************************************************************************/
       
   466 
       
   467 /** Initializes an EtherCAT LRW datagram.
       
   468  *
       
   469  * \return Return value of ec_datagram_prealloc().
       
   470  */
       
   471 int ec_datagram_lrw(
       
   472         ec_datagram_t *datagram, /**< EtherCAT datagram. */
       
   473         uint32_t offset, /**< Logical address. */
       
   474         size_t data_size /**< Number of bytes to read/write. */
       
   475         )
       
   476 {
       
   477     int ret;
       
   478     EC_FUNC_HEADER;
       
   479     datagram->type = EC_DATAGRAM_LRW;
       
   480     EC_WRITE_U32(datagram->address, offset);
       
   481     EC_FUNC_FOOTER;
       
   482 }
       
   483 
       
   484 /*****************************************************************************/
       
   485 
       
   486 /** Initializes an EtherCAT LRD datagram with external memory.
       
   487  *
   431  * \attention It is assumed, that the external memory is at least \a data_size
   488  * \attention It is assumed, that the external memory is at least \a data_size
   432  *            bytes large.
   489  *            bytes large.
   433  *
   490  *
   434  * \return Return value of ec_datagram_prealloc().
   491  * \return Return value of ec_datagram_prealloc().
   435  */
   492  */
   436 int ec_datagram_lrd(
   493 int ec_datagram_lrd_ext(
   437         ec_datagram_t *datagram, /**< EtherCAT datagram. */
   494         ec_datagram_t *datagram, /**< EtherCAT datagram. */
   438         uint32_t offset, /**< Logical address. */
   495         uint32_t offset, /**< Logical address. */
   439         size_t data_size, /**< Number of bytes to read/write. */
   496         size_t data_size, /**< Number of bytes to read/write. */
   440         uint8_t *external_memory /**< Pointer to the memory to use. */
   497         uint8_t *external_memory /**< Pointer to the memory to use. */
   441         )
   498         )
   449     EC_FUNC_FOOTER;
   506     EC_FUNC_FOOTER;
   450 }
   507 }
   451 
   508 
   452 /*****************************************************************************/
   509 /*****************************************************************************/
   453 
   510 
   454 /** Initializes an EtherCAT LWR datagram.
   511 /** Initializes an EtherCAT LWR datagram with external memory.
   455  *
   512  *
   456  * \attention It is assumed, that the external memory is at least \a data_size
   513  * \attention It is assumed, that the external memory is at least \a data_size
   457  *            bytes large.
   514  *            bytes large.
   458  *
   515  *
   459  * \return Return value of ec_datagram_prealloc().
   516  * \return Return value of ec_datagram_prealloc().
   460  */
   517  */
   461 int ec_datagram_lwr(
   518 int ec_datagram_lwr_ext(
   462         ec_datagram_t *datagram, /**< EtherCAT datagram. */
   519         ec_datagram_t *datagram, /**< EtherCAT datagram. */
   463         uint32_t offset, /**< Logical address. */
   520         uint32_t offset, /**< Logical address. */
   464         size_t data_size, /**< Number of bytes to read/write. */
   521         size_t data_size, /**< Number of bytes to read/write. */
   465         uint8_t *external_memory /**< Pointer to the memory to use. */
   522         uint8_t *external_memory /**< Pointer to the memory to use. */
   466         )
   523         )
   474     EC_FUNC_FOOTER;
   531     EC_FUNC_FOOTER;
   475 }
   532 }
   476 
   533 
   477 /*****************************************************************************/
   534 /*****************************************************************************/
   478 
   535 
   479 /** Initializes an EtherCAT LRW datagram.
   536 /** Initializes an EtherCAT LRW datagram with external memory.
   480  *
   537  *
   481  * \attention It is assumed, that the external memory is at least \a data_size
   538  * \attention It is assumed, that the external memory is at least \a data_size
   482  *            bytes large.
   539  *            bytes large.
   483  *
   540  *
   484  * \return Return value of ec_datagram_prealloc().
   541  * \return Return value of ec_datagram_prealloc().
   485  */
   542  */
   486 int ec_datagram_lrw(
   543 int ec_datagram_lrw_ext(
   487         ec_datagram_t *datagram, /**< EtherCAT datagram. */
   544         ec_datagram_t *datagram, /**< EtherCAT datagram. */
   488         uint32_t offset, /**< Logical address. */
   545         uint32_t offset, /**< Logical address. */
   489         size_t data_size, /**< Number of bytes to read/write. */
   546         size_t data_size, /**< Number of bytes to read/write. */
   490         uint8_t *external_memory /**< Pointer to the memory to use. */
   547         uint8_t *external_memory /**< Pointer to the memory to use. */
   491         )
   548         )