From 5e2393eb6b1a6d7b180bd63d5165ee7b7ff5f9e0 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 15 Apr 2009 14:25:26 -0700 Subject: [PATCH] Move a bunch of variables from __data to __xdata --- ao.h | 2 +- ao_cmd.c | 74 ++++++++++++++++++++++++++++---------------------------- ao_log.c | 8 +++--- ao_usb.c | 32 ++++++++++++------------ 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/ao.h b/ao.h index 39ad9587..23f13172 100644 --- a/ao.h +++ b/ao.h @@ -29,7 +29,7 @@ /* Stack runs from above the allocated __data space to 0xfe, which avoids * writing to 0xff as that triggers the stack overflow indicator */ -#define AO_STACK_START 0x7f +#define AO_STACK_START 0x5c #define AO_STACK_END 0xfe #define AO_STACK_SIZE (AO_STACK_END - AO_STACK_START + 1) diff --git a/ao_cmd.c b/ao_cmd.c index 73c301ac..74cbb7b1 100644 --- a/ao_cmd.c +++ b/ao_cmd.c @@ -22,16 +22,16 @@ #define SYNTAX_ERROR 2 #define SUCCESS 0 -static __data uint16_t lex_i; -static __data uint8_t lex_c; -static __data uint8_t lex_status; -static __data uint8_t lex_echo; +static __xdata uint16_t lex_i; +static __xdata uint8_t lex_c; +static __xdata uint8_t lex_status; +static __xdata uint8_t lex_echo; #define CMD_LEN 32 static __xdata uint8_t cmd_line[CMD_LEN]; -static __data uint8_t cmd_len; -static __data uint8_t cmd_i; +static __xdata uint8_t cmd_len; +static __xdata uint8_t cmd_i; void putchar(char c) @@ -56,7 +56,7 @@ getchar(void) static void put_string(char *s) { - uint8_t c; + __xdata uint8_t c; while (c = *s++) putchar(c); } @@ -64,7 +64,7 @@ put_string(char *s) static void readline(void) { - static uint8_t c; + __xdata uint8_t c; if (lex_echo) put_string("> "); cmd_len = 0; @@ -153,8 +153,8 @@ void puti(int i) { static uint8_t __xdata num_buffer[NUM_LEN]; - uint8_t __xdata *num_ptr = num_buffer + NUM_LEN; - uint8_t neg = 0; + uint8_t __xdata * __xdata num_ptr = num_buffer + NUM_LEN; + uint8_t __xdata neg = 0; *--num_ptr = '\0'; if (i < 0) { @@ -183,7 +183,7 @@ white(void) static void hex(void) { - uint8_t r = LEX_ERROR; + __xdata uint8_t r = LEX_ERROR; lex_i = 0; white(); @@ -207,7 +207,7 @@ hex(void) static void decimal(void) { - uint8_t r = LEX_ERROR; + __xdata uint8_t r = LEX_ERROR; lex_i = 0; white(); @@ -256,8 +256,8 @@ adc_dump(void) static void dump(void) { - uint16_t c; - uint8_t __xdata *start, *end; + __xdata uint16_t c; + __xdata uint8_t * __xdata start, * __xdata end; hex(); start = (uint8_t __xdata *) lex_i; @@ -283,9 +283,9 @@ dump(void) static void ee_dump(void) { - uint8_t b; - uint16_t block; - uint8_t i; + __xdata uint8_t b; + __xdata uint16_t block; + __xdata uint8_t i; hex(); block = lex_i; @@ -309,11 +309,11 @@ ee_dump(void) static void ee_store(void) { - uint16_t block; - uint8_t i; - uint16_t len; - uint8_t b; - uint32_t addr; + __xdata uint16_t block; + __xdata uint8_t i; + __xdata uint16_t len; + __xdata uint8_t b; + __xdata uint32_t addr; hex(); block = lex_i; @@ -372,9 +372,9 @@ debug_put(void) static void debug_get(void) { - uint16_t count; - uint16_t i; - uint8_t byte; + __xdata uint16_t count; + __xdata uint16_t i; + __xdata uint8_t byte; hex(); if (lex_status != SUCCESS) return; @@ -396,7 +396,7 @@ debug_get(void) static uint8_t getnibble(void) { - uint8_t c; + __xdata uint8_t c; c = getchar(); if ('0' <= c && c <= '9') @@ -412,10 +412,10 @@ getnibble(void) static void debug_input(void) { - uint16_t count; - uint16_t addr; - uint8_t b; - uint8_t i; + __xdata uint16_t count; + __xdata uint16_t addr; + __xdata uint8_t b; + __xdata uint8_t i; hex(); count = lex_i; @@ -438,9 +438,9 @@ debug_input(void) static void debug_output(void) { - uint16_t count; - uint16_t addr; - uint8_t b; + __xdata uint16_t count; + __xdata uint16_t addr; + __xdata uint8_t b; hex(); count = lex_i; @@ -463,7 +463,7 @@ debug_output(void) static void dump_log(void) { - uint8_t more; + __xdata uint8_t more; for (more = ao_log_dump_first(); more; more = ao_log_dump_next()) { putchar(ao_log_dump.type); @@ -519,7 +519,7 @@ report(void) void ao_cmd(void *parameters) { - uint8_t c; + __xdata uint8_t c; (void) parameters; lex_echo = 1; @@ -583,10 +583,10 @@ ao_cmd(void *parameters) } -struct ao_task __xdata cmd_task; +__xdata struct ao_task ao_cmd_task; void ao_cmd_init(void) { - ao_add_task(&cmd_task, ao_cmd); + ao_add_task(&ao_cmd_task, ao_cmd); } diff --git a/ao_log.c b/ao_log.c index 112ea510..65196ae2 100644 --- a/ao_log.c +++ b/ao_log.c @@ -61,8 +61,8 @@ ao_log_flush(void) } __xdata struct ao_log_record ao_log_dump; -static __data uint16_t ao_log_dump_flight; -static __data uint32_t ao_log_dump_pos; +static __xdata uint16_t ao_log_dump_flight; +static __xdata uint32_t ao_log_dump_pos; static uint8_t ao_log_dump_check_data(void) @@ -107,8 +107,8 @@ ao_log_dump_next(void) return ao_log_dump_check_data(); } -uint8_t ao_log_adc_pos; -enum flight_state ao_log_state; +__xdata uint8_t ao_log_adc_pos; +__xdata enum flight_state ao_log_state; void ao_log(void) diff --git a/ao_usb.c b/ao_usb.c index dd0471d1..8a0c672c 100644 --- a/ao_usb.c +++ b/ao_usb.c @@ -34,8 +34,8 @@ struct ao_task __xdata ao_usb_task; static __xdata uint16_t ao_usb_in_bytes; static __xdata uint16_t ao_usb_out_bytes; -static __data uint8_t ao_usb_iif; -static __data uint8_t ao_usb_oif; +static __xdata uint8_t ao_usb_iif; +static __xdata uint8_t ao_usb_oif; /* This interrupt is shared with port 2, * so when we hook that up, fix this @@ -67,20 +67,20 @@ struct ao_usb_setup { uint16_t length; } __xdata ao_usb_setup; -__data uint8_t ao_usb_ep0_state; -uint8_t * __data ao_usb_ep0_in_data; -__data uint8_t ao_usb_ep0_in_len; +__xdata uint8_t ao_usb_ep0_state; +uint8_t * __xdata ao_usb_ep0_in_data; +__xdata uint8_t ao_usb_ep0_in_len; __xdata uint8_t ao_usb_ep0_in_buf[2]; -__data uint8_t ao_usb_ep0_out_len; +__xdata uint8_t ao_usb_ep0_out_len; __xdata uint8_t *__data ao_usb_ep0_out_data; -__data uint8_t ao_usb_configuration; +__xdata uint8_t ao_usb_configuration; /* Send an IN data packet */ static void ao_usb_ep0_flush(void) { - uint8_t this_len; - uint8_t cs0; + __xdata uint8_t this_len; + __xdata uint8_t cs0; USBINDEX = 0; cs0 = USBCS0; @@ -120,7 +120,7 @@ struct ao_usb_line_coding { uint8_t data_bits; } ; -static struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8}; +__xdata static struct ao_usb_line_coding ao_usb_line_coding = {115200, 0, 0, 8}; /* USB descriptors in one giant block of bytes */ static const uint8_t ao_usb_descriptors [] = @@ -252,9 +252,9 @@ static const uint8_t ao_usb_descriptors [] = static void ao_usb_get_descriptor(uint16_t value) { - const uint8_t *descriptor; - uint8_t type = value >> 8; - uint8_t index = value; + const uint8_t *__xdata descriptor; + __xdata uint8_t type = value >> 8; + __xdata uint8_t index = value; descriptor = ao_usb_descriptors; while (descriptor[0] != 0) { @@ -275,7 +275,7 @@ ao_usb_get_descriptor(uint16_t value) static void ao_usb_ep0_fill(void) { - uint8_t len; + __xdata uint8_t len; USBINDEX = 0; len = USBCNT0; @@ -417,7 +417,7 @@ ao_usb_ep0_setup(void) static void ao_usb_ep0(void) { - uint8_t cs0; + __xdata uint8_t cs0; ao_usb_ep0_state = AO_USB_EP0_IDLE; for (;;) { @@ -493,7 +493,7 @@ ao_usb_putchar(uint8_t c) __critical uint8_t ao_usb_getchar(void) __critical { - uint8_t c; + __xdata uint8_t c; while (ao_usb_out_bytes == 0) { for (;;) { USBINDEX = AO_USB_OUT_EP; -- 2.30.2