From fa8438d3f4e5d791a18641a7496ece2c75d973b8 Mon Sep 17 00:00:00 2001
From: Florian Pose <fp@igh-essen.com>
Date: Tue, 19 Feb 2008 09:21:13 +0000
Subject: [PATCH] Fixed Pdo configuration information providing.

---
 examples/mini/mini.c | 14 ++++++++++++--
 include/ecrt.h       |  4 +++-
 master/pdo_mapping.c |  2 +-
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/examples/mini/mini.c b/examples/mini/mini.c
index ce1ba9cb..93373a22 100644
--- a/examples/mini/mini.c
+++ b/examples/mini/mini.c
@@ -64,9 +64,19 @@ static void *r_outputs;
 #endif
 
 #ifdef MAPPING
+const ec_pdo_entry_info_t el3162_channel1[] = {
+    {0x3101, 1,  8}, // status
+    {0x3101, 2, 16}  // value
+};
+
+const ec_pdo_entry_info_t el3162_channel2[] = {
+    {0x3102, 1,  8}, // status
+    {0x3102, 2, 16}  // value
+};
+
 const ec_pdo_info_t mapping[] = {
-    {EC_DIR_INPUT, 0x1A00}, // channel 1
-    {EC_DIR_INPUT, 0x1A01} // channel 2
+    {EC_DIR_INPUT, 0x1A00, 2, el3162_channel1},
+    {EC_DIR_INPUT, 0x1A01, 2, el3162_channel2},
 };
 #endif
 
diff --git a/include/ecrt.h b/include/ecrt.h
index 8344fcba..e761ba01 100644
--- a/include/ecrt.h
+++ b/include/ecrt.h
@@ -221,7 +221,9 @@ typedef struct {
     unsigned int n_entries; /**< Number of Pdo entries for the Pdo
                               configuration. Zero means, that the default Pdo
                               configuration shall be used. */
-    const ec_pdo_entry_info_t entries[]; /**< Pdo configuration list. */
+    const ec_pdo_entry_info_t *entries; /**< Pdo configuration array. This
+                                          array must contain at least \a
+                                          n_entries values. */
 } ec_pdo_info_t;
 
 /*****************************************************************************/
diff --git a/master/pdo_mapping.c b/master/pdo_mapping.c
index 7c6f383a..c0ae6dee 100644
--- a/master/pdo_mapping.c
+++ b/master/pdo_mapping.c
@@ -185,7 +185,7 @@ int ec_pdo_mapping_add_pdo_info(
     if (config->master->debug_level)
         EC_INFO("Adding Pdo 0x%04X to mapping.\n", pdo->index);
 
-    if (pdo_info->n_entries) { // Pdo configuration provided
+    if (pdo_info->n_entries && pdo_info->entries) { // configuration provided
         if (config->master->debug_level)
             EC_INFO("  Pdo configuration provided.\n");
 
-- 
GitLab