--- a/master/datagram.c Thu Sep 06 14:40:10 2012 +0200
+++ b/master/datagram.c Thu Sep 06 18:28:57 2012 +0200
@@ -88,6 +88,7 @@
void ec_datagram_init(ec_datagram_t *datagram /**< EtherCAT datagram. */)
{
INIT_LIST_HEAD(&datagram->queue); // mark as unqueued
+ datagram->device_index = EC_DEVICE_MAIN;
datagram->type = EC_DATAGRAM_NONE;
memset(datagram->address, 0x00, EC_ADDR_LEN);
datagram->data = NULL;
@@ -427,12 +428,69 @@
/** Initializes an EtherCAT LRD datagram.
*
+ * \return Return value of ec_datagram_prealloc().
+ */
+int ec_datagram_lrd(
+ ec_datagram_t *datagram, /**< EtherCAT datagram. */
+ uint32_t offset, /**< Logical address. */
+ size_t data_size /**< Number of bytes to read/write. */
+ )
+{
+ int ret;
+ EC_FUNC_HEADER;
+ datagram->type = EC_DATAGRAM_LRD;
+ EC_WRITE_U32(datagram->address, offset);
+ EC_FUNC_FOOTER;
+}
+
+/*****************************************************************************/
+
+/** Initializes an EtherCAT LWR datagram.
+ *
+ * \return Return value of ec_datagram_prealloc().
+ */
+int ec_datagram_lwr(
+ ec_datagram_t *datagram, /**< EtherCAT datagram. */
+ uint32_t offset, /**< Logical address. */
+ size_t data_size /**< Number of bytes to read/write. */
+ )
+{
+ int ret;
+ EC_FUNC_HEADER;
+ datagram->type = EC_DATAGRAM_LWR;
+ EC_WRITE_U32(datagram->address, offset);
+ EC_FUNC_FOOTER;
+}
+
+/*****************************************************************************/
+
+/** Initializes an EtherCAT LRW datagram.
+ *
+ * \return Return value of ec_datagram_prealloc().
+ */
+int ec_datagram_lrw(
+ ec_datagram_t *datagram, /**< EtherCAT datagram. */
+ uint32_t offset, /**< Logical address. */
+ size_t data_size /**< Number of bytes to read/write. */
+ )
+{
+ int ret;
+ EC_FUNC_HEADER;
+ datagram->type = EC_DATAGRAM_LRW;
+ EC_WRITE_U32(datagram->address, offset);
+ EC_FUNC_FOOTER;
+}
+
+/*****************************************************************************/
+
+/** Initializes an EtherCAT LRD datagram with external memory.
+ *
* \attention It is assumed, that the external memory is at least \a data_size
* bytes large.
*
* \return Return value of ec_datagram_prealloc().
*/
-int ec_datagram_lrd(
+int ec_datagram_lrd_ext(
ec_datagram_t *datagram, /**< EtherCAT datagram. */
uint32_t offset, /**< Logical address. */
size_t data_size, /**< Number of bytes to read/write. */
@@ -450,14 +508,14 @@
/*****************************************************************************/
-/** Initializes an EtherCAT LWR datagram.
+/** Initializes an EtherCAT LWR datagram with external memory.
*
* \attention It is assumed, that the external memory is at least \a data_size
* bytes large.
*
* \return Return value of ec_datagram_prealloc().
*/
-int ec_datagram_lwr(
+int ec_datagram_lwr_ext(
ec_datagram_t *datagram, /**< EtherCAT datagram. */
uint32_t offset, /**< Logical address. */
size_t data_size, /**< Number of bytes to read/write. */
@@ -475,14 +533,14 @@
/*****************************************************************************/
-/** Initializes an EtherCAT LRW datagram.
+/** Initializes an EtherCAT LRW datagram with external memory.
*
* \attention It is assumed, that the external memory is at least \a data_size
* bytes large.
*
* \return Return value of ec_datagram_prealloc().
*/
-int ec_datagram_lrw(
+int ec_datagram_lrw_ext(
ec_datagram_t *datagram, /**< EtherCAT datagram. */
uint32_t offset, /**< Logical address. */
size_t data_size, /**< Number of bytes to read/write. */