]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
trusted casts for safe tinyos on MSP430 register accesses
authorregehr <regehr>
Sat, 16 Feb 2008 20:03:51 +0000 (20:03 +0000)
committerregehr <regehr>
Sat, 16 Feb 2008 20:03:51 +0000 (20:03 +0000)
tos/chips/msp430/pins/HplMsp430GeneralIOP.nc
tos/chips/msp430/timer/Msp430TimerCapComP.nc
tos/chips/msp430/timer/Msp430TimerP.nc

index b532f812fcd8ddb33bf5a29d50d84fb7a79e1b91..48f49dfdb0f3007b8a98df9cca4a3ce3c748e597 100644 (file)
@@ -37,10 +37,10 @@ generic module HplMsp430GeneralIOP(
 }
 implementation
 {
-  #define PORTxIN (*(volatile TYPE_PORT_IN*)port_in_addr)
-  #define PORTx (*(volatile TYPE_PORT_OUT*)port_out_addr)
-  #define PORTxDIR (*(volatile TYPE_PORT_DIR*)port_dir_addr)
-  #define PORTxSEL (*(volatile TYPE_PORT_SEL*)port_sel_addr)
+  #define PORTxIN (*TCAST(volatile TYPE_PORT_IN* SINGLE NONNULL, port_in_addr))
+  #define PORTx (*TCAST(volatile TYPE_PORT_OUT* SINGLE NONNULL, port_out_addr))
+  #define PORTxDIR (*TCAST(volatile TYPE_PORT_DIR* SINGLE NONNULL, port_dir_addr))
+  #define PORTxSEL (*TCAST(volatile TYPE_PORT_SEL* SINGLE NONNULL, port_sel_addr))
 
   async command void IO.set() { atomic PORTx |= (0x01 << pin); }
   async command void IO.clr() { atomic PORTx &= ~(0x01 << pin); }
index 71511600cd95c06301d994491af2c681aea16446..04707adf3d207c471666781be0a7897ad222579e 100644 (file)
@@ -38,8 +38,8 @@ generic module Msp430TimerCapComP(
 }
 implementation
 {
-  #define TxCCTLx (*(volatile TYPE_TACCTL0*)TxCCTLx_addr)
-  #define TxCCRx (*(volatile TYPE_TACCR0*)TxCCRx_addr)
+  #define TxCCTLx (*TCAST(volatile TYPE_TACCTL0* SINGLE NONNULL, TxCCTLx_addr))
+  #define TxCCRx (*TCAST(volatile TYPE_TACCR0* SINGLE NONNULL, TxCCRx_addr))
 
   typedef msp430_compare_control_t cc_t;
 
index da3d1d21fba6c72a61f62d26417ceba28cc5b0ea..fdf1b632e7789d98af2d62dff8ea398f6aa9ece3 100644 (file)
@@ -44,9 +44,9 @@ generic module Msp430TimerP(
 }
 implementation
 {
-  #define TxIV (*(volatile TYPE_TAIV*)TxIV_addr)
-  #define TxR (*(volatile TYPE_TAR*)TxR_addr)
-  #define TxCTL (*(volatile TYPE_TACTL*)TxCTL_addr)
+  #define TxIV (*TCAST(volatile TYPE_TAIV* SINGLE NONNULL, TxIV_addr))
+  #define TxR (*TCAST(volatile TYPE_TAR* SINGLE NONNULL, TxR_addr))
+  #define TxCTL (*TCAST(volatile TYPE_TACTL* SINGLE NONNULL, TxCTL_addr))
 
   async command uint16_t Timer.get()
   {