--- a/examples/gene_SYNC_HCS12/appli.c Wed Dec 13 14:14:18 2006 +0100
+++ b/examples/gene_SYNC_HCS12/appli.c Wed Dec 13 14:44:27 2006 +0100
@@ -20,7 +20,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
+// Uncomment if you don't need console informations.
#define DEBUG_WAR_CONSOLE_ON
#define DEBUG_ERR_CONSOLE_ON
@@ -31,12 +31,13 @@
#include <asm-m68hc12/ports.h>
#include <interrupt.h>
+#include "../include/data.h"
#include <applicfg.h>
-#include <../include/hcs12/candriver.h>
-
+#include "../include/hcs12/candriver.h"
+#include "../include/hcs12/canOpenDriver.h"
#include "../include/def.h"
#include "../include/can.h"
#include "../include/objdictdef.h"
@@ -47,10 +48,22 @@
#include "../include/lifegrd.h"
#include "../include/sync.h"
-
#include "../include/nmtSlave.h"
#include "objdict.h"
+// Variables defined in the object dictionary (See objdict.c)
+extern UNS16 acceptanceFilter1; // Mapped at index 0x2015, subindex 0x00
+extern UNS16 acceptanceFilter2; // Mapped at index 0x2016, subindex 0x00
+extern UNS16 acceptanceFilter3; // Mapped at index 0x2017, subindex 0x00
+extern UNS16 acceptanceFilter4; // Mapped at index 0x2018, subindex 0x00
+extern UNS16 mask1; // Mapped at index 0x2019, subindex 0x00
+extern UNS16 mask2; // Mapped at index 0x2020, subindex 0x00
+extern UNS16 mask3; // Mapped at index 0x2021, subindex 0x00
+extern UNS16 mask4; // Mapped at index 0x2022, subindex 0x00
+extern UNS8 applyDownloadedFilters;
+
+
+
// HCS12 configuration
// -----------------------------------------------------
@@ -131,11 +144,22 @@
/**************************prototypes*****************************************/
-//fonction d'initialisation du bus can et la couche CANOPEN pour le capteur
+//Init can bus and Canopen
void initCanopencapteur (void);
-// les fonctions d'initialisation du capteur: timer, compteurs logiciel
+// Init the sensor
void initSensor(void);
void initPortB(void);
+void initPortH(void);
+
+// Functions needed by Canfestival
+// Notice that gene_SYNC is the name of the sensor defined in python GUI.
+// Do not change it !.
+void gene_SYNC_initialisation(void);
+void gene_SYNC_preOperational(void);
+void gene_SYNC_operational(void);
+void gene_SYNC_stopped(void);
+void gene_SYNC_post_sync(void);
+
//------------------------------------------------------------------------------
//Initialisation of the port B for the leds.
@@ -147,18 +171,41 @@
IO_PORTS_8(PORTB) = 0xFF;
}
-
+//------------------------------------------------------------------------------
+// Init of port H to choose the CAN rate by switch, and the nodeId
+void initPortH(void)
+{
+ // Port H is input
+ IO_PORTS_8(DDRH)= 0X00;
+ // Enable pull device
+ IO_PORTS_8(PERH) = 0XFF;
+ // Choose the pull-up device
+ IO_PORTS_8(PPSH) = 0X00;
+}
//------------------------------------------------------------------------------
void initSensor(void)
{
- UNS8 baudrate = 0;
- MSG_WAR(0x3F33, "I am the node : ", getNodeId(&gene_SYNC_Data));
+ UNS8 baudrate = 0;
+ UNS8 nodeId = 0;
// Init led control
initPortB();
IO_PORTS_8(PORTB) &= ~ 0x01; //One led ON
- // Init port to choose se CAN baudrate by switch
- IO_PORTS_8(ATD0DIEN) = 0x03;
+ initPortH();
+
+ /* Defining the node Id */
+ // Uncomment to have a fixed nodeId
+ //setNodeId(&gene_SYNC_Data, 0x03);
+
+ // Comment below to have a fixed nodeId
+ nodeId = ~(IO_PORTS_8(PTH)) & 0x3F;
+ if (nodeId == 0) {
+ MSG_WAR(0x3F33, "Using default nodeId : ", getNodeId(&gene_SYNC_Data));
+ }
+ else
+ setNodeId(&gene_SYNC_Data, nodeId);
+
+ MSG_WAR(0x3F33, "My nodeId is : ", getNodeId(&gene_SYNC_Data));
canBusInit bi0 = {
0, /* no low power */
@@ -185,26 +232,38 @@
//Init the HCS12 microcontroler for CanOpen
initHCS12();
- // Chose the CAN rate
- baudrate = IO_PORTS_8(PORTAD0) & 0x03;
+ // Chose the CAN rate (On our board, whe have switch for all purpose)
+ // 7 8
+ // ON ON => 1000 kpbs
+ // OFF ON => 500 kpbs
+ // ON OFF => 250 kpbs
+
+ baudrate = ~(IO_PORTS_8(PTH)) & 0xC0;
+
+ // Uncomment to have a fixed baudrate of 250 kbps
+ //baudrate = 1;
+
switch (baudrate) {
- case 1:
+ case 0x40:
bi0.clk = CAN_Baudrates[CAN_BAUDRATE_250K];
MSG_WAR(0x3F30, "CAN 250 kbps ", 0);
break;
- case 2:
+ case 0x80:
bi0.clk = CAN_Baudrates[CAN_BAUDRATE_500K];
MSG_WAR(0x3F31, "CAN 500 kbps ", 0);
break;
- case 3:
+ case 0xC0:
bi0.clk = CAN_Baudrates[CAN_BAUDRATE_1M];
MSG_WAR(0x3F31, "CAN 1000 kbps ", 0);
break;
default:
- MSG_WAR(0x2F32, "CAN BAUD RATE NOT DEFINED ", 0);
+ bi0.clk = CAN_Baudrates[CAN_BAUDRATE_1M];
+ MSG_WAR(0x2F32, "CAN BAUD RATE NOT DEFINED => 250 kbps ", 0);
}
- MSG_WAR(0x3F33, "SYNC signal generator", 0);
+
+
+ MSG_WAR(0x3F33, "SYNC signal generator ", 0);
canInit(CANOPEN_LINE_NUMBER_USED, bi0); //initialize filters...
initTimer(); // Init hcs12 timer used by CanFestival. (see timerhw.c)
@@ -244,9 +303,11 @@
void gene_SYNC_initialisation()
{
MSG_WAR (0x3F00, "Entering in INIT ", 0);
- initSensor();
+ initSensor();
+
IO_PORTS_8(PORTB) &= ~ 0x01; // led 0 : ON
IO_PORTS_8(PORTB) |= 0x0E; // leds 1, 2, 3 : OFF
+
}
@@ -256,6 +317,27 @@
MSG_WAR (0x3F01, "Entering in PRE-OPERATIONAL ", 0);
IO_PORTS_8(PORTB) &= ~ 0x03; // leds 0, 1 : ON
IO_PORTS_8(PORTB) |= 0x0C; // leds 2, 3 : OFF
+ /* default values for the msg CAN filters */
+ /* Accept all */
+ {
+ canBusFilterInit filterConfiguration =
+ {
+ 0x01, /* Filter on 16 bits. See Motorola Block Guide V02.14 */
+ /*canidarx, canidmrx */
+ 0x00, 0xFF, /* filter 0 */
+ 0x00, 0xFF, /* filter 0 */
+ 0x00, 0xFF, /* filter 1 */
+ 0x00, 0xFF, /* filter 1 */
+ 0x00, 0xFF, /* filter 2 */
+ 0x00, 0xFF, /* filter 2 */
+ 0x00, 0xFF, /* filter 3 */
+ 0x00, 0xFF, /* filter 3 */
+ };
+ canChangeFilter(CANOPEN_LINE_NUMBER_USED, filterConfiguration);
+ }
+ // Reset the automatic change by SDO
+ applyDownloadedFilters = 0;
+
}
@@ -265,12 +347,59 @@
MSG_WAR (0x3F02, "Entering in OPERATIONAL ", 0);
IO_PORTS_8(PORTB) &= ~ 0x07; // leds 0, 1, 2 : ON
IO_PORTS_8(PORTB) |= 0x08; // leds 3 : OFF
+
+ // Filtering the CAN received msgs.
+ // 2 ways
+ // First :applying an automatic filter
+ // Second : The values of the filtering registers are mapped in the object dictionary,
+ // So that a filtering configuration can be downloaded by SDO in pre-operational mode
+
+ if (applyDownloadedFilters == 0) {// No downloaded configuration to apply
+ UNS16 accept1 = 0x0000; // Accept NMT
+ UNS16 mask1 = 0x0FFF; // Mask NMT
+ UNS16 accept2 = 0xE000; // Accept NMT error control (heartbeat, nodeguard)
+ UNS16 mask2 = 0x0FFF; // Mask NMT error control (heartbeat, nodeguard)
+
+ canBusFilterInit filterConfiguration =
+ {// filters 3 and 4 not used, so configured like filter 1.
+ 0x01, /* Filter on 16 bits. See Motorola Block Guide V02.14 */
+ /*canidarx, canidmrx */
+ (UNS8)(accept1 >> 8), (UNS8)(mask1 >> 8), /* filter 1 id10...3*/
+ (UNS8)accept1 , (UNS8)mask1, /* filter 1 id2 ... */
+ (UNS8)(accept2 >> 8), (UNS8)(mask2 >> 8), /* filter 2 id10...3*/
+ (UNS8)accept2 , (UNS8)mask2, /* filter 2 id2 ... */
+ (UNS8)(accept1 >> 8), (UNS8)(mask1 >> 8), /* filter 3 id10...3*/
+ (UNS8)accept1 , (UNS8)mask1, /* filter 3 id2 ... */
+ (UNS8)(accept1 >> 8), (UNS8)(mask1 >> 8), /* filter 4 id10...3*/
+ (UNS8)accept1 , (UNS8)mask1 /* filter 4 id2 ... */
+ };
+ canChangeFilter(CANOPEN_LINE_NUMBER_USED, filterConfiguration);
+ MSG_WAR (0x3F03, "Internal CAN Rcv filter applied ", 0);
+ }
+ else { // Apply filters downnloaded
+ canBusFilterInit filterConfiguration =
+ {// filters 3 and 4 not used, so configured like filter 1.
+ 0x01, /* Filter on 16 bits. See Motorola Block Guide V02.14 */
+ /*canidarx, canidmrx */
+ (UNS8)( acceptanceFilter1>> 8), (UNS8)(mask1 >> 8), /* filter 1 id10...3*/
+ (UNS8)acceptanceFilter1 , (UNS8)mask1, /* filter 1 id2 ... */
+ (UNS8)(acceptanceFilter2 >> 8), (UNS8)(mask2 >> 8), /* filter 2 id10...3*/
+ (UNS8)acceptanceFilter2 , (UNS8)mask2, /* filter 2 id2 ... */
+ (UNS8)(acceptanceFilter3 >> 8), (UNS8)(mask3 >> 8), /* filter 3 id10...3*/
+ (UNS8)acceptanceFilter3 , (UNS8)mask3, /* filter 3 id2 ... */
+ (UNS8)(acceptanceFilter4 >> 8), (UNS8)(mask4 >> 8), /* filter 4 id10...3*/
+ (UNS8)acceptanceFilter4 , (UNS8)mask4 /* filter 4 id2 ... */
+ };
+ canChangeFilter(CANOPEN_LINE_NUMBER_USED, filterConfiguration);
+ MSG_WAR (0x3F04, "Downloaded CAN Rcv filter applied ", 0);
+ }
}
//------------------------------------------------------------------------------
void gene_SYNC_stopped()
{
MSG_WAR (0x3F02, "Entering in STOPPED ", 0);
+ IO_PORTS_8(PORTB) |= 0x0E; // leds 1, 2, 3, 4 : OFF
}
//------------------------------------------------------------------------------
@@ -295,13 +424,11 @@
UNS8 main (void)
{
- MSG_WAR(0x3F34, "Entering in the main", 0);
+ MSG_WAR(0x3F34, "Entering in the main ", 0);
//----------------------------- INITIALISATION --------------------------------
- /* Defining the node Id */
- setNodeId(&gene_SYNC_Data, 0x03);
-
+
/* Put the node in Initialisation mode */
- MSG_WAR(0x3F35, "va passer en init", 0);
+ MSG_WAR(0x3F35, "Will entering in INIT ", 0);
setState(&gene_SYNC_Data, Initialisation);
//----------------------------- START -----------------------------------------
@@ -309,18 +436,14 @@
//MSG_WAR(0x3F36, "va passer en pre-op", 0);
//setState(&gene_SYNC_Data, Pre_operational);
- while (1) {
- {
+ // Loop of receiving messages
+ while (1) {
Message m;
if (f_can_receive(0, &m)) {
- MSG_WAR(0x3F36, "Msg received", m.cob_id.w);
+ //MSG_WAR(0x3F36, "Msg received", m.cob_id.w);
canDispatch(&gene_SYNC_Data, &m);
- }
-
-
- }
-
- }
+ }
+ }
return (0);
}
--- a/examples/gene_SYNC_HCS12/objdict.c Wed Dec 13 14:14:18 2006 +0100
+++ b/examples/gene_SYNC_HCS12/objdict.c Wed Dec 13 14:44:27 2006 +0100
@@ -20,211 +20,254 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+/* File generated by gen_cfile.py. Should not be modified. */
+
#include "objdict.h"
/**************************************************************************/
/* Declaration of the mapped variables */
/**************************************************************************/
+UNS16 acceptanceFilter1 = 0x0; // Mapped at index 0x2015, subindex 0x00
+UNS16 acceptanceFilter2 = 0x0; // Mapped at index 0x2016, subindex 0x00
+UNS16 acceptanceFilter3 = 0x0; // Mapped at index 0x2017, subindex 0x00
+UNS16 acceptanceFilter4 = 0x0; // Mapped at index 0x2018, subindex 0x00
+UNS16 mask1 = 0x0; // Mapped at index 0x2019, subindex 0x00
+UNS16 mask2 = 0x0; // Mapped at index 0x2020, subindex 0x00
+UNS16 mask3 = 0x0; // Mapped at index 0x2021, subindex 0x00
+UNS16 mask4 = 0x0; // Mapped at index 0x2022, subindex 0x00
+UNS8 applyDownloadedFilters = 0x0; // Mapped at index 0x2023, subindex 0x00
/**************************************************************************/
/* Declaration of the value range types */
/**************************************************************************/
-
-
-UNS32 gene_SYNC_valueRangeTest (UNS8 typeValue, UNS32 unsValue, REAL32 realValue)
+UNS32 gene_SYNC_valueRangeTest (UNS8 typeValue, void * value)
{
switch (typeValue) {
}
return 0;
}
-
/**************************************************************************/
/* The node id */
/**************************************************************************/
-/* node_id default value.
- This default value is deprecated.
- You should always overwrite this by using the function setNodeId(UNS8 nodeId) in your C code.
-*/
-#define NODE_ID 0x03
-UNS8 gene_SYNC_bDeviceNodeId = NODE_ID;
-
+/* node_id default value.*/
+UNS8 gene_SYNC_bDeviceNodeId = 0x03;
//*****************************************************************************/
/* Array of message processing information */
-/* Should not be modified */
const UNS8 gene_SYNC_iam_a_slave = 1;
- // Macros definition
-
-/* Beware :
-index *must* be writen 4 numbers in hexa
-sub_index *must* be writen 2 numbers in hexa
-size_variable_in_UNS8 *must* be writen 2 numbers in hexa
-*/
-#define PDO_MAP(index, sub_index, size_variable_in_bits)\
-0x ## index ## sub_index ## size_variable_in_bits
-
-/** This macro helps creating the object dictionary entries.
- * by calling this macro
- * it creates an entry in form of: 7 of entries, pointer to the entry.
- */
-#define DeclareIndexTableEntry(entryname, index) { (subindex*)entryname,sizeof(entryname)/sizeof(entryname[0]), index}
+TIMER_HANDLE gene_SYNC_heartBeatTimers[0];
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//
// OBJECT DICTIONARY
//
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
-// Make your change, depending of your application
-
-
-/* index 0x1000 : Device type.
- You have to change the value below, so
- it fits your canopen-slave-module */
-
- /* Not used, so, should not be modified */
-
- UNS32 gene_SYNC_obj1000 = 0;
- subindex gene_SYNC_Index1000[] =
- {
- { RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1000 }
- };
-
-/* index 0x1001 : Error register.
- Change the entries to fit your application
- Not used, so, should not be modified */
- UNS8 gene_SYNC_obj1001 = 0x00000000;
- subindex gene_SYNC_Index1001[] =
- {
- { RO, uint8, sizeof(UNS8), (void*)&gene_SYNC_obj1001 }
- };
-
-/* index 0x1005 : COB_ID SYNC */
- /* Should not be modified */
- UNS32 gene_SYNC_obj1005 = 0x40000080; // bit 30 = 1 : device can generate a SYNC message
- // Beware, it is over written when the node
- // enters in reset mode
- // See initResetMode() in init.c
- subindex gene_SYNC_Index1005[] =
- {
- { RW, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1005 }
- };
-
-/* index 0x1006 : SYNC period */
- // For producing the SYNC signal every n micro-seconds.
- // Put 0 to not producing SYNC
- UNS32 gene_SYNC_obj1006 = 0x000186A0;
- // Default 0 to not produce SYNC //
- // Beware, it is over written when the
- // node enters in reset mode.
- // See initResetMode() in init.c
- subindex gene_SYNC_Index1006[] =
- {
- { RW, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1006 }
- };
-
-
- TIMER_HANDLE gene_SYNC_heartBeatTimers[0];
- UNS32 gene_SYNC_obj1016[0];
- UNS8 gene_SYNC_obj1016_cnt = 0;
+
+/* index 0x1000 : Device Type. */
+ UNS32 gene_SYNC_obj1000 = 0x0; // 0
+ subindex gene_SYNC_Index1000[] =
+ {
+ { RO, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1000 }
+ };
+
+/* index 0x1001 : Error Register. */
+ UNS8 gene_SYNC_obj1001 = 0x0; // 0
+ subindex gene_SYNC_Index1001[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&gene_SYNC_obj1001 }
+ };
+
+/* index 0x1005 : SYNC COB ID. */
+ UNS32 gene_SYNC_obj1005 = 0x40000080; // 1073741952
+ ODCallback_t gene_SYNC_Index1005_callbacks[] =
+ {
+ NULL,
+ };
+ subindex gene_SYNC_Index1005[] =
+ {
+ { RW, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1005 }
+ };
+
+/* index 0x1006 : Communication / Cycle Period. */
+ UNS32 gene_SYNC_obj1006 = 0x2710; // 10000
+ ODCallback_t gene_SYNC_Index1006_callbacks[] =
+ {
+ NULL,
+ };
+ subindex gene_SYNC_Index1006[] =
+ {
+ { RW, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1006 }
+ };
+
+/* index 0x1008 : Manufacturer Device Name. */
+ UNS8 gene_SYNC_obj1008[10] = "GENE_SYNC";
+ subindex gene_SYNC_Index1008[] =
+ {
+ { RO, visible_string, sizeof (gene_SYNC_obj1008), (void*)&gene_SYNC_obj1008 }
+ };
+
+/* index 0x1016 : Consumer Heartbeat Time */
+ UNS8 gene_SYNC_highestSubIndex_obj1016 = 0;
+ UNS32 gene_SYNC_obj1016[0];
subindex gene_SYNC_Index1016[0];
- UNS16 gene_SYNC_obj1017 = 0x0000;
-/* index 0x1018 : Identity object */
- /** index 1018: identify object. Adjust the entries for your node/company
- */
- /* Values can be modified */
-
- s_identity gene_SYNC_obj1018 =
- {
- 4, // number of supported entries
- 0, // Vendor-ID (given by the can-cia)
- 0, // Product Code
- 0, // Revision number
- 0 // serial number
- };
-
- subindex gene_SYNC_Index1018[] =
- {
- { RO, uint8, sizeof(UNS8), (void*)&gene_SYNC_obj1018.count },
- { RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.vendor_id},
- { RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.product_code},
- { RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.revision_number},
- { RO, uint32, sizeof(UNS32), (void*)&gene_SYNC_obj1018.serial_number}
- };
-
-/* index 0x1200 : The SDO Server parameters */
- /* BEWARE You cannot define more than one SDO server */
- /* The values should not be modified here,
- but can be changed at runtime */
- // Beware that the default values that you could put here
- // will be over written at the initialisation of the node.
- // See setNodeId() in init.c
- s_sdo_parameter gene_SYNC_obj1200 =
- { 3, // Number of entries. Always 3 for the SDO
- 0x000, // The cob_id transmited in CAN msg to the server
- 0x000, // The cob_id received in CAN msg from the server
- 0x03 // The node id of the client. Should not be modified
- };
- subindex gene_SYNC_Index1200[] =
- {
- { RO, uint8, sizeof( UNS8 ), (void*)&gene_SYNC_obj1200.count },
- { RO, uint32, sizeof( UNS32), (void*)&gene_SYNC_obj1200.cob_id_client },
- { RO, uint32, sizeof( UNS32), (void*)&gene_SYNC_obj1200.cob_id_server },
- { RW, uint8, sizeof( UNS8), (void*)&gene_SYNC_obj1200.node_id }
- };
-
-/* index 0x1280 : SDO client parameter */
- s_sdo_parameter gene_SYNC_obj1280 =
- { 3, // Nb of entries
- 0x000, // cobid transmited to the server. The good value should be 0x600 + server nodeId
- 0x000, // cobid received from the server. The good value should be 0x580 + server nodeId
- 0x00 // server NodeId
- };
- subindex gene_SYNC_Index1280[] =
- {
- { RO, uint8, sizeof( UNS8 ), (void*)&gene_SYNC_obj1280.count },
- { RW, uint8, sizeof( UNS32 ), (void*)&gene_SYNC_obj1280.cob_id_client },
- { RW, uint8, sizeof( UNS32 ), (void*)&gene_SYNC_obj1280.cob_id_server },
- { RW, uint8, sizeof( UNS8 ), (void*)&gene_SYNC_obj1280.node_id }
- };
-
+/* index 0x1017 : Producer Heartbeat Time */
+ UNS16 gene_SYNC_obj1017 = 0x0; // 0
+
+/* index 0x1018 : Identity. */
+ UNS8 gene_SYNC_highestSubIndex_obj1018 = 4; // number of subindex - 1
+ UNS32 gene_SYNC_obj1018_Vendor_ID = 0x0; // 0
+ UNS32 gene_SYNC_obj1018_Product_Code = 0x0; // 0
+ UNS32 gene_SYNC_obj1018_Revision_Number = 0x0; // 0
+ UNS32 gene_SYNC_obj1018_Serial_Number = 0x0; // 0
+ subindex gene_SYNC_Index1018[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&gene_SYNC_highestSubIndex_obj1018 },
+ { RO, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1018_Vendor_ID },
+ { RO, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1018_Product_Code },
+ { RO, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1018_Revision_Number },
+ { RO, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1018_Serial_Number }
+ };
+
+/* index 0x1200 : Server SDO Parameter. */
+ UNS8 gene_SYNC_highestSubIndex_obj1200 = 2; // number of subindex - 1
+ UNS32 gene_SYNC_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x0; // 0
+ UNS32 gene_SYNC_obj1200_COB_ID_Server_to_Client_Transmit_SDO = 0x0; // 0
+ subindex gene_SYNC_Index1200[] =
+ {
+ { RO, uint8, sizeof (UNS8), (void*)&gene_SYNC_highestSubIndex_obj1200 },
+ { RO, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1200_COB_ID_Client_to_Server_Receive_SDO },
+ { RO, uint32, sizeof (UNS32), (void*)&gene_SYNC_obj1200_COB_ID_Server_to_Client_Transmit_SDO }
+ };
+
+/* index 0x2015 : Mapped variable acceptanceFilter1 */
+ subindex gene_SYNC_Index2015[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&acceptanceFilter1 }
+ };
+
+/* index 0x2016 : Mapped variable acceptanceFilter2 */
+ subindex gene_SYNC_Index2016[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&acceptanceFilter2 }
+ };
+
+/* index 0x2017 : Mapped variable acceptanceFilter3 */
+ subindex gene_SYNC_Index2017[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&acceptanceFilter3 }
+ };
+
+/* index 0x2018 : Mapped variable acceptanceFilter4 */
+ subindex gene_SYNC_Index2018[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&acceptanceFilter4 }
+ };
+
+/* index 0x2019 : Mapped variable mask1 */
+ subindex gene_SYNC_Index2019[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&mask1 }
+ };
+
+/* index 0x2020 : Mapped variable mask2 */
+ subindex gene_SYNC_Index2020[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&mask2 }
+ };
+
+/* index 0x2021 : Mapped variable mask3 */
+ subindex gene_SYNC_Index2021[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&mask3 }
+ };
+
+/* index 0x2022 : Mapped variable mask4 */
+ subindex gene_SYNC_Index2022[] =
+ {
+ { RW, uint16, sizeof (UNS16), (void*)&mask4 }
+ };
+
+/* index 0x2023 : Mapped variable applyDownloadedFilters */
+ subindex gene_SYNC_Index2023[] =
+ {
+ { RW, uint8, sizeof (UNS8), (void*)&applyDownloadedFilters }
+ };
const indextable gene_SYNC_objdict[] =
{
- DeclareIndexTableEntry(gene_SYNC_Index1000, 0x1000),
- DeclareIndexTableEntry(gene_SYNC_Index1001, 0x1001),
- DeclareIndexTableEntry(gene_SYNC_Index1005, 0x1005),
- DeclareIndexTableEntry(gene_SYNC_Index1006, 0x1006),
- DeclareIndexTableEntry(gene_SYNC_Index1018, 0x1018),
- DeclareIndexTableEntry(gene_SYNC_Index1200, 0x1200),
- DeclareIndexTableEntry(gene_SYNC_Index1280, 0x1280),
+ { (subindex*)gene_SYNC_Index1000,sizeof(gene_SYNC_Index1000)/sizeof(gene_SYNC_Index1000[0]), 0x1000},
+ { (subindex*)gene_SYNC_Index1001,sizeof(gene_SYNC_Index1001)/sizeof(gene_SYNC_Index1001[0]), 0x1001},
+ { (subindex*)gene_SYNC_Index1005,sizeof(gene_SYNC_Index1005)/sizeof(gene_SYNC_Index1005[0]), 0x1005},
+ { (subindex*)gene_SYNC_Index1006,sizeof(gene_SYNC_Index1006)/sizeof(gene_SYNC_Index1006[0]), 0x1006},
+ { (subindex*)gene_SYNC_Index1008,sizeof(gene_SYNC_Index1008)/sizeof(gene_SYNC_Index1008[0]), 0x1008},
+ { (subindex*)gene_SYNC_Index1018,sizeof(gene_SYNC_Index1018)/sizeof(gene_SYNC_Index1018[0]), 0x1018},
+ { (subindex*)gene_SYNC_Index1200,sizeof(gene_SYNC_Index1200)/sizeof(gene_SYNC_Index1200[0]), 0x1200},
+ { (subindex*)gene_SYNC_Index2015,sizeof(gene_SYNC_Index2015)/sizeof(gene_SYNC_Index2015[0]), 0x2015},
+ { (subindex*)gene_SYNC_Index2016,sizeof(gene_SYNC_Index2016)/sizeof(gene_SYNC_Index2016[0]), 0x2016},
+ { (subindex*)gene_SYNC_Index2017,sizeof(gene_SYNC_Index2017)/sizeof(gene_SYNC_Index2017[0]), 0x2017},
+ { (subindex*)gene_SYNC_Index2018,sizeof(gene_SYNC_Index2018)/sizeof(gene_SYNC_Index2018[0]), 0x2018},
+ { (subindex*)gene_SYNC_Index2019,sizeof(gene_SYNC_Index2019)/sizeof(gene_SYNC_Index2019[0]), 0x2019},
+ { (subindex*)gene_SYNC_Index2020,sizeof(gene_SYNC_Index2020)/sizeof(gene_SYNC_Index2020[0]), 0x2020},
+ { (subindex*)gene_SYNC_Index2021,sizeof(gene_SYNC_Index2021)/sizeof(gene_SYNC_Index2021[0]), 0x2021},
+ { (subindex*)gene_SYNC_Index2022,sizeof(gene_SYNC_Index2022)/sizeof(gene_SYNC_Index2022[0]), 0x2022},
+ { (subindex*)gene_SYNC_Index2023,sizeof(gene_SYNC_Index2023)/sizeof(gene_SYNC_Index2023[0]), 0x2023},
};
+const indextable * gene_SYNC_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
+{
+ int i;
+ *callbacks = NULL;
+ switch(wIndex){
+ case 0x1000: i = 0;break;
+ case 0x1001: i = 1;break;
+ case 0x1005: i = 2;*callbacks = gene_SYNC_Index1005_callbacks; break;
+ case 0x1006: i = 3;*callbacks = gene_SYNC_Index1006_callbacks; break;
+ case 0x1008: i = 4;break;
+ case 0x1018: i = 5;break;
+ case 0x1200: i = 6;break;
+ case 0x2015: i = 7;break;
+ case 0x2016: i = 8;break;
+ case 0x2017: i = 9;break;
+ case 0x2018: i = 10;break;
+ case 0x2019: i = 11;break;
+ case 0x2020: i = 12;break;
+ case 0x2021: i = 13;break;
+ case 0x2022: i = 14;break;
+ case 0x2023: i = 15;break;
+ default:
+ *errorCode = OD_NO_SUCH_OBJECT;
+ return NULL;
+ }
+ *errorCode = OD_SUCCESSFUL;
+ return &gene_SYNC_objdict[i];
+}
+
// To count at which received SYNC a PDO must be sent.
// Even if no pdoTransmit are defined, at least one entry is computed
// for compilations issues.
-UNS8 gene_SYNC_count_sync[1] = {0, };
+UNS8 gene_SYNC_count_sync[1] = {0,};
quick_index gene_SYNC_firstIndex = {
- SDO_SVR : 5,
- SDO_CLT : 6,
- PDO_RCV : 0,
- PDO_RCV_MAP : 0,
- PDO_TRS : 0,
- PDO_TRS_MAP : 0
+ SDO_SVR : 6,
+ SDO_CLT : 0,
+ PDO_RCV : 0,
+ PDO_RCV_MAP : 0,
+ PDO_TRS : 0,
+ PDO_TRS_MAP : 0
};
quick_index gene_SYNC_lastIndex = {
- SDO_SVR : 5,
- SDO_CLT : 6,
- PDO_RCV : 0,
- PDO_RCV_MAP : 0,
- PDO_TRS : 0,
- PDO_TRS_MAP : 0
+ SDO_SVR : 6,
+ SDO_CLT : 0,
+ PDO_RCV : 0,
+ PDO_RCV_MAP : 0,
+ PDO_TRS : 0,
+ PDO_TRS_MAP : 0
};
UNS16 gene_SYNC_ObjdictSize = sizeof(gene_SYNC_objdict)/sizeof(gene_SYNC_objdict[0]);