# HG changeset patch # User Florian Pose # Date 1205838922 0 # Node ID 8acdecb5a75e001b3d069aadd2fe4864706d6b61 # Parent c5df898a3618c92af703d4c0a316b8c0dbd38272 Fixed general flags on big-endian archs. diff -r c5df898a3618 -r 8acdecb5a75e master/slave.c --- a/master/slave.c Tue Mar 18 10:49:30 2008 +0000 +++ b/master/slave.c Tue Mar 18 11:15:22 2008 +0000 @@ -438,6 +438,7 @@ ) { unsigned int i; + uint8_t flags; if (data_size != 32) { EC_ERR("Wrong size of general category (%u/32) in slave %u.\n", @@ -454,8 +455,20 @@ slave->sii.physical_layer[i] = (data[4] & (0x03 << (i * 2))) >> (i * 2); - memcpy(&slave->sii.coe_details, data + 5, 1); - memcpy(&slave->sii.general_flags, data + 0x000b, 1); + // read CoE details + flags = EC_READ_U8(data + 5); + slave->sii.coe_details.enable_sdo = (flags >> 0) & 0x01; + slave->sii.coe_details.enable_sdo_info = (flags >> 1) & 0x01; + slave->sii.coe_details.enable_pdo_assign = (flags >> 2) & 0x01; + slave->sii.coe_details.enable_pdo_configuration = (flags >> 3) & 0x01; + slave->sii.coe_details.enable_upload_at_startup = (flags >> 4) & 0x01; + slave->sii.coe_details.enable_sdo_complete_access = (flags >> 5) & 0x01; + + // read general flags + flags = EC_READ_U8(data + 0x000B); + slave->sii.general_flags.enable_safeop = (flags >> 0) & 0x01; + slave->sii.general_flags.enable_not_lrw = (flags >> 1) & 0x01; + slave->sii.current_on_ebus = EC_READ_S16(data + 0x0C); slave->sii.has_general = 1; return 0;