mini/mini.c
changeset 130 69c2645300ee
parent 117 b9976a5281e0
child 135 80d493917205
equal deleted inserted replaced
129:67b6e534db4b 130:69c2645300ee
    27 // EtherCAT
    27 // EtherCAT
    28 ec_master_t *master = NULL;
    28 ec_master_t *master = NULL;
    29 ec_domain_t *domain1 = NULL;
    29 ec_domain_t *domain1 = NULL;
    30 
    30 
    31 // Datenfelder
    31 // Datenfelder
    32 void *r_ssi_input, *r_ssi_status, *r_4102[3];
    32 //void *r_ssi_input, *r_ssi_status, *r_4102[3];
    33 
    33 
    34 // Kanäle
    34 // Kanäle
    35 uint32_t k_pos;
    35 uint32_t k_pos;
    36 uint8_t k_stat;
    36 uint8_t k_stat;
    37 
    37 
    38 ec_field_init_t domain1_fields[] = {
    38 ec_field_init_t domain1_fields[] = {
    39     {NULL, "1", "Beckhoff", "EL1014", "InputValue",  0},
    39     {NULL, "1", "Beckhoff", "EL1014", "InputValue",  0},
    40     {NULL, "2", "Beckhoff", "EL1014", "InputValue", 0},
    40     {NULL, "2", "Beckhoff", "EL2004", "OutputValue", 0},
    41     {NULL, "3", "Beckhoff", "EL1014", "InputValue",  0},
    41     //{NULL, "3", "Beckhoff", "EL3162", "InputValue",  0},
    42     {NULL, "4", "Beckhoff", "EL1014", "InputValue",  0},
    42     {NULL, "4", "Beckhoff", "EL4132", "OutputValue",  0},
    43     {NULL, "5", "Beckhoff", "EL1014", "InputValue",  0},
    43     {NULL, "6", "Beckhoff", "EL5001", "InputValue", 0},
    44     {NULL, "6", "Beckhoff", "EL2004", "OutputValue", 0},
       
    45     {NULL, "7", "Beckhoff", "EL2004", "OutputValue", 0},
       
    46     {NULL, "8", "Beckhoff", "EL2004", "OutputValue", 0},
       
    47     {}
    44     {}
    48 };
    45 };
    49 
    46 
    50 /*****************************************************************************/
    47 /*****************************************************************************/
    51 
    48 
   125         goto out_release_master;
   122         goto out_release_master;
   126     }
   123     }
   127 
   124 
   128     //ecrt_master_debug(master, 2);
   125     //ecrt_master_debug(master, 2);
   129 
   126 
       
   127 #if 0
   130     if (ecrt_master_sdo_write(master, "1", 0x4061, 1,  0, 1) ||
   128     if (ecrt_master_sdo_write(master, "1", 0x4061, 1,  0, 1) ||
   131         ecrt_master_sdo_write(master, "1", 0x4061, 2,  1, 1) ||
   129         ecrt_master_sdo_write(master, "1", 0x4061, 2,  1, 1) ||
   132         ecrt_master_sdo_write(master, "1", 0x4061, 3,  1, 1) ||
   130         ecrt_master_sdo_write(master, "1", 0x4061, 3,  1, 1) ||
   133         ecrt_master_sdo_write(master, "1", 0x4066, 0,  0, 1) ||
   131         ecrt_master_sdo_write(master, "1", 0x4066, 0,  0, 1) ||
   134         ecrt_master_sdo_write(master, "1", 0x4067, 0,  4, 1) ||
   132         ecrt_master_sdo_write(master, "1", 0x4067, 0,  4, 1) ||
   137         ecrt_master_sdo_write(master, "1", 0x406A, 0, 25, 1) ||
   135         ecrt_master_sdo_write(master, "1", 0x406A, 0, 25, 1) ||
   138         ecrt_master_sdo_write(master, "1", 0x406B, 0, 50, 1)) {
   136         ecrt_master_sdo_write(master, "1", 0x406B, 0, 50, 1)) {
   139         printk(KERN_ERR "EtherCAT: Failed to configure SSI!\n");
   137         printk(KERN_ERR "EtherCAT: Failed to configure SSI!\n");
   140         goto out_deactivate;
   138         goto out_deactivate;
   141     }
   139     }
       
   140 #endif
   142 
   141 
   143     //ecrt_master_debug(master, 0);
   142     //ecrt_master_debug(master, 0);
   144 
   143 
   145 #if 0
   144 #if 0
   146     printk(KERN_INFO "Writing alias...\n");
   145     printk(KERN_INFO "Writing alias...\n");
   164 
   163 
   165     printk(KERN_INFO "=== Minimal EtherCAT environment started. ===\n");
   164     printk(KERN_INFO "=== Minimal EtherCAT environment started. ===\n");
   166 
   165 
   167     return 0;
   166     return 0;
   168 
   167 
       
   168 #if 0
   169  out_deactivate:
   169  out_deactivate:
   170     ecrt_master_deactivate(master);
   170     ecrt_master_deactivate(master);
       
   171 #endif
   171 
   172 
   172  out_release_master:
   173  out_release_master:
   173     ecrt_release_master(master);
   174     ecrt_release_master(master);
   174 
   175 
   175  out_return:
   176  out_return: