summaryrefslogtreecommitdiff
path: root/src/attiny
diff options
context:
space:
mode:
Diffstat (limited to 'src/attiny')
-rw-r--r--src/attiny/ao_arch.h10
-rw-r--r--src/attiny/ao_arch_funcs.h20
-rw-r--r--src/attiny/ao_i2c_attiny.c4
-rw-r--r--src/attiny/ao_led_tiny.c (renamed from src/attiny/ao_led.c)19
-rw-r--r--src/attiny/ao_spi_attiny.c4
5 files changed, 26 insertions, 31 deletions
diff --git a/src/attiny/ao_arch.h b/src/attiny/ao_arch.h
index 68f5702d..dfd41afe 100644
--- a/src/attiny/ao_arch.h
+++ b/src/attiny/ao_arch.h
@@ -34,16 +34,12 @@
#define AO_PORT_TYPE uint8_t
+#define AO_LED_TYPE uint8_t
+
/* Various definitions to make GCC look more like SDCC */
#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)
@@ -53,6 +49,8 @@
#define ao_arch_interrupt(n) /* nothing */
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
+
#undef putchar
#undef getchar
#define putchar(c) ao_putchar(c)
diff --git a/src/attiny/ao_arch_funcs.h b/src/attiny/ao_arch_funcs.h
index 0b67a407..69b259d9 100644
--- a/src/attiny/ao_arch_funcs.h
+++ b/src/attiny/ao_arch_funcs.h
@@ -28,21 +28,21 @@
(reg) |= (mask); \
} while (0)
-#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<<(bit)),bus,speed)
+#define ao_spi_get_bit(reg,bit,bus,speed) ao_spi_get_mask(reg,(1<<(bit)),bus,speed)
-#define ao_spi_put_bit(reg,bit,pin,bus) ao_spi_put_mask(reg,(1<<(bit)),bus)
+#define ao_spi_put_bit(reg,bit,bus) ao_spi_put_mask(reg,(1<<(bit)),bus)
#define ao_gpio_token_paster(x,y) x ## y
#define ao_gpio_token_evaluator(x,y) ao_gpio_token_paster(x,y)
-#define ao_gpio_set(port, bit, pin, v) do { \
+#define ao_gpio_set(port, bit, v) do { \
if (v) \
PORTB |= (1 << bit); \
else \
PORTB &= ~(1 << bit); \
} while (0)
-#define ao_gpio_get(port, bit, pin) ((PORTB >> (bit)) & 1)
+#define ao_gpio_get(port, bit) ((PORTB >> (bit)) & 1)
/*
* The SPI mutex must be held to call either of these
@@ -50,17 +50,17 @@
* from chip select low to chip select high
*/
-#define ao_enable_output(port, bit, pin, v) do { \
- ao_gpio_set(port, bit, pin, v); \
+#define ao_enable_output(port, bit, v) do { \
+ ao_gpio_set(port, bit, v); \
ao_gpio_token_evaluator(DDR,port) |= (1 << bit); \
} while (0)
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)
@@ -110,10 +110,10 @@ ao_i2c_init(void);
/* 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;
diff --git a/src/attiny/ao_i2c_attiny.c b/src/attiny/ao_i2c_attiny.c
index f29ed6a9..34185b5a 100644
--- a/src/attiny/ao_i2c_attiny.c
+++ b/src/attiny/ao_i2c_attiny.c
@@ -173,7 +173,7 @@ ao_i2c_stop_bus(void)
* 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;
@@ -206,7 +206,7 @@ ao_i2c_send_fixed_bus(uint8_t d, uint16_t len, uint8_t stop)
* 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;
diff --git a/src/attiny/ao_led.c b/src/attiny/ao_led_tiny.c
index 5f53129e..cd620f46 100644
--- a/src/attiny/ao_led.c
+++ b/src/attiny/ao_led_tiny.c
@@ -18,37 +18,35 @@
#include "ao.h"
-__pdata uint8_t ao_led_enable;
-
#define LED_PORT PORTB
#define LED_DDR DDRB
void
ao_led_on(uint8_t colors)
{
- LED_PORT |= (colors & ao_led_enable);
+ LED_PORT |= colors;
}
void
ao_led_off(uint8_t colors)
{
- LED_PORT &= ~(colors & ao_led_enable);
+ LED_PORT &= ~colors;
}
void
ao_led_set(uint8_t colors)
{
- LED_PORT = (LED_PORT & ~(ao_led_enable)) | (colors & ao_led_enable);
+ LED_PORT = (LED_PORT & ~LEDS_AVAILABLE) | (colors & LEDS_AVAILABLE);
}
void
ao_led_toggle(uint8_t colors)
{
- LED_PORT ^= (colors & ao_led_enable);
+ LED_PORT ^= (colors & LEDS_AVAILABLE);
}
void
-ao_led_for(uint8_t colors, uint16_t ticks) __reentrant
+ao_led_for(uint8_t colors, AO_TICK_TYPE ticks)
{
ao_led_on(colors);
ao_delay(ticks);
@@ -56,9 +54,8 @@ ao_led_for(uint8_t colors, uint16_t ticks) __reentrant
}
void
-ao_led_init(uint8_t enable)
+ao_led_init(void)
{
- ao_led_enable = enable;
- LED_PORT &= ~enable;
- LED_DDR |= enable;
+ LED_PORT &= ~LEDS_AVAILABLE;
+ LED_DDR |= LEDS_AVAILABLE;
}
diff --git a/src/attiny/ao_spi_attiny.c b/src/attiny/ao_spi_attiny.c
index f63eb651..1c90ad56 100644
--- a/src/attiny/ao_spi_attiny.c
+++ b/src/attiny/ao_spi_attiny.c
@@ -82,7 +82,7 @@ ao_spi_transfer(uint8_t i)
* 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;
@@ -95,7 +95,7 @@ ao_spi_send_bus(void __xdata *block, uint16_t len) __reentrant
* 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;