From 2ffc87ca9b47bd605e5630a33b36f83e5e8486da Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Tue, 12 Apr 2011 00:44:05 -0400 Subject: Changing usages of "volatile" to "__io". --- libmaple/i2c.h | 2 +- libmaple/ring_buffer.h | 6 ++++-- libmaple/systick.c | 2 +- libmaple/systick.h | 2 +- libmaple/util.h | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libmaple/i2c.h b/libmaple/i2c.h index 21c17c1..a17e144 100644 --- a/libmaple/i2c.h +++ b/libmaple/i2c.h @@ -66,7 +66,7 @@ typedef struct i2c_dev { uint8 clk_line; uint8 ev_nvic_line; uint8 er_nvic_line; - volatile uint8 state; + __io uint8 state; uint16 msgs_left; i2c_msg *msg; } i2c_dev; diff --git a/libmaple/ring_buffer.h b/libmaple/ring_buffer.h index ad6ad96..04f6499 100644 --- a/libmaple/ring_buffer.h +++ b/libmaple/ring_buffer.h @@ -35,6 +35,8 @@ #ifndef _RING_BUFFER_H_ #define _RING_BUFFER_H_ +#include "libmaple_types.h" + #ifdef __cplusplus extern "C"{ #endif @@ -49,7 +51,7 @@ extern "C"{ * * One byte is left free to distinguish empty from full. */ typedef struct ring_buffer { - volatile uint8 *buf; /**< Buffer items are stored into */ + __io uint8 *buf; /**< Buffer items are stored into */ uint16 head; /**< Index of the next item to remove */ uint16 tail; /**< Index where the next item will get inserted */ uint16 size; /**< Buffer capacity minus one */ @@ -79,7 +81,7 @@ static inline void rb_init(ring_buffer *rb, uint16 size, uint8 *buf) { * @param rb Buffer whose elements to count. */ static inline uint16 rb_full_count(ring_buffer *rb) { - volatile ring_buffer *arb = rb; + __io ring_buffer *arb = rb; int32 size = arb->tail - arb->head; if (arb->tail < arb->head) { size += arb->size + 1; diff --git a/libmaple/systick.c b/libmaple/systick.c index c04f4f3..103893e 100644 --- a/libmaple/systick.c +++ b/libmaple/systick.c @@ -28,7 +28,7 @@ #include "systick.h" -volatile uint32 systick_timer_millis; +__io uint32 systick_timer_millis; /** * @brief Initialize and enable SysTick. diff --git a/libmaple/systick.h b/libmaple/systick.h index 35b4cb9..4654c5f 100644 --- a/libmaple/systick.h +++ b/libmaple/systick.h @@ -73,7 +73,7 @@ typedef struct systick_reg_map { #define SYSTICK_CVR_TENMS 0xFFFFFF /** System elapsed time, in milliseconds */ -extern volatile uint32 systick_timer_millis; +extern __io uint32 systick_timer_millis; void systick_init(uint32 reload_val); void systick_disable(); diff --git a/libmaple/util.h b/libmaple/util.h index aff70e1..4c47764 100644 --- a/libmaple/util.h +++ b/libmaple/util.h @@ -50,8 +50,8 @@ extern "C"{ * Register reads and writes */ -#define __read(reg) (*(volatile uint32*)(reg)) -#define __write(reg, value) (*(volatile uint32*)(reg) = (value)) +#define __read(reg) (*(__io uint32*)(reg)) +#define __write(reg, value) (*(__io uint32*)(reg) = (value)) /* * Failure routines -- cgit v1.2.3