fixed structure padding on certain architecures

This commit is contained in:
Steffen Vogel 2012-01-19 12:40:16 +01:00
parent 658ff48a2c
commit 08c20106c9
2 changed files with 10 additions and 23 deletions

View file

@ -117,8 +117,6 @@ struct remote_msg_config_offsets_t {
};
struct remote_msg_start_program_t {
uint8_t address;
uint8_t cmd;
uint8_t script;
union program_params_t params;
};
@ -143,8 +141,7 @@ enum startup_mode_t {
STARTUP_PROGRAM = 1,
};
/* startup parameters including mode, size: 12 byte */
struct startup_parameters_t {
struct remote_msg_config_startup_t {
enum startup_mode_t mode;
union {
@ -155,17 +152,11 @@ struct startup_parameters_t {
* size: 11 byte */
struct {
uint8_t program;
uint8_t program_parameters[10];
union program_params_t program_parameters;
};
};
};
struct remote_msg_config_startup_t {
uint8_t address;
uint8_t cmd;
struct startup_parameters_t params;
};
/* bootloader commands */
#define BOOTLOADER_MAGIC_BYTE1 0x6b
#define BOOTLOADER_MAGIC_BYTE2 0x56
@ -203,10 +194,10 @@ struct remote_msg_boot_crc_flash_t {
struct remote_msg_t {
uint8_t address;
uint8_t cmd;
union {
uint8_t data[REMOTE_MSG_LEN-2];
struct remote_msg_fade_rgb_t fade_rgb;
struct remote_msg_fade_hsv_t fade_hsv;
struct remote_msg_save_rgb_t save_rgb;
@ -217,13 +208,13 @@ struct remote_msg_t {
struct remote_msg_stop_t msg_stop;
struct remote_msg_pull_int_t pull_int;
struct remote_msg_modify_current_t modify_current;
struct remote_msg_bootloader_t bootloader;
struct remote_msg_boot_config_t boot_config;
struct remote_msg_boot_data_t boot_data;
struct remote_msg_boot_crc_check_t boot_crc_check;
struct remote_msg_boot_crc_flash_t boot_crc_flash;
};
};
} __attribute__ ((__packed__)); /* required to avoid padding in structure */
#endif

View file

@ -32,8 +32,7 @@
#define PROGRAM_PARAMETER_SIZE 10
/* parameter structures (max 10 bytes) */
struct colorwheel_params_t
{
struct colorwheel_params_t {
uint8_t fade_step;
uint8_t fade_delay;
uint8_t fade_sleep;
@ -44,8 +43,7 @@ struct colorwheel_params_t
uint8_t value;
};
struct random_params_t
{
struct random_params_t {
uint16_t seed;
uint8_t use_address:1;
uint8_t wait_for_fade:1;
@ -58,8 +56,7 @@ struct random_params_t
uint8_t min_distance;
};
struct replay_params_t
{
struct replay_params_t {
uint8_t start;
uint8_t end;
enum {
@ -69,8 +66,7 @@ struct replay_params_t
} repeat;
};
union program_params_t
{
union program_params_t {
/* parameters for static programs */
uint8_t raw[PROGRAM_PARAMETER_SIZE];
struct colorwheel_params_t colorwheel;