examples/mini/mini.c
changeset 1061 90c3d75057e4
parent 1027 9d37c6d3c80b
child 1080 088a61306930
equal deleted inserted replaced
1060:5e51425da89f 1061:90c3d75057e4
   100     {0x3102, 1,  8}, // status
   100     {0x3102, 1,  8}, // status
   101     {0x3102, 2, 16}  // value
   101     {0x3102, 2, 16}  // value
   102 };
   102 };
   103 
   103 
   104 static ec_pdo_info_t el3162_pdos[] = {
   104 static ec_pdo_info_t el3162_pdos[] = {
   105     {EC_DIR_INPUT, 0x1A00, 2, el3162_channel1},
   105     {0x1A00, 2, el3162_channel1},
   106     {EC_DIR_INPUT, 0x1A01, 2, el3162_channel2},
   106     {0x1A01, 2, el3162_channel2}
   107     {EC_END}
   107 };
       
   108 
       
   109 static ec_sync_info_t el3162_syncs[] = {
       
   110     {2, EC_DIR_OUTPUT},
       
   111     {3, EC_DIR_INPUT, 2, el3162_pdos},
       
   112     {0xff}
   108 };
   113 };
   109 
   114 
   110 static ec_pdo_entry_info_t el2004_channels[] = {
   115 static ec_pdo_entry_info_t el2004_channels[] = {
   111     {0x3001, 1, 1}, // Value 1
   116     {0x3001, 1, 1}, // Value 1
   112     {0x3001, 2, 1}, // Value 2
   117     {0x3001, 2, 1}, // Value 2
   113     {0x3001, 3, 1}, // Value 3
   118     {0x3001, 3, 1}, // Value 3
   114     {0x3001, 4, 1}  // Value 4
   119     {0x3001, 4, 1}  // Value 4
   115 };
   120 };
   116 
   121 
   117 static ec_pdo_info_t el2004_pdos[] = {
   122 static ec_pdo_info_t el2004_pdos[] = {
   118     {EC_DIR_OUTPUT, 0x1600, 1, &el2004_channels[0]},
   123     {0x1600, 1, &el2004_channels[0]},
   119     {EC_DIR_OUTPUT, 0x1601, 1, &el2004_channels[1]},
   124     {0x1601, 1, &el2004_channels[1]},
   120     {EC_DIR_OUTPUT, 0x1602, 1, &el2004_channels[2]},
   125     {0x1602, 1, &el2004_channels[2]},
   121     {EC_DIR_OUTPUT, 0x1603, 1, &el2004_channels[3]},
   126     {0x1603, 1, &el2004_channels[3]}
   122     {EC_END}
   127 };
       
   128 
       
   129 static ec_sync_info_t el2004_syncs[] = {
       
   130     {0, EC_DIR_OUTPUT, 4, el2004_pdos},
       
   131     {1, EC_DIR_INPUT},
       
   132     {0xff}
   123 };
   133 };
   124 #endif
   134 #endif
   125 
   135 
   126 /*****************************************************************************/
   136 /*****************************************************************************/
   127 
   137 
   307         goto out_release_master;
   317         goto out_release_master;
   308     }
   318     }
   309 
   319 
   310 #ifdef CONFIGURE_PDOS
   320 #ifdef CONFIGURE_PDOS
   311     printk(KERN_INFO PFX "Configuring Pdos...\n");
   321     printk(KERN_INFO PFX "Configuring Pdos...\n");
   312     if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3162_pdos)) {
   322     if (ecrt_slave_config_sync_managers(sc_ana_in, EC_END, el3162_syncs)) {
   313         printk(KERN_ERR PFX "Failed to configure Pdos.\n");
   323         printk(KERN_ERR PFX "Failed to configure Pdos.\n");
   314         goto out_release_master;
   324         goto out_release_master;
   315     }
   325     }
   316 
   326 
   317     if (!(sc = ecrt_master_slave_config(master, DigOutPos, Beckhoff_EL2004))) {
   327     if (!(sc = ecrt_master_slave_config(master, DigOutPos, Beckhoff_EL2004))) {
   318         printk(KERN_ERR PFX "Failed to get slave configuration.\n");
   328         printk(KERN_ERR PFX "Failed to get slave configuration.\n");
   319         goto out_release_master;
   329         goto out_release_master;
   320     }
   330     }
   321 
   331 
   322     if (ecrt_slave_config_pdos(sc, EC_END, el2004_pdos)) {
   332     if (ecrt_slave_config_sync_managers(sc, EC_END, el2004_syncs)) {
   323         printk(KERN_ERR PFX "Failed to configure Pdos.\n");
   333         printk(KERN_ERR PFX "Failed to configure Pdos.\n");
   324         goto out_release_master;
   334         goto out_release_master;
   325     }
   335     }
   326 #endif
   336 #endif
   327 
   337