}
void
-ao_aes_set_key(__xdata uint8_t *in)
+ao_aes_set_key(uint8_t *in)
{
memcpy(key, in, 16);
xrijndaelKeySched((word32 *) key, 128, 128, &rkk);
}
void
-ao_aes_run(__xdata uint8_t *in,
- __xdata uint8_t *out)
+ao_aes_run(uint8_t *in,
+ uint8_t *out)
{
uint8_t i;
uint8_t *_iv = (uint8_t *) iv;
#define ao_arch_naked_declare __attribute__((naked))
#define ao_arch_naked_define
-#define __pdata
-#define __data
-#define __xdata
-#define __code const
-#define __reentrant
-#define __critical
#define __interrupt(n)
#define __at(n)
void
-ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant;
+ao_spi_send_bus(void *block, uint16_t len);
void
-ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant;
+ao_spi_recv_bus(void *block, uint16_t len);
#define ao_spi_send(block, len, bus) ao_spi_send_bus(block, len)
#define ao_spi_recv(block, len, bus) ao_spi_recv_bus(block, len)
/* notask.c */
uint8_t
-ao_sleep(__xdata void *wchan);
+ao_sleep(void *wchan);
void
-ao_wakeup(__xdata void *wchan);
+ao_wakeup(void *wchan);
extern alt_t ao_max_height;
* so using interrupts would take way too long
*/
uint8_t
-ao_i2c_send_bus(void __xdata *block, uint16_t len, uint8_t stop)
+ao_i2c_send_bus(void *block, uint16_t len, uint8_t stop)
{
uint8_t *d = block;
* Poll, sending zeros and reading data back
*/
uint8_t
-ao_i2c_recv_bus(void __xdata *block, uint16_t len, uint8_t stop)
+ao_i2c_recv_bus(void *block, uint16_t len, uint8_t stop)
{
uint8_t *d = block;
#include "ao.h"
-__pdata uint8_t ao_led_enable;
+uint8_t ao_led_enable;
#define LED_PORT PORTB
#define LED_DDR DDRB
}
void
-ao_led_for(uint8_t colors, uint16_t ticks) __reentrant
+ao_led_for(uint8_t colors, uint16_t ticks)
{
ao_led_on(colors);
ao_delay(ticks);
* so using interrupts would take way too long
*/
void
-ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant
+ao_spi_send_bus(void *block, uint16_t len)
{
uint8_t *d = block;
* Poll, sending zeros and reading data back
*/
void
-ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant
+ao_spi_recv_bus(void *block, uint16_t len)
{
uint8_t *d = block;
#include "ao.h"
#include "ao_pwmin.h"
-volatile __xdata struct ao_data ao_data_ring[AO_DATA_RING];
-volatile __data uint8_t ao_data_head;
+volatile struct ao_data ao_data_ring[AO_DATA_RING];
+volatile uint8_t ao_data_head;
#ifdef TELESCIENCE
const uint8_t adc_channels[AO_LOG_TELESCIENCE_NUM_ADC] = {
}
void
-ao_data_get(__xdata struct ao_data *packet)
+ao_data_get(struct ao_data *packet)
{
uint8_t i = ao_data_ring_prev(ao_data_head);
memcpy(packet, (void *) &ao_data_ring[i], sizeof (struct ao_data));
}
static void
-ao_adc_dump(void) __reentrant
+ao_adc_dump(void)
{
- static __xdata struct ao_data packet;
+ static struct ao_data packet;
uint8_t i;
ao_data_get(&packet);
printf("tick: %5u", packet.tick);
printf("\n");
}
-__code struct ao_cmds ao_adc_cmds[] = {
+const struct ao_cmds ao_adc_cmds[] = {
{ ao_adc_dump, "a\0ADC" },
{ 0, NULL },
};
#define ao_arch_naked_declare __attribute__((naked))
#define ao_arch_naked_define
-#define __pdata
-#define __data
-#define __xdata
-#define __code const
-#define __reentrant
-#define __critical
#define __interrupt(n)
#define __at(n)
* ao_spi.c
*/
-extern __xdata uint8_t ao_spi_mutex;
+extern uint8_t ao_spi_mutex;
#define ao_spi_get_mask(reg,mask,bus,speed) do { \
ao_mutex_get(&ao_spi_mutex); \
void
-ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant;
+ao_spi_send_bus(void *block, uint16_t len);
void
-ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant;
+ao_spi_recv_bus(void *block, uint16_t len);
#define ao_spi_send(block, len, bus) ao_spi_send_bus(block, len)
#define ao_spi_recv(block, len, bus) ao_spi_recv_bus(block, len)
#include <ao_storage.h>
/* Total bytes of available storage */
-__pdata ao_pos_t ao_storage_total = 1024;
+ao_pos_t ao_storage_total = 1024;
/* Block size - device is erased in these units. */
-__pdata ao_pos_t ao_storage_block = 1024;
+ao_pos_t ao_storage_block = 1024;
/* Byte offset of config block. Will be ao_storage_block bytes long */
-__pdata ao_pos_t ao_storage_config = 0;
+ao_pos_t ao_storage_config = 0;
/* Storage unit size - device reads and writes must be within blocks of this size. */
-__pdata uint16_t ao_storage_unit = 1024;
+uint16_t ao_storage_unit = 1024;
/*
* The internal flash chip is arranged in 8 byte sectors; the
* Erase the specified sector
*/
uint8_t
-ao_storage_erase(ao_pos_t pos) __reentrant
+ao_storage_erase(ao_pos_t pos)
{
/* Not necessary */
return 1;
*/
uint8_t
-ao_storage_device_write(ao_pos_t pos32, __xdata void *v, uint16_t len) __reentrant
+ao_storage_device_write(ao_pos_t pos32, void *v, uint16_t len)
{
uint16_t pos = pos32;
- __xdata uint8_t *d = v;
+ uint8_t *d = v;
if (pos >= ao_storage_total || pos + len > ao_storage_total)
return 0;
* Read from flash
*/
uint8_t
-ao_storage_device_read(ao_pos_t pos, __xdata void *v, uint16_t len) __reentrant
+ao_storage_device_read(ao_pos_t pos, void *v, uint16_t len)
{
uint8_t *d = v;
}
void
-ao_storage_flush(void) __reentrant
+ao_storage_flush(void)
{
}
}
void
-ao_storage_device_info(void) __reentrant
+ao_storage_device_info(void)
{
printf ("Using internal flash\n");
}
* Atmega32u4 TWI master mode (I2C)
*/
-__xdata uint8_t ao_i2c_mutex;
+uint8_t ao_i2c_mutex;
/* Send bytes over I2C.
*
* so using interrupts would take way too long
*/
void
-ao_i2c_send(void __xdata *block, uint16_t len) __reentrant
+ao_i2c_send(void *block, uint16_t len)
{
uint8_t *d = block;
* clocks the data coming in.
*/
void
-ao_i2c_recv(void __xdata *block, uint16_t len) __reentrant
+ao_i2c_recv(void *block, uint16_t len)
{
uint8_t *d = block;
#include "ao.h"
-__pdata uint8_t ao_led_enable;
+uint8_t ao_led_enable;
#define LED_PORT PORTB
#define LED_DDR DDRB
}
void
-ao_led_for(uint8_t colors, uint16_t ticks) __reentrant
+ao_led_for(uint8_t colors, uint16_t ticks)
{
ao_led_on(colors);
ao_delay(ticks);
* project payload developed at Challenger Middle School.
*/
-volatile __data uint16_t ao_icp3_count = 0;
-volatile __data uint16_t ao_icp3_last = 0;
+volatile uint16_t ao_icp3_count = 0;
+volatile uint16_t ao_icp3_last = 0;
uint16_t ao_icp3(void)
{
}
static void
-ao_pwmin_display(void) __reentrant
+ao_pwmin_display(void)
{
/* display the most recent value */
printf("icp 3: %5u\n", ao_icp3());
ao_icp3_last = ao_icp3_this;
}
-__code struct ao_cmds ao_pwmin_cmds[] = {
+const struct ao_cmds ao_pwmin_cmds[] = {
{ ao_pwmin_display, "p\0PWM input" },
{ 0, NULL },
};
void ao_pwmin_init(void);
-extern volatile __data uint16_t ao_icp3_count;
+extern volatile uint16_t ao_icp3_count;
#include "ao.h"
-__xdata struct ao_fifo ao_serial1_rx_fifo;
-__xdata struct ao_fifo ao_serial1_tx_fifo;
+struct ao_fifo ao_serial1_rx_fifo;
+struct ao_fifo ao_serial1_tx_fifo;
void
ao_debug_out(char c)
#endif
}
-static __xdata uint8_t ao_serial_tx1_started;
+static uint8_t ao_serial_tx1_started;
static void
ao_serial1_tx_start(void)
#endif
char
-ao_serial1_getchar(void) __critical
+ao_serial1_getchar(void)
{
char c;
}
void
-ao_serial1_drain(void) __critical
+ao_serial1_drain(void)
{
ao_arch_block_interrupts();
while (!ao_fifo_empty(ao_serial1_tx_fifo))
* Atmega32u4 USART in MSPIM (master SPI mode)
*/
-__xdata uint8_t ao_spi_mutex;
+uint8_t ao_spi_mutex;
/* Send bytes over SPI.
*
* so using interrupts would take way too long
*/
void
-ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant
+ao_spi_send_bus(void *block, uint16_t len)
{
uint8_t *d = block;
* Poll, sending zeros and reading data back
*/
void
-ao_spi_recv_bus(void __xdata *block, uint16_t len) __reentrant
+ao_spi_recv_bus(void *block, uint16_t len)
{
uint8_t *d = block;
#include "ao.h"
-volatile __data uint16_t ao_tick_count;
+volatile uint16_t ao_tick_count;
uint16_t ao_time(void)
{
#define T1_SAMPLE_TIME 30000 /* 3e6/30000 = 100 */
#if HAS_ADC
-volatile __data uint8_t ao_adc_interval = 1;
-volatile __data uint8_t ao_adc_count;
+volatile uint8_t ao_adc_interval = 1;
+volatile uint8_t ao_adc_count;
#endif
void
#if HAS_ADC
void
-ao_timer_set_adc_interval(uint8_t interval) __critical
+ao_timer_set_adc_interval(uint8_t interval)
{
ao_adc_interval = interval;
ao_adc_count = 0;
#define debug(format, args...)
#endif
-struct ao_task __xdata ao_usb_task;
+struct ao_task ao_usb_task;
struct ao_usb_setup {
uint8_t dir_type_recip;
uint16_t value;
uint16_t index;
uint16_t length;
-} __xdata ao_usb_setup;
-
-static __xdata uint8_t ao_usb_ep0_state;
-static const uint8_t * __xdata ao_usb_ep0_in_data;
-static __xdata uint8_t ao_usb_ep0_in_len;
-static __xdata uint8_t ao_usb_ep0_in_pending;
-static __xdata uint8_t ao_usb_addr_pending;
-static __xdata uint8_t ao_usb_ep0_in_buf[2];
-static __xdata uint8_t ao_usb_ep0_out_len;
-static __xdata uint8_t *__xdata ao_usb_ep0_out_data;
-
-static __xdata uint8_t ao_usb_in_flushed;
-__xdata uint8_t ao_usb_running;
-static __xdata uint8_t ao_usb_configuration;
-static __xdata uint8_t ueienx_0;
+} ao_usb_setup;
+
+static uint8_t ao_usb_ep0_state;
+static const uint8_t * ao_usb_ep0_in_data;
+static uint8_t ao_usb_ep0_in_len;
+static uint8_t ao_usb_ep0_in_pending;
+static uint8_t ao_usb_addr_pending;
+static uint8_t ao_usb_ep0_in_buf[2];
+static uint8_t ao_usb_ep0_out_len;
+static uint8_t *ao_usb_ep0_out_data;
+
+static uint8_t ao_usb_in_flushed;
+uint8_t ao_usb_running;
+static uint8_t ao_usb_configuration;
+static uint8_t ueienx_0;
void
ao_usb_set_address(uint8_t address)
static void
ao_usb_get_descriptor(uint16_t value)
{
- const uint8_t *__xdata descriptor;
- __xdata uint8_t type = value >> 8;
- __xdata uint8_t index = value;
+ const uint8_t *descriptor;
+ uint8_t type = value >> 8;
+ uint8_t index = value;
descriptor = ao_usb_descriptors;
while (descriptor[0] != 0) {
static void
ao_usb_ep0_flush(void)
{
- __xdata uint8_t this_len;
+ uint8_t this_len;
cli();
UENUM = 0;
ao_usb_ep0_setup(void)
{
/* Pull the setup packet out of the fifo */
- ao_usb_ep0_out_data = (__xdata uint8_t *) &ao_usb_setup;
+ ao_usb_ep0_out_data = (uint8_t *) &ao_usb_setup;
ao_usb_ep0_out_len = 8;
ao_usb_ep0_fill(8, (1 << RXSTPI) | (1 << RXOUTI) | (1 << TXINI));
if (ao_usb_ep0_out_len != 0) {
case AO_USB_SET_LINE_CODING:
debug ("set line coding\n");
ao_usb_ep0_out_len = 7;
- ao_usb_ep0_out_data = (__xdata uint8_t *) &ao_usb_line_coding;
+ ao_usb_ep0_out_data = (uint8_t *) &ao_usb_line_coding;
break;
case AO_USB_GET_LINE_CODING:
debug ("get line coding\n");
}
#if USB_DEBUG
-struct ao_task __xdata ao_usb_echo_task;
+struct ao_task ao_usb_echo_task;
static void
ao_usb_echo(void)
ao_as1107_write_8(start, value);
}
-__code struct ao_cmds ao_demo_cmds[] = {
+const struct ao_cmds ao_demo_cmds[] = {
{ ao_video_toggle, "V\0Toggle video" },
{ ao_ball_toggle, "B\0Toggle ball" },
{ ao_ps2_read_keys, "K\0Read keys from keyboard" },
/* Data -- relocated to RAM, but written to ROM
*/
.data : {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
. = ALIGN(4);
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
#define EE_DEVICE_SIZE ((uint32_t) 128 * (uint32_t) 1024)
/* Total bytes of available storage */
-__pdata uint32_t ao_storage_total;
+uint32_t ao_storage_total;
/* Block size - device is erased in these units. At least 256 bytes */
-__pdata uint32_t ao_storage_block;
+uint32_t ao_storage_block;
/* Byte offset of config block. Will be ao_storage_block bytes long */
-__pdata uint32_t ao_storage_config;
+uint32_t ao_storage_config;
/* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */
-__pdata uint16_t ao_storage_unit;
+uint16_t ao_storage_unit;
/*
* Using SPI on USART 0, with P1_2 as the chip select
#define EE_CS P1_2
#define EE_CS_PIN 2
-static __xdata uint8_t ao_ee_mutex;
+static uint8_t ao_ee_mutex;
#define ao_ee_delay() do { \
_asm nop _endasm; \
struct ao_ee_instruction {
uint8_t instruction;
uint8_t address[3];
-} __xdata ao_ee_instruction;
+} ao_ee_instruction;
static void
ao_ee_write_enable(void)
#define EE_BLOCK_NONE 0xffff
-static __xdata uint8_t ao_ee_data[EE_BLOCK_SIZE];
-static __pdata uint16_t ao_ee_block = EE_BLOCK_NONE;
-static __pdata uint8_t ao_ee_block_dirty;
+static uint8_t ao_ee_data[EE_BLOCK_SIZE];
+static uint16_t ao_ee_block = EE_BLOCK_NONE;
+static uint8_t ao_ee_block_dirty;
/* Write the current block to the EEPROM */
static void
}
uint8_t
-ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant
+ao_storage_device_write(uint32_t pos, void *buf, uint16_t len)
{
uint16_t block = (uint16_t) (pos >> EE_BLOCK_SHIFT);
}
uint8_t
-ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant
+ao_storage_device_read(uint32_t pos, void *buf, uint16_t len)
{
uint16_t block = (uint16_t) (pos >> EE_BLOCK_SHIFT);
}
void
-ao_storage_flush(void) __reentrant
+ao_storage_flush(void)
{
ao_mutex_get(&ao_ee_mutex); {
ao_ee_flush_internal();
}
uint8_t
-ao_storage_erase(uint32_t pos) __reentrant
+ao_storage_erase(uint32_t pos)
{
ao_mutex_get(&ao_ee_mutex); {
ao_ee_flush_internal();
}
static void
-ee_store(void) __reentrant
+ee_store(void)
{
}
}
void
-ao_storage_device_info(void) __reentrant
+ao_storage_device_info(void)
{
}
uint8_t
ao_74hc165_read(void)
{
- static __xdata state;
+ static state;
ao_spi_get(AO_74HC165_SPI_BUS);
ao_spi_set_speed(AO_74HC165_SPI_BUS, AO_SPI_SPEED_FAST);
AO_74HC165_CS = 1;
uint8_t
ao_74hc497_read(void)
{
- static __xdata state;
+ static state;
ao_spi_get_bit(AO_74HC497_CS_PORT, AO_74HC497_CS_PIN, AO_74HC497_CS, AO_74HC497_SPI_BUS, AO_SPI_SPEED_FAST);
ao_spi_recv(&state, 1, AO_74HC497_SPI_BUS);
ao_spi_put_bit(AO_74HC497_CS_PORT, AO_74HC497_CS_PIN, AO_74HC497_CS, AO_74HC497_SPI_BUS);
#define AO_AT24C_PAGE_LEN 128
/* Total bytes of available storage */
-__pdata ao_pos_t ao_storage_total = 64l * 1024l;
+ao_pos_t ao_storage_total = 64l * 1024l;
/* Storage unit size - device reads and writes must be within blocks of this size. */
-__pdata uint16_t ao_storage_unit = 128;
+uint16_t ao_storage_unit = 128;
static void
ao_at24c_set_address(uint8_t addr, ao_pos_t pos)
* Erase the specified sector
*/
uint8_t
-ao_storage_erase(ao_pos_t pos) __reentrant
+ao_storage_erase(ao_pos_t pos)
{
if (pos >= ao_storage_total || pos + AO_AT24C_PAGE_LEN > ao_storage_total)
return 0;
* Write to flash
*/
uint8_t
-ao_storage_device_write(ao_pos_t pos, __xdata void *d, uint16_t len) __reentrant
+ao_storage_device_write(ao_pos_t pos, void *d, uint16_t len)
{
if (pos >= ao_storage_total || pos + len > ao_storage_total)
return 0;
* Read from flash
*/
uint8_t
-ao_storage_device_read(ao_pos_t pos, __xdata void *d, uint16_t len) __reentrant
+ao_storage_device_read(ao_pos_t pos, void *d, uint16_t len)
{
if (pos >= ao_storage_total || pos + len > ao_storage_total)
return 0;
}
void
-ao_storage_flush(void) __reentrant
+ao_storage_flush(void)
{
}
#include "ao_at45db161d.h"
/* Total bytes of available storage */
-__pdata uint32_t ao_storage_total;
+uint32_t ao_storage_total;
/* Block size - device is erased in these units. At least 256 bytes */
-__pdata uint32_t ao_storage_block;
+uint32_t ao_storage_block;
/* Byte offset of config block. Will be ao_storage_block bytes long */
-__pdata uint32_t ao_storage_config;
+uint32_t ao_storage_config;
/* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */
-__pdata uint16_t ao_storage_unit;
+uint16_t ao_storage_unit;
#define FLASH_CS P1_1
#define FLASH_CS_INDEX 1
#define FLASH_BLOCK_SIZE_MAX 512
-__xdata uint8_t ao_flash_mutex;
+uint8_t ao_flash_mutex;
#define ao_flash_delay() do { \
_asm nop _endasm; \
struct ao_flash_instruction {
uint8_t instruction;
uint8_t address[3];
-} __xdata ao_flash_instruction;
+} ao_flash_instruction;
static void
ao_flash_set_pagesize_512(void)
#define FLASH_BLOCK_NONE 0xffff
-static __xdata uint8_t ao_flash_data[FLASH_BLOCK_SIZE_MAX];
-static __pdata uint16_t ao_flash_block = FLASH_BLOCK_NONE;
-static __pdata uint8_t ao_flash_block_dirty;
-static __pdata uint8_t ao_flash_write_pending;
-static __pdata uint8_t ao_flash_setup_done;
-static __pdata uint8_t ao_flash_block_shift;
-static __pdata uint16_t ao_flash_block_size;
-static __pdata uint16_t ao_flash_block_mask;
+static uint8_t ao_flash_data[FLASH_BLOCK_SIZE_MAX];
+static uint16_t ao_flash_block = FLASH_BLOCK_NONE;
+static uint8_t ao_flash_block_dirty;
+static uint8_t ao_flash_write_pending;
+static uint8_t ao_flash_setup_done;
+static uint8_t ao_flash_block_shift;
+static uint16_t ao_flash_block_size;
+static uint16_t ao_flash_block_mask;
void
-ao_storage_setup(void) __reentrant
+ao_storage_setup(void)
{
uint8_t status;
}
uint8_t
-ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant
+ao_storage_device_write(uint32_t pos, void *buf, uint16_t len)
{
uint16_t block = (uint16_t) (pos >> ao_flash_block_shift);
}
uint8_t
-ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentrant
+ao_storage_device_read(uint32_t pos, void *buf, uint16_t len)
{
uint16_t block = (uint16_t) (pos >> ao_flash_block_shift);
}
void
-ao_storage_flush(void) __reentrant
+ao_storage_flush(void)
{
ao_mutex_get(&ao_flash_mutex); {
ao_flash_flush_internal();
}
uint8_t
-ao_storage_erase(uint32_t pos) __reentrant
+ao_storage_erase(uint32_t pos)
{
ao_mutex_get(&ao_flash_mutex); {
ao_flash_flush_internal();
}
void
-ao_storage_device_info(void) __reentrant
+ao_storage_device_info(void)
{
uint8_t status;
#endif
int8_t ao_btm_stdio;
-__xdata uint8_t ao_btm_connected;
+uint8_t ao_btm_connected;
#define BT_DEBUG 0
#if BT_DEBUG
-__xdata char ao_btm_buffer[256];
+char ao_btm_buffer[256];
uint16_t ao_btm_ptr;
char ao_btm_dir;
ao_wakeup((void *) &ao_serial_btm_rx_fifo);
}
-__code struct ao_cmds ao_btm_cmds[] = {
+const struct ao_cmds ao_btm_cmds[] = {
{ ao_btm_dump, "d\0Dump btm buffer." },
{ ao_btm_speed, "s <19200,57600>\0Set btm serial speed." },
{ ao_btm_send, "S\0BTM interactive mode. ~ to exit." },
#endif
#define AO_BTM_MAX_REPLY 16
-__xdata char ao_btm_reply[AO_BTM_MAX_REPLY];
+char ao_btm_reply[AO_BTM_MAX_REPLY];
/*
* Read one bluetooth character.
}
void
-ao_btm_string(__code char *cmd)
+ao_btm_string(const char *cmd)
{
char c;
}
uint8_t
-ao_btm_cmd(__code char *cmd)
+ao_btm_cmd(const char *cmd)
{
ao_btm_drain();
#endif
}
-__xdata struct ao_task ao_btm_task;
+struct ao_task ao_btm_task;
/*
* A thread to initialize the bluetooth device and
}
uint8_t
-ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout)
+ao_radio_recv(void *d, uint8_t size, uint8_t timeout)
{
uint8_t len;
uint8_t radio_rssi = 0;
#endif
uint8_t
-ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout)
+ao_radio_recv(void *d, uint8_t size, uint8_t timeout)
{
uint8_t success = 0;
AO_COMPANION_SPI_BUS); \
} while (0)
-__xdata struct ao_companion_command ao_companion_command;
-__xdata struct ao_companion_setup ao_companion_setup;
+struct ao_companion_command ao_companion_command;
+struct ao_companion_setup ao_companion_setup;
-__xdata uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS];
-__pdata uint8_t ao_companion_running;
-__xdata uint8_t ao_companion_mutex;
+uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS];
+uint8_t ao_companion_running;
+uint8_t ao_companion_mutex;
static void
ao_companion_send_command(uint8_t command)
}
void
-ao_companion_status(void) __reentrant
+ao_companion_status(void)
{
uint8_t i;
printf("Companion running: %d\n", ao_companion_running);
printf("\n");
}
-__code struct ao_cmds ao_companion_cmds[] = {
+const struct ao_cmds ao_companion_cmds[] = {
{ ao_companion_status, "L\0Companion link status" },
{ 0, NULL },
};
-static __xdata struct ao_task ao_companion_task;
+static struct ao_task ao_companion_task;
void
ao_companion_init(void)
#include "ao.h"
#endif
-__xdata uint8_t ao_gps_new;
-__xdata uint8_t ao_gps_mutex;
-__pdata uint16_t ao_gps_tick;
-__xdata struct ao_telemetry_location ao_gps_data;
-__xdata struct ao_telemetry_satellite ao_gps_tracking_data;
+uint8_t ao_gps_new;
+uint8_t ao_gps_mutex;
+uint16_t ao_gps_tick;
+struct ao_telemetry_location ao_gps_data;
+struct ao_telemetry_satellite ao_gps_tracking_data;
static const char ao_gps_set_nmea[] = "\r\n$PSRF100,0,57600,8,1,0*37\r\n";
uint8_t hdop;
};
-static __xdata struct sirf_geodetic_nav_data ao_sirf_data;
+static struct sirf_geodetic_nav_data ao_sirf_data;
struct sirf_measured_sat_data {
uint8_t svid;
struct sirf_measured_sat_data sats[12];
};
-static __xdata struct sirf_measured_tracker_data ao_sirf_tracker_data;
+static struct sirf_measured_tracker_data ao_sirf_tracker_data;
-static __pdata uint16_t ao_sirf_cksum;
-static __pdata uint16_t ao_sirf_len;
+static uint16_t ao_sirf_cksum;
+static uint16_t ao_sirf_len;
#ifndef ao_sirf_getchar
#define ao_sirf_getchar ao_serial1_getchar
return c;
}
-static char __xdata *sirf_target;
+static char *sirf_target;
static void sirf_u16(uint8_t offset)
{
- uint16_t __xdata *ptr = (uint16_t __xdata *) (sirf_target + offset);
+ uint16_t *ptr = (uint16_t *) (sirf_target + offset);
uint16_t val;
val = data_byte() << 8;
static void sirf_u8(uint8_t offset)
{
- uint8_t __xdata *ptr = (uint8_t __xdata *) (sirf_target + offset);
+ uint8_t *ptr = (uint8_t *) (sirf_target + offset);
uint8_t val;
val = data_byte ();
*ptr = val;
}
-static void sirf_u32(uint8_t offset) __reentrant
+static void sirf_u32(uint8_t offset)
{
- uint32_t __xdata *ptr = (uint32_t __xdata *) (sirf_target + offset);
+ uint32_t *ptr = (uint32_t *) (sirf_target + offset);
uint32_t val;
val = ((uint32_t) data_byte ()) << 24;
};
static void
-ao_sirf_parse(void __xdata *target, const struct sirf_packet_parse *parse) __reentrant
+ao_sirf_parse(void *target, const struct sirf_packet_parse *parse)
{
uint8_t i, offset, j;
};
static void
-ao_sirf_parse_41(void) __reentrant
+ao_sirf_parse_41(void)
{
ao_sirf_parse(&ao_sirf_data, geodetic_nav_data_packet);
}
};
static void
-ao_sirf_parse_4(void) __reentrant
+ao_sirf_parse_4(void)
{
uint8_t i;
ao_sirf_parse(&ao_sirf_tracker_data, measured_tracker_data_packet);
}
static void
-ao_gps_setup(void) __reentrant
+ao_gps_setup(void)
{
uint8_t i, k;
ao_sirf_set_speed(AO_SERIAL_SPEED_4800);
};
void
-ao_sirf_set_message_rate(uint8_t msg, uint8_t rate) __reentrant
+ao_sirf_set_message_rate(uint8_t msg, uint8_t rate)
{
uint16_t cksum = 0x00a6;
uint8_t i;
};
void
-ao_gps(void) __reentrant
+ao_gps(void)
{
uint8_t i, k;
uint16_t cksum;
}
}
-__xdata struct ao_task ao_gps_task;
+struct ao_task ao_gps_task;
void
ao_gps_init(void)
#define ao_gps_set_speed ao_serial1_set_speed
#endif
-__xdata uint8_t ao_gps_new;
-__xdata uint8_t ao_gps_mutex;
-static __data char ao_gps_char;
-static __data uint8_t ao_gps_cksum;
-static __data uint8_t ao_gps_error;
+uint8_t ao_gps_new;
+uint8_t ao_gps_mutex;
+static char ao_gps_char;
+static uint8_t ao_gps_cksum;
+static uint8_t ao_gps_error;
-__pdata uint16_t ao_gps_tick;
-__xdata struct ao_telemetry_location ao_gps_data;
-__xdata struct ao_telemetry_satellite ao_gps_tracking_data;
+uint16_t ao_gps_tick;
+struct ao_telemetry_location ao_gps_data;
+struct ao_telemetry_satellite ao_gps_tracking_data;
-static __pdata uint16_t ao_gps_next_tick;
-static __pdata struct ao_telemetry_location ao_gps_next;
-static __pdata uint8_t ao_gps_date_flags;
-static __pdata struct ao_telemetry_satellite ao_gps_tracking_next;
+static uint16_t ao_gps_next_tick;
+static struct ao_telemetry_location ao_gps_next;
+static uint8_t ao_gps_date_flags;
+static struct ao_telemetry_satellite ao_gps_tracking_next;
#define STQ_S 0xa0, 0xa1
#define STQ_E 0x0d, 0x0a
STQ_S, 0,15, id, a,b,c,d,e,f,g,h,i,j,k,l,m,n, \
(id^a^b^c^d^e^f^g^h^i^j^k^l^m^n), STQ_E
-static __code uint8_t ao_gps_config[] = {
+static const uint8_t ao_gps_config[] = {
SKYTRAQ_MSG_8(0x08, 1, 0, 1, 0, 1, 0, 0, 0), /* configure nmea */
/* gga interval */
/* gsa interval */
ao_gps_lexchar();
}
-__data static uint8_t ao_gps_num_width;
+static uint8_t ao_gps_num_width;
static int16_t
ao_gps_decimal(uint8_t max_width)
}
static int32_t
-ao_gps_parse_pos(uint8_t deg_width) __reentrant
+ao_gps_parse_pos(uint8_t deg_width)
{
- static __pdata uint16_t d;
- static __pdata uint8_t m;
- static __pdata uint16_t f;
+ static uint16_t d;
+ static uint8_t m;
+ static uint16_t f;
char c;
d = ao_gps_decimal(deg_width);
#define ao_skytraq_sendstruct(s) ao_skytraq_sendbytes((s), sizeof(s))
static void
-ao_skytraq_sendbytes(__code uint8_t *b, uint8_t l)
+ao_skytraq_sendbytes(const uint8_t *b, uint8_t l)
{
while (l--) {
uint8_t c = *b++;
static uint8_t ao_gps_updating;
void
-ao_gps(void) __reentrant
+ao_gps(void)
{
ao_gps_set_speed(AO_SERIAL_SPEED_9600);
}
}
-__xdata struct ao_task ao_gps_task;
+struct ao_task ao_gps_task;
-static __code uint8_t ao_gps_115200[] = {
+static const uint8_t ao_gps_115200[] = {
SKYTRAQ_MSG_3(5,0,5,0) /* Set to 115200 baud */
};
}
static void
-gps_update(void) __reentrant
+gps_update(void)
{
ao_gps_updating = 1;
ao_task_minimize_latency = 1;
ao_gps_putchar(ao_usb_getchar());
}
-__code struct ao_cmds ao_gps_cmds[] = {
+const struct ao_cmds ao_gps_cmds[] = {
{ ao_gps_show, "g\0Display GPS" },
{ gps_update, "U\0Update GPS firmware" },
{ 0, NULL },
#include <stdarg.h>
-__xdata uint8_t ao_gps_new;
-__xdata uint8_t ao_gps_mutex;
-__pdata uint16_t ao_gps_tick;
-__xdata struct ao_telemetry_location ao_gps_data;
-__xdata struct ao_telemetry_satellite ao_gps_tracking_data;
+uint8_t ao_gps_new;
+uint8_t ao_gps_mutex;
+uint16_t ao_gps_tick;
+struct ao_telemetry_location ao_gps_data;
+struct ao_telemetry_satellite ao_gps_tracking_data;
#undef AO_SERIAL_SPEED_UBLOX
uint8_t a, b;
};
-static __pdata struct ao_ublox_cksum ao_ublox_cksum;
-static __pdata uint16_t ao_ublox_len;
+static struct ao_ublox_cksum ao_ublox_cksum;
+static uint16_t ao_ublox_len;
#if AO_UBLOX_DEBUG
return header_byte();
}
-static char __xdata *ublox_target;
+static char *ublox_target;
static void ublox_u16(uint8_t offset)
{
- uint16_t __xdata *ptr = (uint16_t __xdata *) (void __xdata *) (ublox_target + offset);
+ uint16_t *ptr = (uint16_t *) (void *) (ublox_target + offset);
uint16_t val;
val = data_byte();
static void ublox_u8(uint8_t offset)
{
- uint8_t __xdata *ptr = (uint8_t __xdata *) (ublox_target + offset);
+ uint8_t *ptr = (uint8_t *) (ublox_target + offset);
uint8_t val;
val = data_byte ();
*ptr = val;
}
-static void ublox_u32(uint8_t offset) __reentrant
+static void ublox_u32(uint8_t offset)
{
- uint32_t __xdata *ptr = (uint32_t __xdata *) (void __xdata *) (ublox_target + offset);
+ uint32_t *ptr = (uint32_t *) (void *) (ublox_target + offset);
uint32_t val;
val = ((uint32_t) data_byte ());
};
static void
-ao_ublox_parse(void __xdata *target, const struct ublox_packet_parse *parse) __reentrant
+ao_ublox_parse(void *target, const struct ublox_packet_parse *parse)
{
uint8_t i, offset;
}
void
-ao_gps(void) __reentrant
+ao_gps(void)
{
uint8_t class, id;
struct ao_ublox_cksum cksum;
#define ao_gps_option ao_gps_show
#endif
-__code struct ao_cmds ao_gps_cmds[] = {
+const struct ao_cmds ao_gps_cmds[] = {
{ ao_gps_option, "g\0Display GPS" },
{ 0, NULL },
};
-__xdata struct ao_task ao_gps_task;
+struct ao_task ao_gps_task;
void
ao_gps_init(void)
static uint16_t ao_lcd_time = 3;
-static __xdata uint8_t ao_lcd_mutex;
+static uint8_t ao_lcd_mutex;
static void
ao_lcd_delay(void)
ao_lco_debug = ao_cmd_lex_i != 0;
}
-__code struct ao_cmds ao_lco_cmds[] = {
+const struct ao_cmds ao_lco_cmds[] = {
{ ao_lco_set_debug, "D <0 off, 1 on>\0Debug" },
{ ao_lco_search, "s\0Search for pad boxes" },
{ 0, NULL }
#define HAS_STATIC_TEST 1
#endif
-static __pdata uint16_t lco_box;
-static __pdata uint8_t lco_channels;
-static __pdata uint16_t tick_offset;
+static uint16_t lco_box;
+static uint8_t lco_channels;
+static uint16_t tick_offset;
static void
-lco_args(void) __reentrant
+lco_args(void)
{
ao_cmd_decimal();
lco_box = ao_cmd_lex_i;
}
static void
-lco_report_cmd(void) __reentrant
+lco_report_cmd(void)
{
int8_t r;
uint8_t c;
}
static void
-lco_fire_cmd(void) __reentrant
+lco_fire_cmd(void)
{
uint8_t secs;
uint8_t i;
#if HAS_STATIC_TEST
static void
-lco_static_cmd(void) __reentrant
+lco_static_cmd(void)
{
uint8_t secs;
uint8_t i;
#endif
static void
-lco_arm_cmd(void) __reentrant
+lco_arm_cmd(void)
{
uint8_t i;
int8_t r;
}
static void
-lco_ignite_cmd(void) __reentrant
+lco_ignite_cmd(void)
{
uint8_t i;
lco_args();
#if HAS_STATIC_TEST
static void
-lco_endstatic_cmd(void) __reentrant
+lco_endstatic_cmd(void)
{
lco_ignite(AO_PAD_ENDSTATIC);
}
#endif
-static __code struct ao_cmds ao_lco_cmds[] = {
+static const struct ao_cmds ao_lco_cmds[] = {
{ lco_report_cmd, "l <box> <channel>\0Get remote status" },
{ lco_fire_cmd, "F <box> <channel> <secs>\0Fire remote igniters" },
#if HAS_STATIC_TEST
#include <ao_radio_cmac.h>
#include <ao_lco_func.h>
-static __xdata struct ao_pad_command command;
-static __xdata uint8_t ao_lco_mutex;
+static struct ao_pad_command command;
+static uint8_t ao_lco_mutex;
int8_t
ao_lco_query(uint16_t box, struct ao_pad_query *query, uint16_t *tick_offset)
ao_lco_debug = ao_cmd_lex_i;
}
-__code struct ao_cmds ao_lco_cmds[] = {
+const struct ao_cmds ao_lco_cmds[] = {
{ ao_lco_set_debug, "D <0 off, 1 on>\0Debug" },
{ 0, NULL }
};
#include "ao.h"
/* Total bytes of available storage */
-__pdata uint32_t ao_storage_total;
+uint32_t ao_storage_total;
/* Block size - device is erased in these units. At least 256 bytes */
-__pdata uint32_t ao_storage_block;
+uint32_t ao_storage_block;
/* Byte offset of config block. Will be ao_storage_block bytes long */
-__pdata uint32_t ao_storage_config;
+uint32_t ao_storage_config;
/* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */
-__pdata uint16_t ao_storage_unit;
+uint16_t ao_storage_unit;
#define M25_DEBUG 0
/*
static uint8_t ao_m25_total; /* total sectors available */
static ao_port_t ao_m25_wip; /* write in progress */
-static __xdata uint8_t ao_m25_mutex;
+static uint8_t ao_m25_mutex;
/*
* This little array is abused to send and receive data. A particular
* of which touch those last three bytes.
*/
-static __xdata uint8_t ao_m25_instruction[4];
+static uint8_t ao_m25_instruction[4];
#define M25_SELECT(cs) ao_spi_get_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS, AO_SPI_SPEED_FAST)
#define M25_DESELECT(cs) ao_spi_put_mask(AO_M25_SPI_CS_PORT,cs,AO_M25_SPI_BUS)
* Erase the specified sector
*/
uint8_t
-ao_storage_erase(uint32_t pos) __reentrant
+ao_storage_erase(uint32_t pos)
{
ao_port_t cs;
* Write to flash
*/
uint8_t
-ao_storage_device_write(uint32_t pos, __xdata void *d, uint16_t len) __reentrant
+ao_storage_device_write(uint32_t pos, void *d, uint16_t len)
{
ao_port_t cs;
* Read from flash
*/
uint8_t
-ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant
+ao_storage_device_read(uint32_t pos, void *d, uint16_t len)
{
ao_port_t cs;
}
void
-ao_storage_flush(void) __reentrant
+ao_storage_flush(void)
{
}
}
void
-ao_storage_device_info(void) __reentrant
+ao_storage_device_info(void)
{
#if M25_DEBUG
ao_port_t cs;
printf ("MMA655X value %d\n", ao_mma655x_current);
}
-__code struct ao_cmds ao_mma655x_cmds[] = {
+const struct ao_cmds ao_mma655x_cmds[] = {
{ ao_mma655x_dump, "A\0Display MMA655X data" },
{ 0, NULL },
};
}
}
-static __xdata struct ao_task ao_mma655x_task;
+static struct ao_task ao_mma655x_task;
void
ao_mma655x_init(void)
#include "ao.h"
/* Total bytes of available storage */
-__pdata uint32_t ao_storage_total;
+uint32_t ao_storage_total;
/* Block size - device is erased in these units. At least 256 bytes */
-__pdata uint32_t ao_storage_block;
+uint32_t ao_storage_block;
/* Byte offset of config block. Will be ao_storage_block bytes long */
-__pdata uint32_t ao_storage_config;
+uint32_t ao_storage_config;
/* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */
-__pdata uint16_t ao_storage_unit;
+uint16_t ao_storage_unit;
/*
* MRAM is entirely random access; no erase operations are required,
#define MR25_STATUS_BP_SHIFT (2)
#define MR25_STATUS_WEL (1 << 1) /* Write enable latch */
-static __xdata uint8_t ao_mr25_mutex;
+static uint8_t ao_mr25_mutex;
/*
* This little array is abused to send and receive data. A particular
* those last three bytes.
*/
-static __xdata uint8_t ao_mr25_instruction[4];
+static uint8_t ao_mr25_instruction[4];
#define MR25_SELECT() ao_spi_get_mask(AO_MR25_SPI_CS_PORT,(1 << AO_MR25_SPI_CS_PIN),AO_MR25_SPI_BUS, AO_SPI_SPEED_FAST)
#define MR25_DESELECT() ao_spi_put_mask(AO_MR25_SPI_CS_PORT,(1 << AO_MR25_SPI_CS_PIN),AO_MR25_SPI_BUS)
* Erase the specified sector (no-op for MRAM)
*/
uint8_t
-ao_storage_erase(uint32_t pos) __reentrant
+ao_storage_erase(uint32_t pos)
{
if (pos >= ao_storage_total || pos + ao_storage_block > ao_storage_total)
return 0;
* Write to flash
*/
uint8_t
-ao_storage_device_write(uint32_t pos, __xdata void *d, uint16_t len) __reentrant
+ao_storage_device_write(uint32_t pos, void *d, uint16_t len)
{
if (pos >= ao_storage_total || pos + len > ao_storage_total)
return 0;
* Read from flash
*/
uint8_t
-ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant
+ao_storage_device_read(uint32_t pos, void *d, uint16_t len)
{
if (pos >= ao_storage_total || pos + len > ao_storage_total)
return 0;
}
void
-ao_storage_flush(void) __reentrant
+ao_storage_flush(void)
{
}
}
void
-ao_storage_device_info(void) __reentrant
+ao_storage_device_info(void)
{
printf ("Detected chips 1 size %d\n", ao_storage_total >> 8);
}
#if HAS_MS5607 || HAS_MS5611
-__xdata struct ao_ms5607_prom ao_ms5607_prom;
-static __xdata uint8_t ms5607_configured;
+struct ao_ms5607_prom ao_ms5607_prom;
+static uint8_t ms5607_configured;
#ifndef AO_MS5607_SPI_SPEED
#define AO_MS5607_SPI_SPEED AO_SPI_SPEED_FAST
}
static void
-ao_ms5607_prom_read(__xdata struct ao_ms5607_prom *prom)
+ao_ms5607_prom_read(struct ao_ms5607_prom *prom)
{
uint8_t addr;
uint16_t *r;
- r = (__xdata uint16_t *) prom;
+ r = (uint16_t *) prom;
for (addr = 0; addr < 8; addr++) {
uint8_t cmd = AO_MS5607_PROM_READ(addr);
ao_ms5607_start();
ao_ms5607_prom_read(&ao_ms5607_prom);
}
-static __xdata volatile uint8_t ao_ms5607_done;
+static volatile uint8_t ao_ms5607_done;
static void
ao_ms5607_isr(void)
{
ao_exti_disable(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN);
ao_ms5607_done = 1;
- ao_wakeup((__xdata void *) &ao_ms5607_done);
+ ao_wakeup((void *) &ao_ms5607_done);
}
static uint32_t
ao_ms5607_get_sample(uint8_t cmd) {
- __xdata uint8_t reply[3];
- __xdata uint8_t read;
+ uint8_t reply[3];
+ uint8_t read;
ao_ms5607_done = 0;
#define AO_CONVERT_D2 token_evaluator(AO_MS5607_CONVERT_D2_, AO_MS5607_TEMP_OVERSAMPLE)
void
-ao_ms5607_sample(__xdata struct ao_ms5607_sample *sample)
+ao_ms5607_sample(struct ao_ms5607_sample *sample)
{
sample->pres = ao_ms5607_get_sample(AO_CONVERT_D1);
sample->temp = ao_ms5607_get_sample(AO_CONVERT_D2);
#define HAS_MS5607_TASK HAS_TASK
#endif
-__xdata struct ao_ms5607_sample ao_ms5607_current;
+struct ao_ms5607_sample ao_ms5607_current;
#if HAS_MS5607_TASK
static void
}
}
-__xdata struct ao_task ao_ms5607_task;
+struct ao_task ao_ms5607_task;
#endif
#if HAS_TASK
static void
ao_ms5607_dump(void)
{
- __xdata struct ao_ms5607_value value;
+ struct ao_ms5607_value value;
ao_ms5607_convert(&ao_ms5607_current, &value);
printf ("Pressure: %8lu %8ld\n", ao_ms5607_current.pres, value.pres);
printf ("Altitude: %ld\n", ao_pa_to_altitude(value.pres));
}
-__code struct ao_cmds ao_ms5607_cmds[] = {
+const struct ao_cmds ao_ms5607_cmds[] = {
{ ao_ms5607_dump, "B\0Display MS5607 data" },
{ 0, NULL },
};
int32_t temp; /* in °C * 100 */
};
-extern __xdata struct ao_ms5607_sample ao_ms5607_current;
-extern __xdata struct ao_ms5607_prom ao_ms5607_prom;
+extern struct ao_ms5607_sample ao_ms5607_current;
+extern struct ao_ms5607_prom ao_ms5607_prom;
void
ao_ms5607_setup(void);
ao_ms5607_info(void);
void
-ao_ms5607_sample(__xdata struct ao_ms5607_sample *sample);
+ao_ms5607_sample(struct ao_ms5607_sample *sample);
void
-ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample,
- __xdata struct ao_ms5607_value *value);
+ao_ms5607_convert(struct ao_ms5607_sample *sample,
+ struct ao_ms5607_value *value);
#endif /* _AO_MS5607_H_ */
#endif
void
-ao_ms5607_convert(__xdata struct ao_ms5607_sample *sample,
- __xdata struct ao_ms5607_value *value)
+ao_ms5607_convert(struct ao_ms5607_sample *sample,
+ struct ao_ms5607_value *value)
{
__LOCAL int32_t dT;
__LOCAL int32_t TEMP;
#include "ao.h"
-__xdata struct ao_packet_recv ao_rx_packet;
-__xdata struct ao_packet ao_tx_packet;
-__pdata uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used;
+struct ao_packet_recv ao_rx_packet;
+struct ao_packet ao_tx_packet;
+uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used;
-static __xdata uint8_t tx_data[AO_PACKET_MAX];
-static __xdata uint8_t rx_data[AO_PACKET_MAX];
-static __pdata uint8_t rx_seq;
+static uint8_t tx_data[AO_PACKET_MAX];
+static uint8_t rx_data[AO_PACKET_MAX];
+static uint8_t rx_seq;
-__xdata struct ao_task ao_packet_task;
-__xdata uint8_t ao_packet_enable;
-__xdata uint8_t ao_packet_restart;
+struct ao_task ao_packet_task;
+uint8_t ao_packet_enable;
+uint8_t ao_packet_restart;
#if PACKET_HAS_MASTER
-__xdata uint8_t ao_packet_master_sleeping;
+uint8_t ao_packet_master_sleeping;
#endif
void
#endif /* PACKET_HAS_MASTER */
void
-ao_packet_putchar(char c) __reentrant
+ao_packet_putchar(char c)
{
/* No need to block interrupts, all variables here
* are only manipulated in task context
}
static void
-ao_packet_echo(void) __reentrant
+ao_packet_echo(void)
{
int c;
while (ao_packet_enable) {
ao_exit();
}
-static __xdata struct ao_task ao_packet_echo_task;
-static __xdata uint16_t ao_packet_master_delay;
-static __xdata uint16_t ao_packet_master_time;
+static struct ao_task ao_packet_echo_task;
+static uint16_t ao_packet_master_delay;
+static uint16_t ao_packet_master_time;
#define AO_PACKET_MASTER_DELAY_SHORT AO_MS_TO_TICKS(100)
#define AO_PACKET_MASTER_DELAY_LONG AO_MS_TO_TICKS(1000)
}
static void
-ao_packet_forward(void) __reentrant
+ao_packet_forward(void)
{
char c;
ao_packet_enable = 1;
printf ("RSSI: %d\n", ao_radio_rssi);
}
-__code struct ao_cmds ao_packet_master_cmds[] = {
+const struct ao_cmds ao_packet_master_cmds[] = {
{ ao_packet_forward, "p\0Remote packet link." },
{ ao_packet_signal, "s\0Report signal strength." },
{ 0, NULL },
#include <ao_74hc165.h>
#include <ao_radio_cmac.h>
-static __xdata uint8_t ao_pad_ignite;
-static __xdata struct ao_pad_command command;
-static __xdata struct ao_pad_query query;
-static __pdata uint8_t ao_pad_armed;
-static __pdata uint16_t ao_pad_arm_time;
-static __pdata uint8_t ao_pad_box;
-static __xdata uint8_t ao_pad_disabled;
-static __pdata uint16_t ao_pad_packet_time;
+static uint8_t ao_pad_ignite;
+static struct ao_pad_command command;
+static struct ao_pad_query query;
+static uint8_t ao_pad_armed;
+static uint16_t ao_pad_arm_time;
+static uint8_t ao_pad_box;
+static uint8_t ao_pad_disabled;
+static uint16_t ao_pad_packet_time;
#ifndef AO_PAD_RSSI_MINIMUM
#define AO_PAD_RSSI_MINIMUM -90
#define DEBUG 1
#if DEBUG
-static __pdata uint8_t ao_pad_debug;
+static uint8_t ao_pad_debug;
#define PRINTD(...) (ao_pad_debug ? (printf(__VA_ARGS__), 0) : 0)
#define FLUSHD() (ao_pad_debug ? (flush(), 0) : 0)
#else
{
uint8_t c;
uint8_t sample;
- __pdata AO_LED_TYPE prev = 0, cur = 0;
- __pdata uint8_t beeping = 0;
- __xdata volatile struct ao_data *packet;
- __pdata uint16_t arm_beep_time = 0;
+ AO_LED_TYPE prev = 0, cur = 0;
+ uint8_t beeping = 0;
+ volatile struct ao_data *packet;
+ uint16_t arm_beep_time = 0;
sample = ao_data_head;
ao_led_set(LEDS_AVAILABLE);
ao_delay(AO_MS_TO_TICKS(1000));
ao_led_set(0);
for (;;) {
- __pdata int16_t pyro;
+ int16_t pyro;
ao_arch_critical(
while (sample == ao_data_head)
}
}
-static __xdata struct ao_task ao_pad_task;
-static __xdata struct ao_task ao_pad_ignite_task;
-static __xdata struct ao_task ao_pad_monitor_task;
+static struct ao_task ao_pad_task;
+static struct ao_task ao_pad_ignite_task;
+static struct ao_task ao_pad_monitor_task;
#if DEBUG
void
}
#endif
-__code struct ao_cmds ao_pad_cmds[] = {
+const struct ao_cmds ao_pad_cmds[] = {
{ ao_pad_test, "t\0Test pad continuity" },
{ ao_pad_manual, "i <key> <n>\0Fire igniter. <key> is doit with D&I" },
#if DEBUG
#include <ao.h>
-static __xdata uint8_t ao_led_state;
+static uint8_t ao_led_state;
static void
ao_led_apply(void)
}
void
-ao_led_for(uint8_t colors, uint16_t ticks) __reentrant
+ao_led_for(uint8_t colors, uint16_t ticks)
{
ao_led_on(colors);
ao_delay(ticks);
struct ao_config ao_config;
-extern volatile __data uint16_t ao_tick_count;
+extern volatile uint16_t ao_tick_count;
uint16_t ao_boost_tick;
void ao_spi_slave(void)
#include <ao_fast_timer.h>
#include <ao_event.h>
-__xdata int32_t ao_quadrature_count[AO_QUADRATURE_COUNT];
+int32_t ao_quadrature_count[AO_QUADRATURE_COUNT];
#ifndef AO_QUADRATURE_SINGLE_CODE
static int8_t ao_quadrature_step[AO_QUADRATURE_COUNT];
#endif
#ifndef _AO_QUADRATURE_H_
#define _AO_QUADRATURE_H_
-extern __xdata int32_t ao_quadrature_count[AO_QUADRATURE_COUNT];
+extern int32_t ao_quadrature_count[AO_QUADRATURE_COUNT];
int32_t
ao_quadrature_wait(uint8_t q);
#include <ao_exti.h>
#include <ao_radio_cmac.h>
-static __xdata struct ao_radio_spi_reply ao_radio_spi_reply;
-static __xdata struct ao_radio_spi_request ao_radio_spi_request;
-static volatile __xdata uint8_t ao_radio_wait_mode;
-static volatile __xdata uint8_t ao_radio_done = 0;
-static volatile __xdata uint8_t ao_radio_ready = 1;
-static __xdata uint8_t ao_radio_mutex;
-static __xdata uint8_t ao_radio_aes_seq;
+static struct ao_radio_spi_reply ao_radio_spi_reply;
+static struct ao_radio_spi_request ao_radio_spi_request;
+static volatile uint8_t ao_radio_wait_mode;
+static volatile uint8_t ao_radio_done = 0;
+static volatile uint8_t ao_radio_ready = 1;
+static uint8_t ao_radio_mutex;
+static uint8_t ao_radio_aes_seq;
-__xdata int8_t ao_radio_cmac_rssi;
+int8_t ao_radio_cmac_rssi;
#if 0
#define PRINTD(...) do { printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } while(0)
}
static void
-ao_radio_get_data(__xdata void *d, uint8_t size)
+ao_radio_get_data(void *d, uint8_t size)
{
PRINTD ("fetch\n");
ao_radio_master_start();
uint8_t
-ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout)
+ao_radio_recv(void *d, uint8_t size, uint8_t timeout)
{
int8_t ret;
uint8_t recv;
}
int8_t
-ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant
+ao_radio_cmac_send(void *packet, uint8_t len)
{
if (len > AO_CMAC_MAX_LEN)
return AO_RADIO_CMAC_LEN_ERROR;
}
int8_t
-ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentrant
+ao_radio_cmac_recv(void *packet, uint8_t len, uint16_t timeout)
{
int8_t ret;
int8_t recv;
ao_radio_test(0);
}
-__code struct ao_cmds ao_radio_cmds[] = {
+const struct ao_cmds ao_radio_cmds[] = {
{ ao_radio_test_cmd, "C <1 start, 0 stop, none both>\0Radio carrier test" },
{ 0, NULL },
};
#include <ao_radio_spi.h>
#include <ao_radio_cmac.h>
-static __xdata struct ao_radio_spi_reply ao_radio_spi_reply;
+static struct ao_radio_spi_reply ao_radio_spi_reply;
-static __xdata struct ao_radio_spi_request ao_radio_spi_request;
+static struct ao_radio_spi_request ao_radio_spi_request;
-static __xdata uint8_t slave_state;
+static uint8_t slave_state;
static void
ao_radio_slave_low(void)
}
}
-static __xdata struct ao_task ao_radio_slave_spi_task;
+static struct ao_task ao_radio_slave_spi_task;
void
ao_radio_slave_init(void)
}
-static __code struct ao_cmds ao_watchdog_cmds[] = {
+static const struct ao_cmds ao_watchdog_cmds[] = {
{ ao_watchdog_set, "Q <0 off, 1 on>\0Enable or disable watchdog timer" },
{ 0, NULL },
};
#define AO_TICK_SIGNED int16_t
#endif
-extern volatile __data AO_TICK_TYPE ao_tick_count;
+extern volatile AO_TICK_TYPE ao_tick_count;
/* Our timer runs at 100Hz */
#ifndef AO_HERTZ
#ifndef ao_mutex_get
uint8_t
-ao_mutex_try(__xdata uint8_t *ao_mutex, uint8_t task_id) __reentrant;
+ao_mutex_try(uint8_t *ao_mutex, uint8_t task_id);
void
-ao_mutex_get(__xdata uint8_t *ao_mutex) __reentrant;
+ao_mutex_get(uint8_t *ao_mutex);
void
-ao_mutex_put(__xdata uint8_t *ao_mutex) __reentrant;
+ao_mutex_put(uint8_t *ao_mutex);
#endif
/*
ao_cmd_syntax_error = 2,
};
-extern __pdata uint16_t ao_cmd_lex_i;
-extern __pdata uint32_t ao_cmd_lex_u32;
-extern __pdata char ao_cmd_lex_c;
-extern __pdata enum ao_cmd_status ao_cmd_status;
+extern uint16_t ao_cmd_lex_i;
+extern uint32_t ao_cmd_lex_u32;
+extern char ao_cmd_lex_c;
+extern enum ao_cmd_status ao_cmd_status;
void
-ao_put_string(__code char *s);
+ao_put_string(const char *s);
void
ao_cmd_readline(void);
ao_cmd_hex(void);
void
-ao_cmd_decimal(void) __reentrant;
+ao_cmd_decimal(void);
/* Read a single hex nibble off stdin. */
uint8_t
ao_getnibble(void);
uint8_t
-ao_match_word(__code char *word);
+ao_match_word(const char *word);
struct ao_cmds {
void (*func)(void);
- __code char *help;
+ const char *help;
};
void
-ao_cmd_register(const __code struct ao_cmds *cmds);
+ao_cmd_register(const struct ao_cmds *cmds);
void
ao_cmd_init(void);
#if HAS_BARO
/* pressure from the sensor to altitude in meters */
alt_t
-ao_pres_to_altitude(pres_t pres) __reentrant;
+ao_pres_to_altitude(pres_t pres);
pres_t
-ao_altitude_to_pres(alt_t alt) __reentrant;
+ao_altitude_to_pres(alt_t alt);
int16_t
-ao_temp_to_dC(int16_t temp) __reentrant;
+ao_temp_to_dC(int16_t temp);
#endif
/*
#define AO_GPS_NEW_DATA 1
#define AO_GPS_NEW_TRACKING 2
-extern __xdata uint8_t ao_gps_new;
-extern __pdata uint16_t ao_gps_tick;
-extern __xdata uint8_t ao_gps_mutex;
-extern __xdata struct ao_telemetry_location ao_gps_data;
-extern __xdata struct ao_telemetry_satellite ao_gps_tracking_data;
+extern uint8_t ao_gps_new;
+extern uint16_t ao_gps_tick;
+extern uint8_t ao_gps_mutex;
+extern struct ao_telemetry_location ao_gps_data;
+extern struct ao_telemetry_satellite ao_gps_tracking_data;
struct ao_gps_orig {
uint8_t year;
ao_gps(void);
void
-ao_gps_print(__xdata struct ao_gps_orig *gps_data);
+ao_gps_print(struct ao_gps_orig *gps_data);
void
-ao_gps_tracking_print(__xdata struct ao_gps_tracking_orig *gps_tracking_data);
+ao_gps_tracking_print(struct ao_gps_tracking_orig *gps_tracking_data);
void
-ao_gps_show(void) __reentrant;
+ao_gps_show(void);
void
ao_gps_init(void);
* ao_radio.c
*/
-extern __xdata uint8_t ao_radio_dma;
+extern uint8_t ao_radio_dma;
-extern __xdata int8_t ao_radio_rssi;
+extern int8_t ao_radio_rssi;
#ifdef PKT_APPEND_STATUS_1_CRC_OK
#define AO_RADIO_STATUS_CRC_OK PKT_APPEND_STATUS_1_CRC_OK
#if HAS_RADIO_XMIT
void
-ao_radio_send(const __xdata void *d, uint8_t size) __reentrant;
+ao_radio_send(const void *d, uint8_t size);
#endif
#if HAS_RADIO_RECV
uint8_t
-ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout) __reentrant;
+ao_radio_recv(void *d, uint8_t size, uint8_t timeout);
void
ao_radio_recv_abort(void);
#endif
};
-extern __xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
+extern union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
#define ao_monitor_ring_next(n) (((n) + 1) & (AO_MONITOR_RING - 1))
#define ao_monitor_ring_prev(n) (((n) - 1) & (AO_MONITOR_RING - 1))
-extern __xdata uint8_t ao_monitoring_mutex;
-extern __data uint8_t ao_monitoring;
-extern __data uint8_t ao_monitor_head;
+extern uint8_t ao_monitoring_mutex;
+extern uint8_t ao_monitoring;
+extern uint8_t ao_monitor_head;
void
ao_monitor(void);
ao_monitor_enable(void);
void
-ao_monitor_init(void) __reentrant;
+ao_monitor_init(void);
#endif
struct ao_stdio {
int (*_pollchar)(void); /* Called with interrupts blocked */
- void (*putchar)(char c) __reentrant;
+ void (*putchar)(char c);
void (*flush)(void);
uint8_t echo;
};
-extern __xdata struct ao_stdio ao_stdios[];
-extern __pdata int8_t ao_cur_stdio;
-extern __pdata int8_t ao_num_stdios;
+extern struct ao_stdio ao_stdios[];
+extern int8_t ao_cur_stdio;
+extern int8_t ao_num_stdios;
void
flush(void);
-extern __xdata uint8_t ao_stdin_ready;
+extern uint8_t ao_stdin_ready;
uint8_t
ao_echo(void);
int8_t
ao_add_stdio(int (*pollchar)(void),
- void (*putchar)(char) __reentrant,
- void (*flush)(void)) __reentrant;
+ void (*putchar)(char) ,
+ void (*flush)(void));
/*
* ao_ignite.c
uint8_t firing;
};
-extern __code char * __code ao_igniter_status_names[];
+extern const char * const ao_igniter_status_names[];
-extern __xdata struct ao_ignition ao_ignition[2];
+extern struct ao_ignition ao_ignition[2];
enum ao_igniter_status
ao_igniter_status(enum ao_igniter igniter);
-extern __pdata uint8_t ao_igniter_present;
+extern uint8_t ao_igniter_present;
void
ao_ignite_set_pins(void);
/*
* Set this to force the frequency to 434.550MHz
*/
-extern __xdata uint8_t ao_force_freq;
+extern uint8_t ao_force_freq;
#endif
/*
uint8_t bytes[AO_LOG_SINGLE_SIZE];
};
-extern __xdata union ao_log_single ao_log_single_write_data;
-extern __xdata union ao_log_single ao_log_single_read_data;
+extern union ao_log_single ao_log_single_write_data;
+extern union ao_log_single ao_log_single_read_data;
void
ao_log_single_extra_query(void);
* ao_freq.c
*/
-int32_t ao_freq_to_set(int32_t freq, int32_t cal) __reentrant;
+int32_t ao_freq_to_set(int32_t freq, int32_t cal);
/*
* ao_ms5607.c
/* ao_aes.c */
-extern __xdata uint8_t ao_aes_mutex;
+extern uint8_t ao_aes_mutex;
/* AES keys and blocks are 128 bits */
ao_aes_set_mode(enum ao_aes_mode mode);
void
-ao_aes_set_key(__xdata uint8_t *in);
+ao_aes_set_key(uint8_t *in);
void
ao_aes_zero_iv(void);
void
-ao_aes_run(__xdata uint8_t *in,
- __xdata uint8_t *out);
+ao_aes_run(uint8_t *in,
+ uint8_t *out);
void
ao_aes_init(void);
#if HAS_SENSOR_ERRORS
/* Any sensor can set this to mark the flight computer as 'broken' */
-__xdata uint8_t ao_sensor_errors;
+uint8_t ao_sensor_errors;
#endif
-__pdata uint16_t ao_motor_number; /* number of motors burned so far */
+uint16_t ao_motor_number; /* number of motors burned so far */
/* Main flight thread. */
-__pdata enum ao_flight_state ao_flight_state; /* current flight state */
+enum ao_flight_state ao_flight_state; /* current flight state */
-__pdata uint8_t ao_flight_force_idle;
+uint8_t ao_flight_force_idle;
void
ao_flight(void)
}
}
-static __xdata struct ao_task flight_task;
+static struct ao_task flight_task;
void
ao_flight_init(void)
/* Turn on the beeper for the specified time */
void
-ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant;
+ao_beep_for(uint8_t beep, uint16_t ticks);
/* Initialize the beeper */
void
#include "ao.h"
#include "ao_task.h"
-__pdata uint16_t ao_cmd_lex_i;
-__pdata uint32_t ao_cmd_lex_u32;
-__pdata char ao_cmd_lex_c;
-__pdata enum ao_cmd_status ao_cmd_status;
+uint16_t ao_cmd_lex_i;
+uint32_t ao_cmd_lex_u32;
+char ao_cmd_lex_c;
+enum ao_cmd_status ao_cmd_status;
#ifndef AO_CMD_LEN
#if AO_PYRO_NUM
#endif
#endif
-static __xdata char cmd_line[AO_CMD_LEN];
-static __pdata uint8_t cmd_len;
-static __pdata uint8_t cmd_i;
+static char cmd_line[AO_CMD_LEN];
+static uint8_t cmd_len;
+static uint8_t cmd_i;
void
-ao_put_string(__code char *s)
+ao_put_string(const char *s)
{
char c;
while ((c = *s++))
void
ao_cmd_hex(void)
{
- __pdata uint8_t r = ao_cmd_lex_error;
+ uint8_t r = ao_cmd_lex_error;
int8_t n;
ao_cmd_lex_i = 0;
}
void
-ao_cmd_decimal(void) __reentrant
+ao_cmd_decimal(void)
{
uint8_t r = ao_cmd_lex_error;
}
uint8_t
-ao_match_word(__code char *word)
+ao_match_word(const char *word)
{
while (*word) {
if (ao_cmd_lex_c != *word) {
#define NUM_CMDS 11
#endif
-static __code struct ao_cmds *__xdata (ao_cmds[NUM_CMDS]);
-static __pdata uint8_t ao_ncmds;
+static const struct ao_cmds *(ao_cmds[NUM_CMDS]);
+static uint8_t ao_ncmds;
static void
help(void)
{
- __pdata uint8_t cmds;
- __pdata uint8_t cmd;
- __code struct ao_cmds * __pdata cs;
- __code const char *h;
+ uint8_t cmds;
+ uint8_t cmd;
+ const struct ao_cmds * cs;
+ const char *h;
uint8_t e;
for (cmds = 0; cmds < ao_ncmds; cmds++) {
}
void
-ao_cmd_register(__code struct ao_cmds *cmds)
+ao_cmd_register(const struct ao_cmds *cmds)
{
if (ao_ncmds >= NUM_CMDS)
ao_panic(AO_PANIC_CMD);
void
ao_cmd(void)
{
- __pdata char c;
+ char c;
uint8_t cmd, cmds;
- __code struct ao_cmds * __xdata cs;
- void (*__xdata func)(void);
+ const struct ao_cmds * cs;
+ void (*func)(void);
for (;;) {
ao_cmd_readline();
#endif
#if HAS_TASK
-__xdata struct ao_task ao_cmd_task;
+struct ao_task ao_cmd_task;
#endif
-__code struct ao_cmds ao_base_cmds[] = {
+const struct ao_cmds ao_base_cmds[] = {
{ help, "?\0Help" },
#if HAS_TASK_INFO && HAS_TASK
{ ao_task_info, "T\0Tasks" },
uint8_t channels;
};
-extern __pdata uint8_t ao_companion_running;
-extern __xdata uint8_t ao_companion_mutex;
-extern __xdata struct ao_companion_command ao_companion_command;
-extern __xdata struct ao_companion_setup ao_companion_setup;
-extern __xdata uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS];
+extern uint8_t ao_companion_running;
+extern uint8_t ao_companion_mutex;
+extern struct ao_companion_command ao_companion_command;
+extern struct ao_companion_setup ao_companion_setup;
+extern uint16_t ao_companion_data[AO_COMPANION_MAX_CHANNELS];
void
ao_companion_init(void);
#include <ao_tracker.h>
#endif
-__xdata struct ao_config ao_config;
-__pdata uint8_t ao_config_loaded;
-__pdata uint8_t ao_config_dirty;
-__xdata uint8_t ao_config_mutex;
+struct ao_config ao_config;
+uint8_t ao_config_loaded;
+uint8_t ao_config_dirty;
+uint8_t ao_config_mutex;
#if HAS_FORCE_FREQ
-__xdata uint8_t ao_force_freq;
+uint8_t ao_force_freq;
#endif
#ifndef AO_CONFIG_DEFAULT_APRS_INTERVAL
#if HAS_RADIO
#if HAS_RADIO_FORWARD
-__xdata uint32_t ao_send_radio_setting;
+uint32_t ao_send_radio_setting;
#endif
void
}
void
-ao_config_callsign_set(void) __reentrant
+ao_config_callsign_set(void)
{
uint8_t c;
- static __xdata char callsign[AO_MAX_CALLSIGN + 1];
+ static char callsign[AO_MAX_CALLSIGN + 1];
ao_xmemset(callsign, '\0', sizeof callsign);
ao_cmd_white();
#if HAS_RADIO
void
-ao_config_frequency_show(void) __reentrant
+ao_config_frequency_show(void)
{
printf("Frequency: %ld\n",
ao_config.frequency);
}
void
-ao_config_frequency_set(void) __reentrant
+ao_config_frequency_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_RADIO_FORWARD
void
-ao_config_send_frequency_show(void) __reentrant
+ao_config_send_frequency_show(void)
{
printf("Send frequency: %ld\n",
ao_config.send_frequency);
}
void
-ao_config_send_frequency_set(void) __reentrant
+ao_config_send_frequency_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_FLIGHT
void
-ao_config_main_deploy_show(void) __reentrant
+ao_config_main_deploy_show(void)
{
printf("Main deploy: %d meters\n",
ao_config.main_deploy);
}
void
-ao_config_main_deploy_set(void) __reentrant
+ao_config_main_deploy_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_ACCEL
void
-ao_config_accel_calibrate_show(void) __reentrant
+ao_config_accel_calibrate_show(void)
{
printf("Accel cal +1g: %d -1g: %d\n",
ao_config.accel_plus_g, ao_config.accel_minus_g);
#endif
static int16_t
-ao_config_accel_calibrate_auto(char *orientation) __reentrant
+ao_config_accel_calibrate_auto(char *orientation)
{
uint16_t i;
int32_t accel_total;
}
void
-ao_config_accel_calibrate_set(void) __reentrant
+ao_config_accel_calibrate_set(void)
{
int16_t up, down;
#if HAS_GYRO
#endif /* HAS_ACCEL */
void
-ao_config_apogee_delay_show(void) __reentrant
+ao_config_apogee_delay_show(void)
{
printf("Apogee delay: %d seconds\n",
ao_config.apogee_delay);
}
void
-ao_config_apogee_delay_set(void) __reentrant
+ao_config_apogee_delay_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
}
void
-ao_config_apogee_lockout_show(void) __reentrant
+ao_config_apogee_lockout_show(void)
{
printf ("Apogee lockout: %d seconds\n",
ao_config.apogee_lockout);
}
void
-ao_config_apogee_lockout_set(void) __reentrant
+ao_config_apogee_lockout_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_RADIO
void
-ao_config_radio_cal_show(void) __reentrant
+ao_config_radio_cal_show(void)
{
printf("Radio cal: %ld\n", ao_config.radio_cal);
}
void
-ao_config_radio_cal_set(void) __reentrant
+ao_config_radio_cal_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#endif
void
-ao_config_radio_rate_show(void) __reentrant
+ao_config_radio_rate_show(void)
{
printf("Telemetry rate: %d\n", ao_config.radio_rate);
}
void
-ao_config_radio_rate_set(void) __reentrant
+ao_config_radio_rate_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_LOG
void
-ao_config_log_show(void) __reentrant
+ao_config_log_show(void)
{
printf("Max flight log: %d kB\n", (int16_t) (ao_config.flight_log_max >> 10));
#if FLIGHT_LOG_APPEND
#endif
void
-ao_config_log_set(void) __reentrant
+ao_config_log_set(void)
{
#if FLIGHT_LOG_APPEND
printf("Flight log fixed size %d kB\n", ao_storage_log_max >> 10);
#if HAS_IGNITE
void
-ao_config_ignite_mode_show(void) __reentrant
+ao_config_ignite_mode_show(void)
{
printf("Ignite mode: %d\n", ao_config.ignite_mode);
}
void
-ao_config_ignite_mode_set(void) __reentrant
+ao_config_ignite_mode_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_ACCEL
void
-ao_config_pad_orientation_show(void) __reentrant
+ao_config_pad_orientation_show(void)
{
printf("Pad orientation: %d\n", ao_config.pad_orientation);
}
#endif
void
-ao_config_pad_orientation_set(void) __reentrant
+ao_config_pad_orientation_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_RADIO
void
-ao_config_radio_enable_show(void) __reentrant
+ao_config_radio_enable_show(void)
{
printf("Radio enable: %d\n", ao_config.radio_enable);
}
void
-ao_config_radio_enable_set(void) __reentrant
+ao_config_radio_enable_set(void)
{
ao_cmd_decimal();
if (ao_cmd_status != ao_cmd_success)
#if HAS_AES
-__xdata uint8_t ao_config_aes_seq = 1;
+uint8_t ao_config_aes_seq = 1;
void
-ao_config_key_show(void) __reentrant
+ao_config_key_show(void)
{
uint8_t i;
printf("AES key: ");
}
void
-ao_config_key_set(void) __reentrant
+ao_config_key_set(void)
{
uint8_t i;
#endif
struct ao_config_var {
- __code char *str;
- void (*set)(void) __reentrant;
- void (*show)(void) __reentrant;
+ const char *str;
+ void (*set)(void);
+ void (*show)(void);
};
static void
-ao_config_help(void) __reentrant;
+ao_config_help(void);
static void
-ao_config_show(void) __reentrant;
+ao_config_show(void);
#if HAS_EEPROM
static void
-ao_config_save(void) __reentrant;
+ao_config_save(void);
#endif
-__code struct ao_config_var ao_config_vars[] = {
+const struct ao_config_var ao_config_vars[] = {
#if HAS_FLIGHT
{ "m <meters>\0Main deploy (m)",
ao_config_main_deploy_set, ao_config_main_deploy_show, },
}
static void
-ao_config_help(void) __reentrant
+ao_config_help(void)
{
uint8_t cmd;
for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
}
static void
-ao_config_show(void) __reentrant
+ao_config_show(void)
{
uint8_t cmd;
ao_config_get();
#if HAS_EEPROM
static void
-ao_config_save(void) __reentrant
+ao_config_save(void)
{
uint8_t saved = 0;
ao_mutex_get(&ao_config_mutex);
}
#endif
-__code struct ao_cmds ao_config_cmds[] = {
+const struct ao_cmds ao_config_cmds[] = {
{ ao_config_set, "c <var> <value>\0Set config (? for help, s to show)" },
{ 0, NULL },
};
#define AO_AES_LEN 16
-extern __xdata uint8_t ao_config_aes_seq;
+extern uint8_t ao_config_aes_seq;
struct ao_config {
uint8_t major;
#define AO_CONFIG_DEFAULT_APRS_FORMAT AO_APRS_FORMAT_COMPRESSED
#if HAS_RADIO_FORWARD
-extern __xdata uint32_t ao_send_radio_setting;
+extern uint32_t ao_send_radio_setting;
#endif
#define AO_IGNITE_MODE_DUAL 0
/* Make sure AO_CONFIG_MAX_SIZE is big enough */
typedef uint8_t config_check_space[(int) (AO_CONFIG_MAX_SIZE - sizeof (struct ao_config))];
-extern __xdata struct ao_config ao_config;
-extern __pdata uint8_t ao_config_loaded;
+extern struct ao_config ao_config;
+extern uint8_t ao_config_loaded;
void
_ao_config_edit_start(void);
#define ALT_FRAC_MASK (ALT_FRAC_SCALE - 1)
ao_v_t
-ao_pres_to_altitude(int16_t pres) __reentrant
+ao_pres_to_altitude(int16_t pres)
{
uint8_t o;
int16_t part;
#if AO_NEED_ALTITUDE_TO_PRES
int16_t
-ao_altitude_to_pres(ao_v_t alt) __reentrant
+ao_altitude_to_pres(ao_v_t alt)
{
ao_v_t span, sub_span;
uint8_t l, h, m;
#if 0
int16_t
-ao_temp_to_dC(int16_t temp) __reentrant
+ao_temp_to_dC(int16_t temp)
{
int16_t ret;
#include <ao.h>
#include <ao_data.h>
-volatile __xdata struct ao_data ao_data_ring[AO_DATA_RING];
-volatile __data uint8_t ao_data_head;
-volatile __data uint8_t ao_data_present;
+volatile struct ao_data ao_data_ring[AO_DATA_RING];
+volatile uint8_t ao_data_head;
+volatile uint8_t ao_data_present;
#ifndef ao_data_count
void
-ao_data_get(__xdata struct ao_data *packet)
+ao_data_get(struct ao_data *packet)
{
#if HAS_FLIGHT
uint8_t i = ao_data_ring_prev(ao_sample_data);
/* Get a copy of the last complete sample set */
void
-ao_data_get(__xdata struct ao_data *packet);
+ao_data_get(struct ao_data *packet);
-extern volatile __xdata struct ao_data ao_data_ring[AO_DATA_RING];
-extern volatile __data uint8_t ao_data_head;
-extern volatile __data uint8_t ao_data_present;
-extern volatile __data uint8_t ao_data_count;
+extern volatile struct ao_data ao_data_ring[AO_DATA_RING];
+extern volatile uint8_t ao_data_head;
+extern volatile uint8_t ao_data_present;
+extern volatile uint8_t ao_data_count;
/*
* Mark a section of data as ready, check for data complete
* wants to call these functions
*/
uint8_t
-ao_ee_write_config(uint8_t *buf, uint16_t len) __reentrant
+ao_ee_write_config(uint8_t *buf, uint16_t len)
{
(void) buf;
(void) len;
}
uint8_t
-ao_ee_read_config(uint8_t *buf, uint16_t len) __reentrant
+ao_ee_read_config(uint8_t *buf, uint16_t len)
{
ao_xmemset(buf, '\0', len);
return 1;
*/
uint8_t
-ao_eeprom_write(ao_pos_t pos32, __xdata void *v, uint16_t len);
+ao_eeprom_write(ao_pos_t pos32, void *v, uint16_t len);
/*
* Read from eeprom
*/
uint8_t
-ao_eeprom_read(ao_pos_t pos, __xdata void *v, uint16_t len);
+ao_eeprom_read(ao_pos_t pos, void *v, uint16_t len);
/*
* Initialize eeprom
/* Main flight thread. */
-__pdata enum ao_flight_state ao_flight_state; /* current flight state */
-__pdata uint16_t ao_boost_tick; /* time of most recent boost detect */
-__pdata uint16_t ao_launch_tick; /* time of first boost detect */
-__pdata uint16_t ao_motor_number; /* number of motors burned so far */
+enum ao_flight_state ao_flight_state; /* current flight state */
+uint16_t ao_boost_tick; /* time of most recent boost detect */
+uint16_t ao_launch_tick; /* time of first boost detect */
+uint16_t ao_motor_number; /* number of motors burned so far */
#if HAS_SENSOR_ERRORS
/* Any sensor can set this to mark the flight computer as 'broken' */
-__xdata uint8_t ao_sensor_errors;
+uint8_t ao_sensor_errors;
#endif
/*
* track min/max data over a long interval to detect
* resting
*/
-static __data uint16_t ao_interval_end;
-static __data ao_v_t ao_interval_min_height;
-static __data ao_v_t ao_interval_max_height;
+static uint16_t ao_interval_end;
+static ao_v_t ao_interval_min_height;
+static ao_v_t ao_interval_max_height;
#if HAS_ACCEL
-static __data ao_v_t ao_coast_avg_accel;
+static ao_v_t ao_coast_avg_accel;
#endif
-__pdata uint8_t ao_flight_force_idle;
+uint8_t ao_flight_force_idle;
/* We also have a clock, which can be used to sanity check things in
* case of other failures
ao_orient_test = !ao_orient_test;
}
-__code struct ao_cmds ao_flight_cmds[] = {
+const struct ao_cmds ao_flight_cmds[] = {
{ ao_flight_dump, "F\0Dump flight status" },
{ ao_gyro_test, "G\0Test gyro code" },
{ ao_orient_test_select,"O\0Test orientation code" },
};
#endif
-static __xdata struct ao_task flight_task;
+static struct ao_task flight_task;
void
ao_flight_init(void)
ao_flight_test = 10
};
-extern __pdata enum ao_flight_state ao_flight_state;
-extern __pdata uint16_t ao_boost_tick;
-extern __pdata uint16_t ao_launch_tick;
-extern __pdata uint16_t ao_motor_number;
+extern enum ao_flight_state ao_flight_state;
+extern uint16_t ao_boost_tick;
+extern uint16_t ao_launch_tick;
+extern uint16_t ao_motor_number;
#if HAS_IMU || HAS_MMA655X
#define HAS_SENSOR_ERRORS 1
#endif
#if HAS_SENSOR_ERRORS
-extern __xdata uint8_t ao_sensor_errors;
+extern uint8_t ao_sensor_errors;
#endif
-extern __pdata uint16_t ao_launch_time;
-extern __pdata uint8_t ao_flight_force_idle;
+extern uint16_t ao_launch_time;
+extern uint8_t ao_flight_force_idle;
/* Flight thread */
void
/* Main flight thread. */
-__pdata enum ao_flight_state ao_flight_state; /* current flight state */
-__pdata uint16_t ao_launch_tick; /* time of launch detect */
+enum ao_flight_state ao_flight_state; /* current flight state */
+uint16_t ao_launch_tick; /* time of launch detect */
/*
* track min/max data over a long interval to detect
* resting
*/
-__pdata uint16_t ao_interval_end;
-__pdata alt_t ao_interval_min_height;
-__pdata alt_t ao_interval_max_height;
+uint16_t ao_interval_end;
+alt_t ao_interval_min_height;
+alt_t ao_interval_max_height;
-__pdata uint8_t ao_flight_force_idle;
+uint8_t ao_flight_force_idle;
/* Landing is detected by getting constant readings from both pressure and accelerometer
* for a fairly long time (AO_INTERVAL_TICKS)
}
}
-static __xdata struct ao_task flight_task;
+static struct ao_task flight_task;
void
ao_flight_nano_init(void)
ao_monitor_forward(void)
{
uint32_t recv_radio_setting;
- static __xdata struct ao_telemetry_all_recv packet;
+ static struct ao_telemetry_all_recv packet;
for (;;) {
while (ao_monitoring)
}
}
-static __xdata struct ao_task ao_monitor_forward_task;
+static struct ao_task ao_monitor_forward_task;
void
-ao_monitor_forward_init(void) __reentrant
+ao_monitor_forward_init(void)
{
ao_add_task(&ao_monitor_forward_task, ao_monitor_forward, "monitor_forward");
}
#define _AO_FORWARD_H_
void
-ao_monitor_forward_init(void) __reentrant;
+ao_monitor_forward_init(void);
#endif /* _AO_FORWARD_H_ */
* frequency, and updating the radio setting along the way
*/
-int32_t ao_freq_to_set(int32_t freq, int32_t cal) __reentrant
+int32_t ao_freq_to_set(int32_t freq, int32_t cal)
{
- static __pdata int32_t set;
- static __pdata uint8_t neg;
- static __pdata int32_t error;
+ static int32_t set;
+ static uint8_t neg;
+ static int32_t error;
set = 0;
neg = 0;
#endif
void
-ao_gps_print(__xdata struct ao_gps_orig *gps_data) __reentrant
+ao_gps_print(struct ao_gps_orig *gps_data)
{
char state;
}
void
-ao_gps_tracking_print(__xdata struct ao_gps_tracking_orig *gps_tracking_data) __reentrant
+ao_gps_tracking_print(struct ao_gps_tracking_orig *gps_tracking_data)
{
uint8_t c, n, v;
- __xdata struct ao_gps_sat_orig *sat;
+ struct ao_gps_sat_orig *sat;
n = gps_tracking_data->channels;
if (n == 0)
void
ao_gps_report(void)
{
- static __xdata struct ao_log_record gps_log;
- static __xdata struct ao_telemetry_location gps_data;
- static __xdata struct ao_telemetry_satellite gps_tracking_data;
+ static struct ao_log_record gps_log;
+ static struct ao_telemetry_location gps_data;
+ static struct ao_telemetry_satellite gps_tracking_data;
uint8_t date_reported = 0;
uint8_t new;
}
}
-__xdata struct ao_task ao_gps_report_task;
+struct ao_task ao_gps_report_task;
void
ao_gps_report_init(void)
void
ao_gps_report_mega(void)
{
- static __xdata struct ao_log_mega gps_log;
- static __xdata struct ao_telemetry_location gps_data;
- static __xdata struct ao_telemetry_satellite gps_tracking_data;
+ static struct ao_log_mega gps_log;
+ static struct ao_telemetry_location gps_data;
+ static struct ao_telemetry_satellite gps_tracking_data;
uint8_t new;
uint8_t c, n, i;
}
}
-__xdata struct ao_task ao_gps_report_mega_task;
+struct ao_task ao_gps_report_mega_task;
void
ao_gps_report_mega_init(void)
void
ao_gps_report_metrum(void)
{
- static __xdata struct ao_log_metrum gps_log;
- static __xdata struct ao_telemetry_location gps_data;
- static __xdata struct ao_telemetry_satellite gps_tracking_data;
+ static struct ao_log_metrum gps_log;
+ static struct ao_telemetry_location gps_data;
+ static struct ao_telemetry_satellite gps_tracking_data;
uint8_t c, n, i;
uint8_t svid;
uint8_t new;
}
}
-__xdata struct ao_task ao_gps_report_metrum_task;
+struct ao_task ao_gps_report_metrum_task;
void
ao_gps_report_metrum_init(void)
#include <ao_data.h>
void
-ao_gps_show(void) __reentrant
+ao_gps_show(void)
{
uint8_t i;
ao_mutex_get(&ao_gps_mutex);
int16_t sense_m; /* main continuity sense */
};
-#define __pdata
-#define __data
-#define __xdata
-#define __code
-#define __reentrant
+#define const
#define a (a)
#define a (a)
#endif
#if HAS_IGNITE
-__xdata struct ao_ignition ao_ignition[2];
+struct ao_ignition ao_ignition[2];
void
ao_ignite(enum ao_igniter igniter)
enum ao_igniter_status
ao_igniter_status(enum ao_igniter igniter)
{
- __xdata struct ao_data packet;
- __pdata int16_t value;
- __pdata uint8_t request, firing, fired;
+ struct ao_data packet;
+ int16_t value;
+ uint8_t request, firing, fired;
ao_arch_critical(
ao_data_get(&packet);
void
ao_igniter(void)
{
- __xdata enum ao_igniter igniter;
+ enum ao_igniter igniter;
ao_config_get();
for (;;) {
ao_cmd_status = ao_cmd_syntax_error;
}
-__code char * __code ao_igniter_status_names[] = {
+const char * const ao_igniter_status_names[] = {
"unknown", "ready", "active", "open"
};
#if HAS_IGNITE
void
-ao_ignite_print_status(enum ao_igniter igniter, __code char *name) __reentrant
+ao_ignite_print_status(enum ao_igniter igniter, const char *name)
{
enum ao_igniter_status status = ao_igniter_status(igniter);
printf("Igniter: %6s Status: %s\n",
#endif
}
-__code struct ao_cmds ao_ignite_cmds[] = {
+const struct ao_cmds ao_ignite_cmds[] = {
{ ao_ignite_manual, "i <key> {main|drogue}\0Fire igniter. <key> is doit with D&I" },
{ ao_ignite_test, "t\0Test igniter" },
{ 0, NULL },
};
#if HAS_IGNITE
-__xdata struct ao_task ao_igniter_task;
+struct ao_task ao_igniter_task;
void
ao_ignite_set_pins(void)
#include <ao_int64.h>
-void ao_plus64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, __pdata ao_int64_t *b) __FATTR {
+void ao_plus64(ao_int64_t *r, ao_int64_t *a, ao_int64_t *b) __FATTR {
__LOCAL uint32_t t;
r->high = a->high + b->high;
r->low = t;
}
-void ao_minus64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, __pdata ao_int64_t *b) __FATTR {
+void ao_minus64(ao_int64_t *r, ao_int64_t *a, ao_int64_t *b) __FATTR {
__LOCAL uint32_t t;
r->high = a->high - b->high;
r->low = t;
}
-void ao_rshift64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, uint8_t d) __FATTR {
+void ao_rshift64(ao_int64_t *r, ao_int64_t *a, uint8_t d) __FATTR {
if (d < 32) {
r->low = a->low >> d;
if (d)
}
}
-void ao_lshift64(__pdata ao_int64_t *r, __pdata ao_int64_t *a, uint8_t d) __FATTR {
+void ao_lshift64(ao_int64_t *r, ao_int64_t *a, uint8_t d) __FATTR {
if (d < 32) {
r->high = a->high << d;
if (d)
}
}
-static void ao_umul64_32_32(__ARG ao_int64_t *r, uint32_t a, uint32_t b) __reentrant {
+static void ao_umul64_32_32(__ARG ao_int64_t *r, uint32_t a, uint32_t b) {
__LOCAL uint32_t s;
__LOCAL ao_int64_t t;
r->low = (uint32_t) (uint16_t) a * (uint16_t) b;
ao_plus64(r, r, &t);
}
-void ao_neg64(__pdata ao_int64_t *r, __pdata ao_int64_t *a) __FATTR {
+void ao_neg64(ao_int64_t *r, ao_int64_t *a) __FATTR {
r->high = ~a->high;
if (!(r->low = ~a->low + 1))
r->high++;
ao_neg64(r, r);
}
-static void ao_umul64(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG ao_int64_t *b) __reentrant {
+static void ao_umul64(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG ao_int64_t *b) {
__LOCAL ao_int64_t r2, r3;
ao_umul64_32_32(&r2, a->high, b->low);
ao_neg64(r, r);
}
-static void ao_umul64_64_16(__ARG ao_int64_t *r, __ARG ao_int64_t *a, uint16_t b) __reentrant {
+static void ao_umul64_64_16(__ARG ao_int64_t *r, __ARG ao_int64_t *a, uint16_t b) {
__LOCAL uint32_t h;
h = a->high * b;
} ao_int64_t;
#define __FATTR
-#define __ARG __pdata
-#define __LOCAL static __pdata
-
-void ao_plus64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, __pdata ao_int64_t *ao_64b) __FATTR;
-void ao_minus64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, __pdata ao_int64_t *ao_64b) __FATTR;
-void ao_neg64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a) __FATTR;
-void ao_rshift64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, uint8_t d) __FATTR;
-void ao_lshift64(__pdata ao_int64_t *ao_64r, __pdata ao_int64_t *ao_64a, uint8_t d) __FATTR;
+#define __ARG
+#define __LOCAL static
+
+void ao_plus64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, ao_int64_t *ao_64b) __FATTR;
+void ao_minus64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, ao_int64_t *ao_64b) __FATTR;
+void ao_neg64(ao_int64_t *ao_64r, ao_int64_t *ao_64a) __FATTR;
+void ao_rshift64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, uint8_t d) __FATTR;
+void ao_lshift64(ao_int64_t *ao_64r, ao_int64_t *ao_64a, uint8_t d) __FATTR;
void ao_mul64_32_32(__ARG ao_int64_t *r, __ARG int32_t a, __ARG int32_t b) __FATTR;
void ao_mul64_64_16(__ARG ao_int64_t *r, __ARG ao_int64_t *a, __ARG uint16_t b) __FATTR;
void ao_mul64(__ARG ao_int64_t * __ARG r, __ARG ao_int64_t * __ARG a, __ARG ao_int64_t *__ARG b) __FATTR;
#include "ao_sample.h"
#include "ao_kalman.h"
-static __pdata ao_k_t ao_k_height;
-static __pdata ao_k_t ao_k_speed;
-static __pdata ao_k_t ao_k_accel;
+static ao_k_t ao_k_height;
+static ao_k_t ao_k_speed;
+static ao_k_t ao_k_accel;
#define AO_K_STEP_100 to_fix_v(0.01)
#define AO_K_STEP_2_2_100 to_fix_v(0.00005)
#define AO_K_STEP_1 to_fix_v(1)
#define AO_K_STEP_2_2_1 to_fix_v(0.5)
-__pdata ao_v_t ao_height;
-__pdata ao_v_t ao_speed;
-__pdata ao_v_t ao_accel;
-__xdata ao_v_t ao_max_height;
-static __pdata ao_k_t ao_avg_height_scaled;
-__xdata ao_v_t ao_avg_height;
+ao_v_t ao_height;
+ao_v_t ao_speed;
+ao_v_t ao_accel;
+ao_v_t ao_max_height;
+static ao_k_t ao_avg_height_scaled;
+ao_v_t ao_avg_height;
-__pdata ao_v_t ao_error_h;
+ao_v_t ao_error_h;
#if !HAS_ACCEL || AO_FLIGHT_TEST
#define AO_ERROR_H_SQ_AVG 1
#endif
#if AO_ERROR_H_SQ_AVG
-__pdata ao_v_t ao_error_h_sq_avg;
+ao_v_t ao_error_h_sq_avg;
#endif
#if HAS_ACCEL
-__pdata ao_v_t ao_error_a;
+ao_v_t ao_error_a;
#endif
static void
/* Turn on the specified LEDs for the indicated interval */
void
-ao_led_for(AO_LED_TYPE colors, uint16_t ticks) __reentrant;
+ao_led_for(AO_LED_TYPE colors, uint16_t ticks);
/* Initialize the LEDs */
void
#include <ao_tracker.h>
#endif
-__xdata uint8_t ao_log_mutex;
-__pdata uint32_t ao_log_current_pos;
-__pdata uint32_t ao_log_end_pos;
-__pdata uint32_t ao_log_start_pos;
-__xdata uint8_t ao_log_running;
-__pdata enum ao_flight_state ao_log_state;
-__xdata int16_t ao_flight_number;
+uint8_t ao_log_mutex;
+uint32_t ao_log_current_pos;
+uint32_t ao_log_end_pos;
+uint32_t ao_log_start_pos;
+uint8_t ao_log_running;
+enum ao_flight_state ao_log_state;
+int16_t ao_flight_number;
void
ao_log_flush(void)
uint16_t flight;
};
-static __xdata struct ao_log_erase erase;
+static struct ao_log_erase erase;
#ifndef LOG_MAX_ERASE
#define LOG_MAX_ERASE 16
* structure.
*/
-__xdata ao_log_type ao_log_data;
+ao_log_type ao_log_data;
static uint8_t
-ao_log_csum(__xdata uint8_t *b) __reentrant
+ao_log_csum(uint8_t *b)
{
uint8_t sum = 0x5a;
uint8_t i;
}
uint8_t
-ao_log_write(__xdata ao_log_type *log) __reentrant
+ao_log_write(ao_log_type *log)
{
uint8_t wrote = 0;
/* set checksum */
log->csum = 0;
- log->csum = ao_log_csum((__xdata uint8_t *) log);
+ log->csum = ao_log_csum((uint8_t *) log);
ao_mutex_get(&ao_log_mutex); {
if (ao_log_current_pos >= ao_log_end_pos && ao_log_running)
ao_log_stop();
}
static void
-ao_log_erase(uint8_t slot) __reentrant
+ao_log_erase(uint8_t slot)
{
uint32_t log_current_pos, log_end_pos;
log_end_pos = log_current_pos + ao_config.flight_log_max;
while (log_current_pos < log_end_pos) {
uint8_t i;
- static __xdata uint8_t b;
+ static uint8_t b;
/*
* Check to see if we've reached the end of
}
static void
-ao_log_find_max_erase_flight(void) __reentrant
+ao_log_find_max_erase_flight(void)
{
uint8_t log_slot;
}
uint8_t
-ao_log_scan(void) __reentrant
+ao_log_scan(void)
{
uint8_t log_slot;
uint8_t log_slots;
#endif
#if LOG_ADC
-static __xdata struct ao_task ao_log_task;
+static struct ao_task ao_log_task;
#endif
void
-ao_log_list(void) __reentrant
+ao_log_list(void)
{
uint8_t slot;
uint8_t slots;
}
void
-ao_log_delete(void) __reentrant
+ao_log_delete(void)
{
uint8_t slot;
uint8_t slots;
printf("No such flight: %d\n", cmd_flight);
}
-__code struct ao_cmds ao_log_cmds[] = {
+const struct ao_cmds ao_log_cmds[] = {
{ ao_log_list, "l\0List logs" },
{ ao_log_delete, "d <flight-number>\0Delete flight" },
{ 0, NULL },
* the log. Tasks may wait for this to be initialized
* by sleeping on this variable.
*/
-extern __xdata int16_t ao_flight_number;
-extern __xdata uint8_t ao_log_mutex;
-extern __pdata uint32_t ao_log_current_pos;
-extern __pdata uint32_t ao_log_end_pos;
-extern __pdata uint32_t ao_log_start_pos;
-extern __xdata uint8_t ao_log_running;
-extern __pdata enum ao_flight_state ao_log_state;
+extern int16_t ao_flight_number;
+extern uint8_t ao_log_mutex;
+extern uint32_t ao_log_current_pos;
+extern uint32_t ao_log_end_pos;
+extern uint32_t ao_log_start_pos;
+extern uint8_t ao_log_running;
+extern enum ao_flight_state ao_log_state;
/* required functions from the underlying log system */
/* Figure out the current flight number */
uint8_t
-ao_log_scan(void) __reentrant;
+ao_log_scan(void);
/* Return the position of the start of the given log slot */
uint32_t
#endif
#ifndef AO_LOG_UNCOMMON
-extern __xdata ao_log_type ao_log_data;
+extern ao_log_type ao_log_data;
#define AO_LOG_SIZE sizeof(ao_log_type)
/* Write a record to the eeprom log */
uint8_t
-ao_log_write(__xdata ao_log_type *log) __reentrant;
+ao_log_write(ao_log_type *log);
#endif
void
#include "ao.h"
-static __data uint8_t ao_log_data_pos;
+static uint8_t ao_log_data_pos;
/* a hack to make sure that ao_log_records fill the eeprom block in even units */
typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_record))] ;
void
ao_log(void)
{
- __pdata uint16_t next_sensor, next_other;
+ uint16_t next_sensor, next_other;
ao_storage_setup();
#include <ao_data.h>
#include <ao_flight.h>
-static __xdata struct ao_log_firetwo log;
+static struct ao_log_firetwo log;
-__code uint8_t ao_log_format = AO_LOG_FORMAT_TELEFIRETWO;
+const uint8_t ao_log_format = AO_LOG_FORMAT_TELEFIRETWO;
static uint8_t
-ao_log_csum(__xdata uint8_t *b) __reentrant
+ao_log_csum(uint8_t *b)
{
uint8_t sum = 0x5a;
uint8_t i;
}
uint8_t
-ao_log_firetwo(__xdata struct ao_log_firetwo *log) __reentrant
+ao_log_firetwo(struct ao_log_firetwo *log)
{
uint8_t wrote = 0;
/* set checksum */
log->csum = 0;
- log->csum = ao_log_csum((__xdata uint8_t *) log);
+ log->csum = ao_log_csum((uint8_t *) log);
ao_mutex_get(&ao_log_mutex); {
if (ao_log_current_pos >= ao_log_end_pos && ao_log_running)
ao_log_stop();
}
#if HAS_ADC
-static __data uint8_t ao_log_data_pos;
+static uint8_t ao_log_data_pos;
/* a hack to make sure that ao_log_metrums fill the eeprom block in even units */
typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_firetwo))] ;
#include <ao_flight.h>
#if HAS_FLIGHT
-static __data uint8_t ao_log_data_pos;
+static uint8_t ao_log_data_pos;
/* a hack to make sure that ao_log_megas fill the eeprom block in even units */
typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_mega))] ;
void
ao_log(void)
{
- __pdata uint16_t next_sensor, next_other;
+ uint16_t next_sensor, next_other;
uint8_t i;
ao_storage_setup();
#include <ao_flight.h>
#if HAS_ADC
-static __data uint8_t ao_log_data_pos;
+static uint8_t ao_log_data_pos;
/* a hack to make sure that ao_log_metrums fill the eeprom block in even units */
typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_metrum))] ;
void
ao_log(void)
{
- __pdata uint16_t next_sensor, next_other;
+ uint16_t next_sensor, next_other;
ao_storage_setup();
#include <ao_data.h>
#include <ao_flight.h>
-static __data uint8_t ao_log_data_pos;
+static uint8_t ao_log_data_pos;
/* a hack to make sure that ao_log_minis fill the eeprom block in even units */
typedef uint8_t check_log_size[1-(256 % sizeof(struct ao_log_mini))] ;
void
ao_log(void)
{
- __pdata uint16_t next_sensor;
+ uint16_t next_sensor;
ao_storage_setup();
#include "ao.h"
#include "ao_product.h"
-static __xdata struct ao_task ao_log_single_task;
+static struct ao_task ao_log_single_task;
-__xdata uint8_t ao_log_running;
-__xdata uint8_t ao_log_mutex;
-__pdata uint32_t ao_log_start_pos;
-__pdata uint32_t ao_log_end_pos;
-__pdata uint32_t ao_log_current_pos;
+uint8_t ao_log_running;
+uint8_t ao_log_mutex;
+uint32_t ao_log_start_pos;
+uint32_t ao_log_end_pos;
+uint32_t ao_log_current_pos;
-__xdata union ao_log_single ao_log_single_write_data;
-__xdata union ao_log_single ao_log_single_read_data;
+union ao_log_single ao_log_single_write_data;
+union ao_log_single ao_log_single_read_data;
uint8_t
ao_log_single_write(void)
static uint8_t
ao_log_single_valid(void)
{
- __xdata uint8_t *d = ao_log_single_read_data.bytes;
+ uint8_t *d = ao_log_single_read_data.bytes;
uint8_t i;
for (i = 0; i < AO_LOG_SINGLE_SIZE; i++)
if (*d++ != 0xff)
#include <ao_flight.h>
#include <ao_sample.h>
-__code uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY;
+const uint8_t ao_log_format = AO_LOG_FORMAT_TELEMETRY;
-static __data uint8_t ao_log_monitor_pos;
-__pdata enum ao_flight_state ao_flight_state;
-__xdata int16_t ao_max_height; /* max of ao_height */
-__pdata int16_t sense_d, sense_m;
-__pdata uint8_t ao_igniter_present;
+static uint8_t ao_log_monitor_pos;
+enum ao_flight_state ao_flight_state;
+int16_t ao_max_height; /* max of ao_height */
+int16_t sense_d, sense_m;
+uint8_t ao_igniter_present;
static void
ao_log_telem_track() {
static uint8_t ao_log_data_pos;
-__code uint8_t ao_log_format = AO_LOG_FORMAT_TELESCIENCE;
+const uint8_t ao_log_format = AO_LOG_FORMAT_TELESCIENCE;
static void
-ao_log_telescience_csum(void) __reentrant
+ao_log_telescience_csum(void)
{
- __xdata uint8_t *b = ao_log_single_write_data.bytes;
+ uint8_t *b = ao_log_single_write_data.bytes;
uint8_t sum = 0x5a;
uint8_t i;
#include "ao.h"
-static __data uint16_t ao_log_tiny_interval;
+static uint16_t ao_log_tiny_interval;
#define AO_LOG_TINY_INTERVAL_DEFAULT AO_MS_TO_TICKS(1000)
#if USE_FAST_ASCENT_LOG
}
}
-static __xdata uint16_t ao_log_pad_ring[AO_PAD_RING];
-static __pdata uint8_t ao_log_pad_ring_pos;
+static uint16_t ao_log_pad_ring[AO_PAD_RING];
+static uint8_t ao_log_pad_ring_pos;
#define ao_pad_ring_next(n) (((n) + 1) & (AO_PAD_RING - 1))
int16_t
ao_log_flight(uint8_t slot)
{
- static __xdata uint16_t flight;
+ static uint16_t flight;
(void) slot;
ao_storage_read(0, &flight, 2);
#error Must define AO_MONITOR_LED
#endif
-__xdata uint8_t ao_monitoring_mutex;
-__data uint8_t ao_monitoring;
-static __data uint8_t ao_monitor_disabled;
-static __data uint8_t ao_internal_monitoring;
-static __data uint8_t ao_external_monitoring;
+uint8_t ao_monitoring_mutex;
+uint8_t ao_monitoring;
+static uint8_t ao_monitor_disabled;
+static uint8_t ao_internal_monitoring;
+static uint8_t ao_external_monitoring;
-__xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
+union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
-__data uint8_t ao_monitor_head;
+uint8_t ao_monitor_head;
static void
_ao_monitor_adjust(void)
}
#if AO_MONITOR_LED
-__xdata struct ao_task ao_monitor_blink_task;
+struct ao_task ao_monitor_blink_task;
void
ao_monitor_blink(void)
ao_monitor_put(void)
{
#if LEGACY_MONITOR
- __xdata char callsign[AO_MAX_CALLSIGN+1];
+ char callsign[AO_MAX_CALLSIGN+1];
#endif
#if LEGACY_MONITOR || HAS_RSSI
int16_t rssi;
uint8_t ao_monitor_tail;
uint8_t state;
uint8_t sum, byte;
- __xdata union ao_monitor *m;
+ union ao_monitor *m;
#define recv_raw ((m->raw))
#define recv_orig ((m->orig))
}
}
-__xdata struct ao_task ao_monitor_put_task;
+struct ao_task ao_monitor_put_task;
#endif
-__xdata struct ao_task ao_monitor_get_task;
+struct ao_task ao_monitor_get_task;
void
ao_monitor_set(uint8_t monitoring)
_ao_monitor_adjust();
}
-__code struct ao_cmds ao_monitor_cmds[] = {
+const struct ao_cmds ao_monitor_cmds[] = {
{ set_monitor, "m <0 off, 1 old, 20 std>\0Set radio monitoring" },
{ 0, NULL },
};
#endif
void
-ao_monitor_init(void) __reentrant
+ao_monitor_init(void)
{
#if HAS_MONITOR_PUT
ao_cmd_register(&ao_monitor_cmds[0]);
#if HAS_MUTEX_TRY
uint8_t
-ao_mutex_try(__xdata uint8_t *mutex, uint8_t task_id) __reentrant
+ao_mutex_try(uint8_t *mutex, uint8_t task_id)
{
uint8_t ret;
if (*mutex == task_id)
#endif
void
-ao_mutex_get(__xdata uint8_t *mutex) __reentrant
+ao_mutex_get(uint8_t *mutex)
{
if (*mutex == ao_cur_task->task_id)
ao_panic(AO_PANIC_MUTEX);
}
void
-ao_mutex_put(__xdata uint8_t *mutex) __reentrant
+ao_mutex_put(uint8_t *mutex)
{
if (*mutex != ao_cur_task->task_id)
ao_panic(AO_PANIC_MUTEX);
static volatile void *ao_wchan;
uint8_t
-ao_sleep(__xdata void *wchan)
+ao_sleep(void *wchan)
{
#if 1
ao_wchan = wchan;
#endif
void
-ao_wakeup(__xdata void *wchan)
+ao_wakeup(void *wchan)
{
(void) wchan;
ao_wchan = 0;
#define _AO_NOTASK_H_
uint8_t
-ao_sleep(__xdata void *wchan);
+ao_sleep(void *wchan);
void
-ao_wakeup(__xdata void *wchan);
+ao_wakeup(void *wchan);
#endif /* _AO_NOTASK_H_ */
uint8_t status;
};
-extern __xdata struct ao_packet_recv ao_rx_packet;
-extern __xdata struct ao_packet ao_tx_packet;
-extern __xdata struct ao_task ao_packet_task;
-extern __xdata uint8_t ao_packet_enable;
-extern __xdata uint8_t ao_packet_master_sleeping;
-extern __pdata uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used;
-extern __xdata uint8_t ao_packet_restart;
+extern struct ao_packet_recv ao_rx_packet;
+extern struct ao_packet ao_tx_packet;
+extern struct ao_task ao_packet_task;
+extern uint8_t ao_packet_enable;
+extern uint8_t ao_packet_master_sleeping;
+extern uint8_t ao_packet_rx_len, ao_packet_rx_used, ao_packet_tx_used;
+extern uint8_t ao_packet_restart;
void
ao_packet_send(void);
ao_packet_flush(void);
void
-ao_packet_putchar(char c) __reentrant;
+ao_packet_putchar(char c);
int
_ao_packet_pollchar(void);
#if PACKET_HAS_MASTER
/* ao_packet_master.c */
-extern __xdata int8_t ao_packet_last_rssi;
+extern int8_t ao_packet_last_rssi;
void
ao_packet_master_init(void);
enum ao_igniter_status
ao_pyro_status(uint8_t p)
{
- __xdata struct ao_data packet;
- __pdata int16_t value;
+ struct ao_data packet;
+ int16_t value;
ao_arch_critical(
ao_data_get(&packet);
ao_exit();
}
-__xdata struct ao_task ao_pyro_task;
+struct ao_task ao_pyro_task;
static void
#include <ao.h>
#include <ao_radio_cmac.h>
-static __xdata uint8_t ao_radio_cmac_mutex;
-__pdata int8_t ao_radio_cmac_rssi;
-static __xdata uint8_t cmac_data[AO_CMAC_MAX_LEN + AO_CMAC_KEY_LEN + 2 + AO_CMAC_KEY_LEN];
+static uint8_t ao_radio_cmac_mutex;
+int8_t ao_radio_cmac_rssi;
+static uint8_t cmac_data[AO_CMAC_MAX_LEN + AO_CMAC_KEY_LEN + 2 + AO_CMAC_KEY_LEN];
static uint8_t
round_len(uint8_t len)
* Sign and deliver the data sitting in the cmac buffer
*/
static void
-radio_cmac_send(uint8_t len) __reentrant
+radio_cmac_send(uint8_t len)
{
uint8_t i;
*/
static int8_t
-radio_cmac_recv(uint8_t len, uint16_t timeout) __reentrant
+radio_cmac_recv(uint8_t len, uint16_t timeout)
{
uint8_t i;
}
int8_t
-ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant
+ao_radio_cmac_send(void *packet, uint8_t len)
{
if (len > AO_CMAC_MAX_LEN)
return AO_RADIO_CMAC_LEN_ERROR;
}
int8_t
-ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentrant
+ao_radio_cmac_recv(void *packet, uint8_t len, uint16_t timeout)
{
int8_t i;
if (len > AO_CMAC_MAX_LEN)
#define AO_CMAC_KEY_LEN AO_AES_LEN
#define AO_CMAC_MAX_LEN (128 - AO_CMAC_KEY_LEN)
-extern __pdata int8_t ao_radio_cmac_rssi;
+extern int8_t ao_radio_cmac_rssi;
int8_t
-ao_radio_cmac_send(__xdata void *packet, uint8_t len) __reentrant;
+ao_radio_cmac_send(void *packet, uint8_t len);
#define AO_RADIO_CMAC_OK 0
#define AO_RADIO_CMAC_LEN_ERROR -1
#define AO_RADIO_CMAC_TIMEOUT -4
int8_t
-ao_radio_cmac_recv(__xdata void *packet, uint8_t len, uint16_t timeout) __reentrant;
+ao_radio_cmac_recv(void *packet, uint8_t len, uint16_t timeout);
void
ao_radio_cmac_init(void);
#include <ao_radio_cmac_cmd.h>
#include <ao_radio_cmac.h>
-static __xdata uint8_t cmac_data[AO_CMAC_MAX_LEN];
+static uint8_t cmac_data[AO_CMAC_MAX_LEN];
static uint8_t
getnibble(void)
}
static void
-radio_cmac_send_cmd(void) __reentrant
+radio_cmac_send_cmd(void)
{
uint8_t i;
uint8_t len;
}
static void
-radio_cmac_recv_cmd(void) __reentrant
+radio_cmac_recv_cmd(void)
{
uint8_t len, i;
uint16_t timeout;
printf ("ERROR %d %d\n", i, ao_radio_cmac_rssi);
}
-static __code struct ao_cmds ao_radio_cmac_cmds[] = {
+static const struct ao_cmds ao_radio_cmac_cmds[] = {
{ radio_cmac_send_cmd, "s <length>\0Send AES-CMAC packet. Bytes to send follow on next line" },
{ radio_cmac_recv_cmd, "S <length> <timeout>\0Receive AES-CMAC packet. Timeout in ms" },
{ 0, NULL },
#endif
#define pause(time) ao_delay(time)
-static __pdata enum ao_flight_state ao_report_state;
+static enum ao_flight_state ao_report_state;
/*
* Farnsworth spacing
*/
static void
-ao_report_beep(void) __reentrant
+ao_report_beep(void)
{
uint8_t r = flight_reports[ao_flight_state];
uint8_t l = r & 7;
}
static void
-ao_report_digit(uint8_t digit) __reentrant
+ao_report_digit(uint8_t digit)
{
if (!digit) {
mid(AO_MS_TO_TICKS(500));
static void
ao_report_number(int16_t n)
{
- __xdata uint8_t digits[10];
- __pdata uint8_t ndigits, i;
+ uint8_t digits[10];
+ uint8_t ndigits, i;
if (n < 0)
n = 0;
static void
ao_report_battery(void)
{
- __xdata struct ao_data packet;
+ struct ao_data packet;
for (;;) {
ao_data_get(&packet);
if (packet.adc.v_batt != 0)
}
static void
-ao_report_continuity(void) __reentrant
+ao_report_continuity(void)
{
uint8_t c;
}
}
-static __xdata struct ao_task ao_report_task;
+static struct ao_task ao_report_task;
void
ao_report_init(void)
#define pause(time) ao_delay(time)
static void
-ao_report_digit(uint8_t digit) __reentrant
+ao_report_digit(uint8_t digit)
{
if (!digit) {
mid(AO_MS_TO_TICKS(1000));
void
ao_report_altitude(void)
{
- __pdata alt_t agl = ao_max_height;
- static __xdata uint8_t digits[11];
- __pdata uint8_t ndigits, i;
+ alt_t agl = ao_max_height;
+ static uint8_t digits[11];
+ uint8_t ndigits, i;
if (agl < 0)
agl = 0;
#include "ao.h"
-static __xdata uint16_t ao_rssi_time;
-static __pdata uint16_t ao_rssi_delay;
-static __pdata AO_LED_TYPE ao_rssi_led;
+static uint16_t ao_rssi_time;
+static uint16_t ao_rssi_delay;
+static AO_LED_TYPE ao_rssi_led;
void
ao_rssi(void)
ao_wakeup(&ao_rssi_time);
}
-__xdata struct ao_task ao_rssi_task;
+struct ao_task ao_rssi_task;
void
ao_rssi_init(AO_LED_TYPE rssi_led)
#define ACCEL_TYPE int16_t
#endif
-__pdata uint16_t ao_sample_tick; /* time of last data */
-__pdata pres_t ao_sample_pres;
-__pdata alt_t ao_sample_alt;
-__pdata alt_t ao_sample_height;
+uint16_t ao_sample_tick; /* time of last data */
+pres_t ao_sample_pres;
+alt_t ao_sample_alt;
+alt_t ao_sample_height;
#if HAS_ACCEL
-__pdata accel_t ao_sample_accel;
+accel_t ao_sample_accel;
#endif
#if HAS_GYRO
-__pdata accel_t ao_sample_accel_along;
-__pdata accel_t ao_sample_accel_across;
-__pdata accel_t ao_sample_accel_through;
-__pdata gyro_t ao_sample_roll;
-__pdata gyro_t ao_sample_pitch;
-__pdata gyro_t ao_sample_yaw;
-__pdata angle_t ao_sample_orient;
-__pdata angle_t ao_sample_orients[AO_NUM_ORIENT];
-__pdata uint8_t ao_sample_orient_pos;
+accel_t ao_sample_accel_along;
+accel_t ao_sample_accel_across;
+accel_t ao_sample_accel_through;
+gyro_t ao_sample_roll;
+gyro_t ao_sample_pitch;
+gyro_t ao_sample_yaw;
+angle_t ao_sample_orient;
+angle_t ao_sample_orients[AO_NUM_ORIENT];
+uint8_t ao_sample_orient_pos;
#endif
-__data uint8_t ao_sample_data;
+uint8_t ao_sample_data;
/*
* Sensor calibration values
*/
-__pdata pres_t ao_ground_pres; /* startup pressure */
-__pdata alt_t ao_ground_height; /* MSL of ao_ground_pres */
+pres_t ao_ground_pres; /* startup pressure */
+alt_t ao_ground_height; /* MSL of ao_ground_pres */
#if HAS_ACCEL
-__pdata accel_t ao_ground_accel; /* startup acceleration */
-__pdata accel_t ao_accel_2g; /* factory accel calibration */
-__pdata int32_t ao_accel_scale; /* sensor to m/s² conversion */
+accel_t ao_ground_accel; /* startup acceleration */
+accel_t ao_accel_2g; /* factory accel calibration */
+int32_t ao_accel_scale; /* sensor to m/s² conversion */
#endif
#if HAS_GYRO
-__pdata accel_t ao_ground_accel_along;
-__pdata accel_t ao_ground_accel_across;
-__pdata accel_t ao_ground_accel_through;
-__pdata int32_t ao_ground_pitch;
-__pdata int32_t ao_ground_yaw;
-__pdata int32_t ao_ground_roll;
+accel_t ao_ground_accel_along;
+accel_t ao_ground_accel_across;
+accel_t ao_ground_accel_through;
+int32_t ao_ground_pitch;
+int32_t ao_ground_yaw;
+int32_t ao_ground_roll;
#endif
-static __pdata uint8_t ao_preflight; /* in preflight mode */
+static uint8_t ao_preflight; /* in preflight mode */
-static __pdata uint16_t nsamples;
-__pdata int32_t ao_sample_pres_sum;
+static uint16_t nsamples;
+int32_t ao_sample_pres_sum;
#if HAS_ACCEL
-__pdata int32_t ao_sample_accel_sum;
+int32_t ao_sample_accel_sum;
#endif
#if HAS_GYRO
-__pdata int32_t ao_sample_accel_along_sum;
-__pdata int32_t ao_sample_accel_across_sum;
-__pdata int32_t ao_sample_accel_through_sum;
-__pdata int32_t ao_sample_pitch_sum;
-__pdata int32_t ao_sample_yaw_sum;
-__pdata int32_t ao_sample_roll_sum;
+int32_t ao_sample_accel_along_sum;
+int32_t ao_sample_accel_across_sum;
+int32_t ao_sample_accel_through_sum;
+int32_t ao_sample_pitch_sum;
+int32_t ao_sample_yaw_sum;
+int32_t ao_sample_roll_sum;
static struct ao_quaternion ao_rotation;
#endif
ao_wakeup(&ao_sample_data);
ao_sleep((void *) &ao_data_head);
while (ao_sample_data != ao_data_head) {
- __xdata struct ao_data *ao_data;
+ struct ao_data *ao_data;
/* Capture a sample */
ao_data = (struct ao_data *) &ao_data_ring[ao_sample_data];
#define AO_MS_TO_SPEED(ms) ((ao_v_t) ((ms) * 16))
#define AO_MSS_TO_ACCEL(mss) ((ao_v_t) ((mss) * 16))
-extern __pdata uint16_t ao_sample_tick; /* time of last data */
-extern __data uint8_t ao_sample_adc; /* Ring position of last processed sample */
-extern __data uint8_t ao_sample_data; /* Ring position of last processed sample */
+extern uint16_t ao_sample_tick; /* time of last data */
+extern uint8_t ao_sample_adc; /* Ring position of last processed sample */
+extern uint8_t ao_sample_data; /* Ring position of last processed sample */
#if HAS_BARO
-extern __pdata pres_t ao_sample_pres; /* most recent pressure sensor reading */
-extern __pdata alt_t ao_sample_alt; /* MSL of ao_sample_pres */
-extern __pdata alt_t ao_sample_height; /* AGL of ao_sample_pres */
-extern __pdata pres_t ao_ground_pres; /* startup pressure */
-extern __pdata alt_t ao_ground_height; /* MSL of ao_ground_pres */
+extern pres_t ao_sample_pres; /* most recent pressure sensor reading */
+extern alt_t ao_sample_alt; /* MSL of ao_sample_pres */
+extern alt_t ao_sample_height; /* AGL of ao_sample_pres */
+extern pres_t ao_ground_pres; /* startup pressure */
+extern alt_t ao_ground_height; /* MSL of ao_ground_pres */
#endif
#if HAS_ACCEL
-extern __pdata accel_t ao_sample_accel; /* most recent accel sensor reading */
-extern __pdata accel_t ao_ground_accel; /* startup acceleration */
-extern __pdata accel_t ao_accel_2g; /* factory accel calibration */
-extern __pdata int32_t ao_accel_scale; /* sensor to m/s² conversion */
+extern accel_t ao_sample_accel; /* most recent accel sensor reading */
+extern accel_t ao_ground_accel; /* startup acceleration */
+extern accel_t ao_accel_2g; /* factory accel calibration */
+extern int32_t ao_accel_scale; /* sensor to m/s² conversion */
#endif
#if HAS_GYRO
-extern __pdata accel_t ao_ground_accel_along;
-extern __pdata accel_t ao_ground_accel_across;
-extern __pdata accel_t ao_ground_accel_through;
-extern __pdata int32_t ao_ground_pitch; /* * 512 */
-extern __pdata int32_t ao_ground_yaw; /* * 512 */
-extern __pdata int32_t ao_ground_roll; /* * 512 */
-extern __pdata accel_t ao_sample_accel_along;
-extern __pdata accel_t ao_sample_accel_across;
-extern __pdata accel_t ao_sample_accel_through;
-extern __pdata gyro_t ao_sample_roll;
-extern __pdata gyro_t ao_sample_pitch;
-extern __pdata gyro_t ao_sample_yaw;
+extern accel_t ao_ground_accel_along;
+extern accel_t ao_ground_accel_across;
+extern accel_t ao_ground_accel_through;
+extern int32_t ao_ground_pitch; /* * 512 */
+extern int32_t ao_ground_yaw; /* * 512 */
+extern int32_t ao_ground_roll; /* * 512 */
+extern accel_t ao_sample_accel_along;
+extern accel_t ao_sample_accel_across;
+extern accel_t ao_sample_accel_through;
+extern gyro_t ao_sample_roll;
+extern gyro_t ao_sample_pitch;
+extern gyro_t ao_sample_yaw;
#define AO_NUM_ORIENT 64
-extern __pdata angle_t ao_sample_orient;
-extern __pdata angle_t ao_sample_orients[AO_NUM_ORIENT];
-extern __pdata uint8_t ao_sample_orient_pos;
+extern angle_t ao_sample_orient;
+extern angle_t ao_sample_orients[AO_NUM_ORIENT];
+extern uint8_t ao_sample_orient_pos;
#endif
void ao_sample_init(void);
#define from_fix(x) ((x) >> 16)
-extern __pdata ao_v_t ao_height; /* meters */
-extern __pdata ao_v_t ao_speed; /* m/s * 16 */
-extern __pdata ao_v_t ao_accel; /* m/s² * 16 */
-extern __xdata ao_v_t ao_max_height; /* max of ao_height */
-extern __xdata ao_v_t ao_avg_height; /* running average of height */
+extern ao_v_t ao_height; /* meters */
+extern ao_v_t ao_speed; /* m/s * 16 */
+extern ao_v_t ao_accel; /* m/s² * 16 */
+extern ao_v_t ao_max_height; /* max of ao_height */
+extern ao_v_t ao_avg_height; /* running average of height */
-extern __pdata ao_v_t ao_error_h;
+extern ao_v_t ao_error_h;
#if !HAS_ACCEL
-extern __pdata ao_v_t ao_error_h_sq_avg;
+extern ao_v_t ao_error_h_sq_avg;
#endif
#if HAS_ACCEL
-extern __pdata ao_v_t ao_error_a;
+extern ao_v_t ao_error_a;
#endif
#endif
}
}
-static __code struct ao_cmds ao_sample_profile_cmds[] = {
+static const struct ao_cmds ao_sample_profile_cmds[] = {
{ ao_sample_profile_cmd, "S <1 start,0 stop, d dump,c clear>\0Sample profile" },
{ 0, NULL }
};
#define AO_MAX_SEND 128
-static __xdata uint8_t ao_send[AO_MAX_SEND];
+static uint8_t ao_send[AO_MAX_SEND];
static void
ao_send_packet(void)
{
- __pdata uint16_t count;
+ uint16_t count;
uint8_t b;
- __pdata uint8_t i;
+ uint8_t i;
ao_cmd_hex();
count = ao_cmd_lex_i;
ao_radio_send(ao_send, count);
}
-static __code struct ao_cmds ao_send_packet_cmds[] = {
+static const struct ao_cmds ao_send_packet_cmds[] = {
{ ao_send_packet, "S <len>\0Send packet. Data on next line" },
{ 0, NULL }
};
#define AO_SERIAL_SPEED_115200 4
#if HAS_SERIAL_0
-extern volatile __xdata struct ao_fifo ao_serial0_rx_fifo;
-extern volatile __xdata struct ao_fifo ao_serial0_tx_fifo;
+extern volatile struct ao_fifo ao_serial0_rx_fifo;
+extern volatile struct ao_fifo ao_serial0_tx_fifo;
char
ao_serial0_getchar(void);
#endif
#if HAS_SERIAL_1
-extern volatile __xdata struct ao_fifo ao_serial1_rx_fifo;
-extern volatile __xdata struct ao_fifo ao_serial1_tx_fifo;
+extern volatile struct ao_fifo ao_serial1_rx_fifo;
+extern volatile struct ao_fifo ao_serial1_tx_fifo;
char
ao_serial1_getchar(void);
#endif
#if HAS_SERIAL_2
-extern volatile __xdata struct ao_fifo ao_serial2_rx_fifo;
-extern volatile __xdata struct ao_fifo ao_serial2_tx_fifo;
+extern volatile struct ao_fifo ao_serial2_rx_fifo;
+extern volatile struct ao_fifo ao_serial2_tx_fifo;
char
ao_serial2_getchar(void);
#endif
#if HAS_SERIAL_3
-extern volatile __xdata struct ao_fifo ao_serial3_rx_fifo;
-extern volatile __xdata struct ao_fifo ao_serial3_tx_fifo;
+extern volatile struct ao_fifo ao_serial3_rx_fifo;
+extern volatile struct ao_fifo ao_serial3_tx_fifo;
char
ao_serial3_getchar(void);
#define AO_NUM_STDIOS (HAS_USB + PACKET_HAS_SLAVE + USE_SERIAL_STDIN + CONSOLE_STDIN)
-__xdata struct ao_stdio ao_stdios[AO_NUM_STDIOS];
+struct ao_stdio ao_stdios[AO_NUM_STDIOS];
#if AO_NUM_STDIOS > 1
-__pdata int8_t ao_cur_stdio;
-__pdata int8_t ao_num_stdios;
+int8_t ao_cur_stdio;
+int8_t ao_num_stdios;
#else
-__pdata int8_t ao_cur_stdio;
+int8_t ao_cur_stdio;
#define ao_cur_stdio 0
#define ao_num_stdios 0
#endif
ao_stdios[ao_cur_stdio].flush();
}
-__xdata uint8_t ao_stdin_ready;
+uint8_t ao_stdin_ready;
char
-ao_getchar(void) __reentrant
+ao_getchar(void)
{
int c;
int8_t stdio;
int8_t
ao_add_stdio(int (*_pollchar)(void),
void (*putchar)(char),
- void (*flush)(void)) __reentrant
+ void (*flush)(void))
{
if (ao_num_stdios == AO_NUM_STDIOS)
ao_panic(AO_PANIC_STDIO);
#include <ao_storage.h>
uint8_t
-ao_storage_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant
+ao_storage_read(ao_pos_t pos, void *buf, uint16_t len)
{
#ifdef CC1111
return ao_storage_device_read(pos, buf, len);
}
uint8_t
-ao_storage_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant
+ao_storage_write(ao_pos_t pos, void *buf, uint16_t len)
{
#ifdef CC1111
return ao_storage_device_write(pos, buf, len);
#endif
}
-static __xdata uint8_t storage_data[128];
+static uint8_t storage_data[128];
static void
-ao_storage_dump(void) __reentrant
+ao_storage_dump(void)
{
uint8_t i, j;
/* not enough space for this today
*/
static void
-ao_storage_store(void) __reentrant
+ao_storage_store(void)
{
uint16_t block;
uint8_t i;
uint16_t len;
- static __xdata uint8_t b;
+ static uint8_t b;
uint32_t addr;
ao_cmd_hex();
#endif
void
-ao_storage_zap(void) __reentrant
+ao_storage_zap(void)
{
ao_cmd_hex();
if (ao_cmd_status != ao_cmd_success)
}
void
-ao_storage_zapall(void) __reentrant
+ao_storage_zapall(void)
{
uint32_t pos;
}
static uint8_t
-ao_storage_test_block(uint32_t pos) __reentrant
+ao_storage_test_block(uint32_t pos)
{
ao_storage_erase(pos);
printf(" erase"); flush();
}
static void
-ao_storage_test(void) __reentrant
+ao_storage_test(void)
{
uint32_t pos;
#endif /* AO_STORAGE_TEST */
void
-ao_storage_info(void) __reentrant
+ao_storage_info(void)
{
ao_storage_setup();
printf("Storage size: %ld\n", (long) ao_storage_total);
ao_storage_device_info();
}
-__code struct ao_cmds ao_storage_cmds[] = {
+const struct ao_cmds ao_storage_cmds[] = {
{ ao_storage_info, "f\0Show storage" },
{ ao_storage_dump, "e <block>\0Dump flash" },
#if HAS_STORAGE_DEBUG
typedef ao_storage_pos_t ao_pos_t;
/* Total bytes of available storage */
-extern __pdata ao_pos_t ao_storage_total;
+extern ao_pos_t ao_storage_total;
/* Block size - device is erased in these units. At least 256 bytes */
-extern __pdata ao_pos_t ao_storage_block;
+extern ao_pos_t ao_storage_block;
#ifndef USE_STORAGE_CONFIG
#define USE_STORAGE_CONFIG 1
#if USE_STORAGE_CONFIG
/* Byte offset of config block. Will be ao_storage_block bytes long */
-extern __pdata ao_pos_t ao_storage_config;
+extern ao_pos_t ao_storage_config;
#define ao_storage_log_max ao_storage_config
#else
#endif
/* Storage unit size - device reads and writes must be within blocks of this size. Usually 256 bytes. */
-extern __pdata uint16_t ao_storage_unit;
+extern uint16_t ao_storage_unit;
/* Initialize above values. Can only be called once the OS is running */
void
-ao_storage_setup(void) __reentrant;
+ao_storage_setup(void);
/* Write data. Returns 0 on failure, 1 on success */
uint8_t
-ao_storage_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant;
+ao_storage_write(ao_pos_t pos, void *buf, uint16_t len);
/* Read data. Returns 0 on failure, 1 on success */
uint8_t
-ao_storage_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant;
+ao_storage_read(ao_pos_t pos, void *buf, uint16_t len);
/* Erase a block of storage. This always clears ao_storage_block bytes */
uint8_t
-ao_storage_erase(ao_pos_t pos) __reentrant;
+ao_storage_erase(ao_pos_t pos);
/* Flush any pending writes to stable storage */
void
-ao_storage_flush(void) __reentrant;
+ao_storage_flush(void);
/* Initialize the storage code */
void
/* Read data within a storage unit */
uint8_t
-ao_storage_device_read(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant;
+ao_storage_device_read(ao_pos_t pos, void *buf, uint16_t len);
/* Write data within a storage unit */
uint8_t
-ao_storage_device_write(ao_pos_t pos, __xdata void *buf, uint16_t len) __reentrant;
+ao_storage_device_write(ao_pos_t pos, void *buf, uint16_t len);
/* Initialize low-level device bits */
void
/* Print out information about flash chips */
void
-ao_storage_device_info(void) __reentrant;
+ao_storage_device_info(void);
#endif /* _AO_STORAGE_H_ */
#define AO_NO_TASK_INDEX 0xff
-__xdata struct ao_task * __xdata ao_tasks[AO_NUM_TASKS];
-__data uint8_t ao_num_tasks;
-__xdata struct ao_task *__data ao_cur_task;
+struct ao_task * ao_tasks[AO_NUM_TASKS];
+uint8_t ao_num_tasks;
+struct ao_task *ao_cur_task;
#if !HAS_TASK_QUEUE
-static __data uint8_t ao_cur_task_index;
+static uint8_t ao_cur_task_index;
#endif
#ifdef ao_arch_task_globals
#endif /* HAS_TASK_QUEUE */
void
-ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *name) __reentrant
+ao_add_task(struct ao_task * task, void (*start)(void), const char *name)
{
uint8_t task_id;
uint8_t t;
);
}
-__data uint8_t ao_task_minimize_latency;
+uint8_t ao_task_minimize_latency;
/* Task switching function. This must not use any stack variables */
void
ao_cur_task = ao_list_first_entry(&run_queue, struct ao_task, queue);
#else
{
- __pdata uint8_t ao_last_task_index = ao_cur_task_index;
+ uint8_t ao_last_task_index = ao_cur_task_index;
for (;;) {
++ao_cur_task_index;
if (ao_cur_task_index == ao_num_tasks)
}
uint8_t
-ao_sleep(__xdata void *wchan)
+ao_sleep(void *wchan)
{
#if HAS_TASK_QUEUE
uint32_t flags;
}
void
-ao_wakeup(__xdata void *wchan) __reentrant
+ao_wakeup(void *wchan)
{
ao_validate_cur_stack();
#if HAS_TASK_QUEUE
}
uint8_t
-ao_sleep_for(__xdata void *wchan, uint16_t timeout)
+ao_sleep_for(void *wchan, uint16_t timeout)
{
uint8_t ret;
if (timeout) {
return ret;
}
-static __xdata uint8_t ao_forever;
+static uint8_t ao_forever;
void
ao_delay(uint16_t ticks)
ao_task_info(void)
{
uint8_t i;
- __xdata struct ao_task *task;
+ struct ao_task *task;
uint16_t now = ao_time();
for (i = 0; i < ao_num_tasks; i++) {
/* An AltOS task */
struct ao_task {
- __xdata void *wchan; /* current wait channel (NULL if running) */
+ void *wchan; /* current wait channel (NULL if running) */
uint16_t alarm; /* abort ao_sleep time */
ao_arch_task_members /* any architecture-specific fields */
uint8_t task_id; /* unique id */
- __code char *name; /* task name */
+ const char *name; /* task name */
#ifdef NEWLIB
int __errno; /* storage for errno in newlib libc */
#endif
#define AO_NO_TASK 0 /* no task id */
-extern __xdata struct ao_task * __xdata ao_tasks[AO_NUM_TASKS];
-extern __data uint8_t ao_num_tasks;
-extern __xdata struct ao_task *__data ao_cur_task;
-extern __data uint8_t ao_task_minimize_latency; /* Reduce IRQ latency */
+extern struct ao_task * ao_tasks[AO_NUM_TASKS];
+extern uint8_t ao_num_tasks;
+extern struct ao_task *ao_cur_task;
+extern uint8_t ao_task_minimize_latency; /* Reduce IRQ latency */
#ifndef HAS_ARCH_VALIDATE_CUR_STACK
#define ao_validate_cur_stack()
* 1 on alarm
*/
uint8_t
-ao_sleep(__xdata void *wchan);
+ao_sleep(void *wchan);
/* Suspend the current task until wchan is awoken or the timeout
* expires. returns:
* 1 on alarm
*/
uint8_t
-ao_sleep_for(__xdata void *wchan, uint16_t timeout);
+ao_sleep_for(void *wchan, uint16_t timeout);
/* Wake all tasks sleeping on wchan */
void
-ao_wakeup(__xdata void *wchan) __reentrant;
+ao_wakeup(void *wchan);
#if 0
/* set an alarm to go off in 'delay' ticks */
/* Add a task to the run queue */
void
-ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *name) __reentrant;
+ao_add_task(struct ao_task * task, void (*start)(void), const char *name);
#if HAS_TASK_QUEUE
/* Called on timer interrupt to check alarms */
#include "ao_log.h"
#include "ao_product.h"
-static __pdata uint16_t ao_telemetry_interval;
+static uint16_t ao_telemetry_interval;
#if HAS_RADIO_RATE
-static __xdata uint16_t ao_telemetry_desired_interval;
+static uint16_t ao_telemetry_desired_interval;
#endif
/* TeleMetrum v1.0 just doesn't have enough space to
#ifdef SIMPLIFY
#define ao_telemetry_time time
-#define RDF_SPACE __pdata
+#define RDF_SPACE
#else
-#define RDF_SPACE __xdata
-static __pdata uint16_t ao_telemetry_time;
+#define RDF_SPACE
+static uint16_t ao_telemetry_time;
#endif
#if HAS_RDF
#endif
#if HAS_APRS
-static __pdata uint16_t ao_aprs_time;
+static uint16_t ao_aprs_time;
#include <ao_aprs.h>
#endif
#define AO_TELEMETRY_SENSOR AO_TELEMETRY_SENSOR_TELENANO
#endif
-static __xdata union ao_telemetry_all telemetry;
+static union ao_telemetry_all telemetry;
static void
ao_telemetry_send(void)
static void
ao_send_sensor(void)
{
- __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
+ struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
telemetry.generic.tick = packet->tick;
telemetry.generic.type = AO_TELEMETRY_SENSOR;
static void
ao_send_mega_sensor(void)
{
- __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
+ struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
telemetry.generic.tick = packet->tick;
telemetry.generic.type = AO_TELEMETRY_MEGA_SENSOR;
ao_telemetry_send();
}
-static __pdata int8_t ao_telemetry_mega_data_max;
-static __pdata int8_t ao_telemetry_mega_data_cur;
+static int8_t ao_telemetry_mega_data_max;
+static int8_t ao_telemetry_mega_data_cur;
/* Send mega data packet */
static void
ao_send_mega_data(void)
{
if (--ao_telemetry_mega_data_cur <= 0) {
- __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
+ struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
uint8_t i;
telemetry.generic.tick = packet->tick;
static void
ao_send_metrum_sensor(void)
{
- __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
+ struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
telemetry.generic.tick = packet->tick;
telemetry.generic.type = AO_TELEMETRY_METRUM_SENSOR;
ao_telemetry_send();
}
-static __pdata int8_t ao_telemetry_metrum_data_max;
-static __pdata int8_t ao_telemetry_metrum_data_cur;
+static int8_t ao_telemetry_metrum_data_max;
+static int8_t ao_telemetry_metrum_data_cur;
/* Send telemetrum data packet */
static void
ao_send_metrum_data(void)
{
if (--ao_telemetry_metrum_data_cur <= 0) {
- __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
+ struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
telemetry.generic.tick = packet->tick;
telemetry.generic.type = AO_TELEMETRY_METRUM_DATA;
static void
ao_send_mini(void)
{
- __xdata struct ao_data *packet = (__xdata struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
+ struct ao_data *packet = (struct ao_data *) &ao_data_ring[ao_data_ring_prev(ao_sample_data)];
telemetry.generic.tick = packet->tick;
telemetry.generic.type = AO_SEND_MINI;
#endif /* AO_SEND_MINI */
-static __pdata int8_t ao_telemetry_config_max;
-static __pdata int8_t ao_telemetry_config_cur;
-static __pdata uint16_t ao_telemetry_flight_number;
+static int8_t ao_telemetry_config_max;
+static int8_t ao_telemetry_config_cur;
+static uint16_t ao_telemetry_flight_number;
#ifndef ao_telemetry_battery_convert
#define ao_telemetry_battery_convert(a) (a)
#if HAS_GPS
-static __pdata int8_t ao_telemetry_gps_max;
-static __pdata int8_t ao_telemetry_loc_cur;
-static __pdata int8_t ao_telemetry_sat_cur;
+static int8_t ao_telemetry_gps_max;
+static int8_t ao_telemetry_loc_cur;
+static int8_t ao_telemetry_sat_cur;
static void
ao_send_location(void)
#if HAS_COMPANION
-static __pdata int8_t ao_telemetry_companion_max;
-static __pdata int8_t ao_telemetry_companion_cur;
+static int8_t ao_telemetry_companion_max;
+static int8_t ao_telemetry_companion_cur;
static void
ao_send_companion(void)
#if HAS_RADIO_RATE
/* Limit max telemetry rate based on available radio bandwidth.
*/
- static __xdata const uint16_t min_interval[] = {
+ static const uint16_t min_interval[] = {
/* [AO_RADIO_RATE_38400] = */ AO_MS_TO_TICKS(100),
/* [AO_RADIO_RATE_9600] = */ AO_MS_TO_TICKS(500),
/* [AO_RADIO_RATE_2400] = */ AO_MS_TO_TICKS(1000)
}
#endif
-__xdata struct ao_task ao_telemetry_task;
+struct ao_task ao_telemetry_task;
void
ao_telemetry_init()
void
ao_usb_init(void);
-extern __code __at (0x00aa) uint8_t ao_usb_descriptors [];
+extern const __at (0x00aa) uint8_t ao_usb_descriptors [];
#define AO_USB_SETUP_DIR_MASK (0x01 << 7)
#define AO_USB_SETUP_TYPE_MASK (0x03 << 5)
uint8_t data_bits;
} ;
-extern __xdata struct ao_usb_line_coding ao_usb_line_coding;
+extern struct ao_usb_line_coding ao_usb_line_coding;
-extern __pdata uint8_t ao_usb_running;
+extern uint8_t ao_usb_running;
#endif /* _AO_USB_H_ */
/* Data -- relocated to RAM, but written to ROM
*/
.data : {
- __data_start__ = .;
+ _start__ = .;
*(.data*) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
/* Data -- relocated to RAM, but written to ROM
*/
.data ORIGIN(ram) : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
__bss_start__ = .;
} >ram
/* Data -- relocated to RAM, but written to ROM
*/
.data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
__bss_start__ = .;
} >ram
}
static void
-ao_adc_dump(void) __reentrant
+ao_adc_dump(void)
{
struct ao_data packet;
#ifndef AO_ADC_DUMP
#endif
}
-__code struct ao_cmds ao_adc_cmds[] = {
+const struct ao_cmds ao_adc_cmds[] = {
{ ao_adc_dump, "a\0Display current ADC values" },
{ 0, NULL },
};
#define ao_arch_naked_declare __attribute__((naked))
#define ao_arch_naked_define
-#define __pdata
-#define __data
-#define __xdata
-#define __code const
-#define __reentrant
#define __interrupt(n)
#define __at(n)
}
void
-ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant
+ao_beep_for(uint8_t beep, uint16_t ticks)
{
ao_beep(beep);
ao_delay(ticks);
extern void main(void);
extern char __stack__;
extern char __text_start__, __text_end__;
-extern char __data_start__, __data_end__;
+extern char _start__, _end__;
extern char __bss_start__, __bss_end__;
#if RELOCATE_INTERRUPT
extern char __interrupt_rom__, __interrupt_start__, __interrupt_end__;
memcpy(&__interrupt_start__, &__interrupt_rom__, &__interrupt_end__ - &__interrupt_start__);
lpc_scb.sysmemremap = LPC_SCB_SYSMEMREMAP_MAP_RAM << LPC_SCB_SYSMEMREMAP_MAP;
#endif
- memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__);
+ memcpy(&_start__, &__text_end__, &_end__ - &_start__);
memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__);
main();
}
#include <ao.h>
-__pdata AO_PORT_TYPE ao_led_enable;
+AO_PORT_TYPE ao_led_enable;
void
ao_led_on(AO_PORT_TYPE colors)
}
void
-ao_led_for(AO_PORT_TYPE colors, uint16_t ticks) __reentrant
+ao_led_for(AO_PORT_TYPE colors, uint16_t ticks)
{
ao_led_on(colors);
ao_delay(ticks);
#include <ao.h>
-volatile __data AO_TICK_TYPE ao_tick_count;
+volatile AO_TICK_TYPE ao_tick_count;
uint16_t
ao_time(void)
}
#if AO_DATA_ALL
-volatile __data uint8_t ao_data_interval = 1;
-volatile __data uint8_t ao_data_count;
+volatile uint8_t ao_data_interval = 1;
+volatile uint8_t ao_data_count;
#endif
void lpc_systick_isr(void)
control_count, out_count, in_count, int_count, reset_count);
}
-__code struct ao_cmds ao_usb_cmds[] = {
+const struct ao_cmds ao_usb_cmds[] = {
{ ao_usb_irq, "I\0Show USB interrupt counts" },
{ 0, NULL }
};
*/
.textram BLOCK(8): {
- __data_start__ = .;
+ _start__ = .;
*(.ramtext)
} >ram AT>rom
*/
.data BLOCK(8): {
*(.data) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
/* Data -- relocated to RAM, but written to ROM
*/
.data : {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
. = ALIGN(4);
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
*/
.textram BLOCK(8): {
- __data_start__ = .;
+ _start__ = .;
__text_ram_start__ = .;
*(.ramtext)
__text_ram_end = .;
.data : {
*(.data) /* initialized data */
. = ALIGN(4);
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
}
void
-ao_put_string(__code char *s)
+ao_put_string(const char *s)
{
char c;
while ((c = *s++)) {
#include <ao_flight.h>
#include <math.h>
-static __xdata struct ao_telemetry_sensor ao_tel_sensor;
-static __xdata struct ao_telemetry_location ao_tel_location;
-static __xdata struct ao_telemetry_configuration ao_tel_config;
-static __xdata int16_t ao_tel_max_speed;
-static __xdata int16_t ao_tel_max_height;
+static struct ao_telemetry_sensor ao_tel_sensor;
+static struct ao_telemetry_location ao_tel_location;
+static struct ao_telemetry_configuration ao_tel_config;
+static int16_t ao_tel_max_speed;
+static int16_t ao_tel_max_height;
static int8_t ao_tel_rssi;
-static __xdata char ao_lcd_line[17];
-static __xdata char ao_state_name[] = "SIPBFCDMLI";
+static char ao_lcd_line[17];
+static char ao_state_name[] = "SIPBFCDMLI";
static void
ao_terraui_line(uint8_t addr)
return '-';
}
-static __code char ao_progress[4] = { '\011', '\012', '\014', '\013' };
+static const char ao_progress[4] = { '\011', '\012', '\014', '\013' };
static uint8_t ao_telem_progress;
static uint8_t ao_gps_progress;
static int32_t
dist(int32_t d)
{
- __pdata uint32_t m;
+ uint32_t m;
uint8_t neg = 0;
if (d < 0) {
return d;
}
-static __code uint8_t cos_table[] = {
+static const uint8_t cos_table[] = {
0, /* 0 */
0, /* 1 */
0, /* 2 */
1, /* 54 */
};
-static __code uint8_t tan_table[] = {
+static const uint8_t tan_table[] = {
0, /* 0 */
4, /* 1 */
9, /* 2 */
247, /* 44 */
};
-int16_t ao_atan2(int32_t dy, int32_t dx) __reentrant
+int16_t ao_atan2(int32_t dy, int32_t dx)
{
int8_t m = 1;
int16_t a = 0;
return t * m + a;
}
-static __pdata int32_t lon_dist, lat_dist;
-static __pdata uint32_t ground_dist, range;
-static __pdata uint8_t dist_in_km;
-static __pdata int16_t bearing, elevation;
+static int32_t lon_dist, lat_dist;
+static uint32_t ground_dist, range;
+static uint8_t dist_in_km;
+static int16_t bearing, elevation;
static void
ao_terraui_lat_dist(void)
}
static void
-ao_terraui_lon_dist(void) __reentrant
+ao_terraui_lon_dist(void)
{
uint8_t c = cos_table[ao_gps_data.latitude >> 24];
lon_dist = ao_tel_location.longitude;
}
static void
-ao_terraui_coord(int32_t c, char plus, char minus, char extra) __reentrant
+ao_terraui_coord(int32_t c, char plus, char minus, char extra)
{
uint16_t d;
uint8_t m;
}
static void
-ao_terraui_local(void) __reentrant
+ao_terraui_local(void)
{
ao_terraui_coord(ao_gps_data.latitude, 'n', 's',
ao_terraui_local_gps());
ao_terraui_line(AO_LCD_ADDR(1,0));
}
-static __pdata uint8_t ao_set_freq;
-static __pdata uint32_t ao_set_freq_orig;
+static uint8_t ao_set_freq;
+static uint32_t ao_set_freq_orig;
static void
-ao_terraui_freq(void) __reentrant
+ao_terraui_freq(void)
{
uint16_t MHz;
uint16_t frac;
ao_radio_recv_abort();
}
-static __code void (*__code ao_terraui_page[])(void) = {
+static const void (*const ao_terraui_page[])(void) = {
ao_terraui_startup,
ao_terraui_info,
ao_terraui_pad,
#define NUM_PAGE (sizeof (ao_terraui_page)/sizeof (ao_terraui_page[0]))
-static __pdata uint8_t ao_current_page = 0;
-static __pdata uint8_t ao_shown_about = 3;
+static uint8_t ao_current_page = 0;
+static uint8_t ao_shown_about = 3;
static void
ao_terraui(void)
}
}
-__xdata static struct ao_task ao_terraui_task;
+static struct ao_task ao_terraui_task;
static void
ao_terramonitor(void)
}
}
-__xdata static struct ao_task ao_terramonitor_task;
+static struct ao_task ao_terramonitor_task;
static void
ao_terragps(void)
}
}
-__xdata static struct ao_task ao_terragps_task;
+static struct ao_task ao_terragps_task;
void
ao_terraui_init(void)
#include "ao.h"
-struct ao_task __xdata blink_0_task;
-struct ao_task __xdata blink_1_task;
-struct ao_task __xdata wakeup_task;
-struct ao_task __xdata beep_task;
-struct ao_task __xdata echo_task;
+struct ao_task blink_0_task;
+struct ao_task blink_1_task;
+struct ao_task wakeup_task;
+struct ao_task beep_task;
+struct ao_task echo_task;
-void delay(int n) __reentrant
+void delay(int n)
{
uint8_t j = 0;
while (--n)
ao_yield();
}
-static __xdata uint8_t blink_chan;
+static uint8_t blink_chan;
void
blink_0(void)
void
blink_1(void)
{
- static __xdata struct ao_adc adc;
+ static struct ao_adc adc;
for (;;) {
ao_sleep(&ao_adc_head);
void
beep(void)
{
- static __xdata struct ao_adc adc;
+ static struct ao_adc adc;
for (;;) {
ao_delay(AO_SEC_TO_TICKS(1));
} > rom
. = ORIGIN(ram);
- __data_start__ = .;
+ _start__ = .;
/* Data -- relocated to RAM, but written to ROM
*/
.data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) {
*(.data) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
__bss_start__ = .;
} >ram
}
-__code struct ao_cmds ao_demo_cmds[] = {
+const struct ao_cmds ao_demo_cmds[] = {
{ ao_dma_test, "D\0DMA test" },
{ ao_spi_write, "W\0SPI write" },
{ ao_spi_read, "R\0SPI read" },
}
-__code struct ao_cmds ao_demo_cmds[] = {
+const struct ao_cmds ao_demo_cmds[] = {
{ scheme_cmd, "l\0Run scheme interpreter" },
{ 0, NULL }
};
}
}
-__code struct ao_cmds ao_demo_cmds[] = {
+const struct ao_cmds ao_demo_cmds[] = {
{ ao_video_toggle, "V\0Toggle video" },
{ ao_ball_toggle, "B\0Toggle ball" },
{ ao_ps2_read_keys, "K\0Read keys from keyboard" },
/* Data -- relocated to RAM, but written to ROM
*/
.data : {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
. = ALIGN(4);
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
*/
.textram BLOCK(8): {
- __data_start__ = .;
+ _start__ = .;
__text_ram_start__ = .;
*(.ramtext)
__text_ram_end = .;
*/
.data BLOCK(8): {
*(.data) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
__text_end__ = .;
} > ram
- __data_start__ = .;
+ _start__ = .;
/* Data -- relocated to RAM, but written to ROM
*/
.data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) {
*(.data) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
__bss_start__ = .;
} >ram
/* Data -- relocated to RAM, but written to ROM
*/
.data : {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
. = ALIGN(4);
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
AO_ADC_DUMP(&packet);
}
-__code struct ao_cmds ao_adc_cmds[] = {
+const struct ao_cmds ao_adc_cmds[] = {
{ ao_adc_dump, "a\0Display current ADC values" },
{ 0, NULL },
};
* Fetch a copy of the most recent ADC data
*/
void
-ao_adc_get(__xdata struct ao_adc *packet)
+ao_adc_get(struct ao_adc *packet)
{
#if HAS_FLIGHT
uint8_t i = ao_data_ring_prev(ao_sample_data);
#endif
static void
-ao_adc_dump(void) __reentrant
+ao_adc_dump(void)
{
struct ao_data packet;
#ifndef AO_ADC_DUMP
#endif
}
-__code struct ao_cmds ao_adc_cmds[] = {
+const struct ao_cmds ao_adc_cmds[] = {
{ ao_adc_dump, "a\0Display current ADC values" },
{ 0, NULL },
};
#define ao_arch_naked_declare __attribute__((naked))
#define ao_arch_naked_define
-#define __pdata
-#define __data
-#define __xdata
-#define __code const
-#define __reentrant
#define __interrupt(n)
#define __at(n)
}
void
-ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant
+ao_beep_for(uint8_t beep, uint16_t ticks)
{
ao_beep(beep);
ao_delay(ticks);
*/
uint8_t
-ao_eeprom_write(ao_pos_t pos32, __xdata void *v, uint16_t len)
+ao_eeprom_write(ao_pos_t pos32, void *v, uint16_t len)
{
uint16_t pos = pos32;
- __xdata uint8_t *d = v;
+ uint8_t *d = v;
if (pos >= ao_eeprom_total || pos + len > ao_eeprom_total)
return 0;
* Read from eeprom
*/
uint8_t
-ao_eeprom_read(ao_pos_t pos, __xdata void *v, uint16_t len)
+ao_eeprom_read(ao_pos_t pos, void *v, uint16_t len)
{
uint8_t *d = v;
extern void main(void);
extern char __stack__;
extern char __text_start__, __text_end__;
-extern char __data_start__, __data_end__;
+extern char _start__, _end__;
extern char __bss_start__, __bss_end__;
/* Interrupt functions */
#endif
/* Set interrupt vector table offset */
stm_nvic.vto = (uint32_t) &stm_interrupt_vector;
- memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__);
+ memcpy(&_start__, &__text_end__, &_end__ - &_start__);
memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__);
main();
}
}
void
-ao_led_for(AO_LED_TYPE colors, AO_LED_TYPE ticks) __reentrant
+ao_led_for(AO_LED_TYPE colors, AO_LED_TYPE ticks)
{
ao_led_on(colors);
ao_delay(ticks);
#endif
#if AO_DATA_ALL
-volatile __data uint8_t ao_data_interval = 1;
-volatile __data uint8_t ao_data_count;
+volatile uint8_t ao_data_interval = 1;
+volatile uint8_t ao_data_count;
#endif
void stm_systick_isr(void)
control_count, out_count, in_count, int_count, reset_count);
}
-__code struct ao_cmds ao_usb_cmds[] = {
+const struct ao_cmds ao_usb_cmds[] = {
{ ao_usb_irq, "I\0Show USB interrupt counts" },
{ 0, NULL }
};
*/
.textram BLOCK(8): {
- __data_start__ = .;
+ _start__ = .;
__text_ram_start__ = .;
*(.ramtext)
__text_ram_end = .;
*/
.data BLOCK(8): {
*(.data) /* initialized data */
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
/* Data -- relocated to RAM, but written to ROM
*/
.data : {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
. = ALIGN(4);
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
/* Data -- relocated to RAM, but written to ROM
*/
.data : {
- __data_start__ = .;
+ _start__ = .;
*(.data) /* initialized data */
. = ALIGN(4);
- __data_end__ = .;
+ _end__ = .;
} >ram AT>rom
.bss : {
}
#endif
-__code struct ao_cmds ao_adc_cmds[] = {
+const struct ao_cmds ao_adc_cmds[] = {
{ ao_adc_dump, "a\0Display current ADC values" },
#if AO_ADC_DEBUG
{ ao_adc_one, "A ch\0Display one ADC channel" },
#define ao_arch_naked_declare __attribute__((naked))
#define ao_arch_naked_define
-#define __pdata
-#define __data
-#define __xdata
-#define __code const
-#define __reentrant
#define __interrupt(n)
#define __at(n)
}
void
-ao_beep_for(uint8_t beep, uint16_t ticks) __reentrant
+ao_beep_for(uint8_t beep, uint16_t ticks)
{
ao_beep(beep);
ao_delay(ticks);
extern void main(void);
extern char __stack__;
extern char __text_start__, __text_end__;
-extern char __data_start__, __data_end__;
+extern char _start__, _end__;
extern char __bss_start__, __bss_end__;
#if RELOCATE_INTERRUPT
extern char __interrupt_rom__, __interrupt_start__, __interrupt_end__;
stm_syscfg.cfgr1 = (stm_syscfg.cfgr1 & ~(STM_SYSCFG_CFGR1_MEM_MODE_MASK << STM_SYSCFG_CFGR1_MEM_MODE)) |
(STM_SYSCFG_CFGR1_MEM_MODE_MAIN_FLASH << STM_SYSCFG_CFGR1_MEM_MODE);
#endif
- memcpy(&__data_start__, &__text_end__, &__data_end__ - &__data_start__);
+ memcpy(&_start__, &__text_end__, &_end__ - &_start__);
memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__);
main();
}
#include "ao.h"
-__pdata uint16_t ao_led_enable;
+uint16_t ao_led_enable;
void
ao_led_on(uint16_t colors)
}
void
-ao_led_for(uint16_t colors, uint16_t ticks) __reentrant
+ao_led_for(uint16_t colors, uint16_t ticks)
{
ao_led_on(colors);
ao_delay(ticks);
}
uint8_t
-ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant
+ao_storage_device_read(uint32_t pos, void *d, uint16_t len)
{
if (pos >= ao_storage_total || pos + len > ao_storage_total)
return 0;
}
void
-ao_storage_flush(void) __reentrant
+ao_storage_flush(void)
{
}
}
void
-ao_storage_device_info(void) __reentrant
+ao_storage_device_info(void)
{
printf ("Using internal flash, page %d bytes, total %d bytes\n",
ao_storage_block, ao_storage_total);
}
#if AO_DATA_ALL
-volatile __data uint8_t ao_data_interval = 1;
-volatile __data uint8_t ao_data_count;
+volatile uint8_t ao_data_interval = 1;
+volatile uint8_t ao_data_count;
#endif
void stm_systick_isr(void)
control_count, out_count, in_count, int_count, reset_count);
}
-__code struct ao_cmds ao_usb_cmds[] = {
+const struct ao_cmds ao_usb_cmds[] = {
{ ao_usb_irq, "I\0Show USB interrupt counts" },
{ 0, NULL }
};
ao_wakeup(&ao_log_running);
}
-__code struct ao_cmds ao_firetwo_cmds[] = {
+const struct ao_cmds ao_firetwo_cmds[] = {
{ set_logging, "L <0 off, 1 on>\0Log sensors to flash" },
{ 0, NULL },
};
ao_lco_debug = ao_cmd_lex_i != 0;
}
-__code struct ao_cmds ao_lco_cmds[] = {
+const struct ao_cmds ao_lco_cmds[] = {
{ ao_lco_set_debug, "D <0 off, 1 on>\0Debug" },
{ ao_lco_search, "s\0Search for pad boxes" },
{ 0, NULL }
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#define __pdata
-#define __data
-#define __xdata
-#define __code
-#define __reentrant
+#define const
#include <string.h>
#include <stdio.h>
#ifndef _AO_EEPROM_READ_H_
#define _AO_EEPROM_READ_H_
-#define __pdata
-#define __data
-#define __xdata
-#define __code
-#define __reentrant
+#define const
#include <stdint.h>
#include <stdio.h>
#endif
-#define __pdata
-#define __data
-#define __xdata
-#define __code
-#define __reentrant
+#define const
#define HAS_FLIGHT 1
#define HAS_IGNITE 1
#define ao_telemetry_satellite ao_gps_tracking_orig
#define ao_telemetry_satellite_info ao_gps_sat_orig
-extern __xdata struct ao_telemetry_location ao_gps_data;
-extern __xdata struct ao_telemetry_satellite ao_gps_tracking_data;
+extern struct ao_telemetry_location ao_gps_data;
+extern struct ao_telemetry_satellite ao_gps_tracking_data;
uint8_t ao_gps_mutex;
#define ao_gps_tracking_orig ao_telemetry_satellite
#define ao_gps_sat_orig ao_telemetry_satellite_info
-extern __xdata struct ao_telemetry_location ao_gps_data;
-extern __xdata struct ao_telemetry_satellite ao_gps_tracking_data;
+extern struct ao_telemetry_location ao_gps_data;
+extern struct ao_telemetry_satellite ao_gps_tracking_data;
uint8_t ao_gps_mutex;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#define __data
-#define __pdata
-#define __xdata
-#define __reentrant
#include <ao_int64.h>
#include <ao_int64.c>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#define __xdata
-#define __data
-#define __pdata
-#define __reentrant
#include <stdint.h>
#include <ao_ms5607.h>
}
static void
-ao_relay_select(void) __reentrant
+ao_relay_select(void)
{
uint8_t output;
ao_relay_control(output);
}
-static __code struct ao_cmds ao_relay_cmds[] = {
+static const struct ao_cmds ao_relay_cmds[] = {
{ ao_relay_select, "R <output>\0Select relay output" },
{ 0, NULL }
};