types.c: BK1120 outputs and EL1004.

This commit is contained in:
Florian Pose 2006-06-26 11:28:24 +00:00
parent dba003179f
commit 1d15573863
2 changed files with 28 additions and 8 deletions

View File

@ -57,14 +57,15 @@ spinlock_t master_lock = SPIN_LOCK_UNLOCKED;
// data fields
//void *r_ssi_input, *r_ssi_status, *r_4102[3];
void *r_kbus_in;
void *r_kbus_in, *r_kbus_out;
// channels
uint32_t k_pos;
uint8_t k_stat;
ec_field_init_t domain1_fields[] = {
{&r_kbus_in, "0", "Beckhoff", "BK1120", "Inputs", 0},
//{&r_kbus_out, "0", "Beckhoff", "BK1120", "Outputs", 0},
//{&r_kbus_in, "0", "Beckhoff", "BK1120", "Inputs", 0},
{}
};
@ -73,6 +74,7 @@ ec_field_init_t domain1_fields[] = {
void run(unsigned long data)
{
static unsigned int counter = 0;
unsigned int i;
spin_lock(&master_lock);
@ -105,8 +107,9 @@ void run(unsigned long data)
}
else {
counter = FREQUENCY;
//printk(KERN_INFO "k_pos = %i\n", k_pos);
//printk(KERN_INFO "k_stat = 0x%02X\n", k_stat);
printk(KERN_INFO "input = ");
for (i = 0; i < 22; i++) printk("%02X ", *((uint8_t *) r_kbus_in + i));
printk("\n");
}
// restart timer
@ -163,7 +166,8 @@ int __init init_mini_module(void)
printk(KERN_ERR "Failed to get slave!\n");
goto out_deactivate;
}
ecrt_slave_field_size(slave, "Inputs", 0, 1);
ecrt_slave_field_size(slave, "Outputs", 0, 0x16);
ecrt_slave_field_size(slave, "Inputs", 0, 0x16);
#endif
printk(KERN_INFO "Activating master...\n");
@ -172,7 +176,7 @@ int __init init_mini_module(void)
goto out_release_master;
}
#if 0
#if 1
if (ecrt_master_fetch_sdo_lists(master)) {
printk(KERN_ERR "Failed to fetch SDO lists!\n");
goto out_deactivate;

View File

@ -67,6 +67,7 @@ const ec_slave_type_t Beckhoff_EK1110 = {
/*****************************************************************************/
const ec_field_t bk1120_out = {"Outputs", 0}; // variable size
const ec_field_t bk1120_in = {"Inputs", 0}; // variable size
const ec_sync_t bk1120_sm0 = {0x1C00, 264, 0x26, {NULL}};
@ -74,7 +75,7 @@ const ec_sync_t bk1120_sm1 = {0x1E00, 264, 0x22, {NULL}};
const ec_sync_t bk1120_sm2 = { // outputs
0x1000, 0, 0x24, // variable size
{NULL}
{&bk1120_out, NULL}
};
const ec_sync_t bk1120_sm3 = { // inputs
@ -89,6 +90,20 @@ const ec_slave_type_t Beckhoff_BK1120 = {
/*****************************************************************************/
const ec_field_t el1004_in = {"InputValue", 1};
const ec_sync_t el1004_sm0 = { // inputs
0x1000, 1, 0x00,
{&el1004_in, NULL}
};
const ec_slave_type_t Beckhoff_EL1004 = {
"Beckhoff", "EL1004", "4x Digital Input, 3ms", EC_TYPE_NORMAL,
{&el1004_sm0, NULL}
};
/*****************************************************************************/
const ec_field_t el1014_in = {"InputValue", 1};
const ec_sync_t el1014_sm0 = { // inputs
@ -97,7 +112,7 @@ const ec_sync_t el1014_sm0 = { // inputs
};
const ec_slave_type_t Beckhoff_EL1014 = {
"Beckhoff", "EL1014", "4x Digital Input", EC_TYPE_NORMAL,
"Beckhoff", "EL1014", "4x Digital Input, 10us", EC_TYPE_NORMAL,
{&el1014_sm0, NULL}
};
@ -244,6 +259,7 @@ const ec_slave_type_t TR_Electronic_LinEnc2 = {
*/
ec_slave_ident_t slave_idents[] = {
{0x00000002, 0x03EC3052, &Beckhoff_EL1004},
{0x00000002, 0x03F63052, &Beckhoff_EL1014},
{0x00000002, 0x044C2C52, &Beckhoff_EK1100},
{0x00000002, 0x04562C52, &Beckhoff_EK1110},