]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
safe tinyos annotations
authorregehr <regehr>
Wed, 4 Jun 2008 05:31:15 +0000 (05:31 +0000)
committerregehr <regehr>
Wed, 4 Jun 2008 05:31:15 +0000 (05:31 +0000)
tos/chips/msp430/adc12/AdcP.nc
tos/chips/msp430/adc12/AdcStreamP.nc
tos/chips/msp430/adc12/Msp430Adc12ImplP.nc
tos/chips/msp430/adc12/Msp430Adc12SingleChannel.nc
tos/chips/msp430/usart/Msp430SpiNoDmaP.nc
tos/chips/msp430/usart/Msp430UartP.nc

index 7536a0a39cfb5a7f50844523026ea97ccf50f19b..f7ae2cb1ecdf9afe193bae827fd5ad1f871b8350 100644 (file)
@@ -65,7 +65,7 @@ implementation
   error_t configure(uint8_t client)
   {
     error_t result = EINVAL;
-    const msp430adc12_channel_config_t *config;
+    const msp430adc12_channel_config_t * ONE config;
     config = call Config.getConfiguration[client]();
     if (config->inch != INPUT_CHANNEL_NONE)
       result = call SingleChannel.configureSingle[client](config);
@@ -159,7 +159,7 @@ implementation
   }
 
   async event uint16_t* SingleChannel.multipleDataReady[uint8_t client](
-      uint16_t *buf, uint16_t length)
+      uint16_t * COUNT_NOK(length) buf, uint16_t length)
   {
     // error !
     return 0;
index af14a4779ad8d84f35ac91ad4c8647ff7469c190..52b9df34c9571b8df789d8586af0951160ef72a0 100644 (file)
@@ -67,13 +67,15 @@ implementation {
   /* Stream data */
   struct list_entry_t {
     uint16_t count;
-    struct list_entry_t *next;
+    struct list_entry_t * ONE_NOK next;
   };
   struct list_entry_t *bufferQueue[NSTREAM];
-  struct list_entry_t **bufferQueueEnd[NSTREAM];
-  uint16_t *lastBuffer, lastCount;
+  struct list_entry_t * ONE_NOK * bufferQueueEnd[NSTREAM];
+  uint16_t * ONE_NOK lastBuffer, lastCount;
 
-  norace uint16_t *buffer, *pos, count;
+  norace uint16_t count;
+  norace uint16_t * COUNT_NOK(count) buffer; 
+  norace uint16_t * FAT_NOK(buffer, buffer+count) pos;
   norace uint32_t now, period;
   norace bool periodModified;
 
@@ -96,7 +98,7 @@ implementation {
       return ESIZE;
     atomic
     {
-      struct list_entry_t *newEntry = (struct list_entry_t *)buf;
+      struct list_entry_t * ONE newEntry = TCAST(struct list_entry_t * ONE, buf);
 
       if (!bufferQueueEnd[c]) // Can't post right now.
         return FAIL;
@@ -131,8 +133,10 @@ implementation {
     uint8_t c = client;
 
     atomic entry = bufferQueue[c];
-    for (; entry; entry = entry->next)
-      signal ReadStream.bufferDone[c](FAIL, (uint16_t *)entry, entry->count);
+    for (; entry; entry = entry->next) {
+      uint16_t tmp_count __DEPUTY_UNUSED__ = entry->count;
+      signal ReadStream.bufferDone[c](FAIL, TCAST(uint16_t * COUNT_NOK(tmp_count),entry), entry->count);
+    }
 
     atomic
     {
@@ -179,11 +183,13 @@ implementation {
       }
       else
       {
+        uint16_t tmp_count;
         bufferQueue[client] = entry->next;
         if (!bufferQueue[client])
           bufferQueueEnd[client] = &bufferQueue[client];
-        pos = buffer = (uint16_t *)entry;
         count = entry->count;
+        tmp_count = count;
+       pos = buffer = TCAST(uint16_t * COUNT_NOK(tmp_count), entry);
         if (startNextAlarm)
           nextAlarm();
         return SUCCESS;
index e815ee61e0ef5b1dcd5154fd81843957b6c3e289..a6ac26e6aa80e86c4aac8c1ff9c478662cf15539 100644 (file)
@@ -79,8 +79,9 @@ implementation
 
   uint8_t state;                  /* see enum above */
   
-  uint16_t *resultBuffer;         /* conversion results */
   uint16_t resultBufferLength;    /* length of buffer */
+  uint16_t *COUNT_NOK(resultBufferLength) resultBufferStart;
+  uint16_t *FAT_NOK(resultBufferStart, resultBufferStart+resultBufferLength) resultBuffer;         /* conversion results */
   uint16_t resultBufferIndex;     /* offset into buffer */
   uint8_t numChannels;            /* number of channels (multi-channel conversion) */
   uint8_t clientID;               /* ID of client that called getData() */
@@ -549,6 +550,7 @@ implementation
       case MULTI_CHANNEL:
         {
           uint16_t i = 0, k;
+          resultBufferStart = resultBuffer;
           do {
             *resultBuffer++ = call HplAdc12.getMem(i);
           } while (++i < numChannels);
@@ -566,6 +568,7 @@ implementation
       case MULTIPLE_DATA:
         {
           uint16_t i = 0, length, k;
+          resultBufferStart = resultBuffer;
           if (resultBufferLength - resultBufferIndex > 16) 
             length = 16;
           else
@@ -594,6 +597,7 @@ implementation
       case MULTIPLE_DATA_REPEAT:
         {
           uint8_t i = 0;
+          resultBufferStart = resultBuffer;
           do {
             *resultBuffer++ = call HplAdc12.getMem(i);
           } while (++i < resultBufferLength);
index 630f2b907491903203754e5165f4def52c31a55f..2a9154902f7c1858572439fed0c4687a4c171d52 100644 (file)
@@ -81,7 +81,7 @@ interface Msp430Adc12SingleChannel
    * @return SUCCESS means that the ADC was configured successfully and
    * <code>getData()</code> can be called to start the conversion.
    */
-  async command error_t configureSingle(const msp430adc12_channel_config_t *config);
+  async command error_t configureSingle(const msp430adc12_channel_config_t *ONE config);
 
   /** 
    * Configures the ADC for repeated single channel conversion mode. Any
@@ -103,7 +103,7 @@ interface Msp430Adc12SingleChannel
    * @return SUCCESS means that the ADC was configured successfully and
    * <code>getData()</code> can be called to start with the first conversion.
    */
-  async command error_t configureSingleRepeat(const msp430adc12_channel_config_t *config, uint16_t jiffies);
+  async command error_t configureSingleRepeat(const msp430adc12_channel_config_t *ONE config, uint16_t jiffies);
 
   
   /** 
@@ -135,7 +135,7 @@ interface Msp430Adc12SingleChannel
    * @return SUCCESS means that the ADC was configured successfully and
    * <code>getData()</code> can be called to start with the first conversion.
    */ 
-  async command error_t configureMultiple( const msp430adc12_channel_config_t *config, uint16_t buffer[], uint16_t numSamples, uint16_t jiffies);
+  async command error_t configureMultiple( const msp430adc12_channel_config_t *ONE config, uint16_t *COUNT(numSamples) buffer, uint16_t numSamples, uint16_t jiffies);
 
   /** 
    *
@@ -174,7 +174,7 @@ interface Msp430Adc12SingleChannel
    * @return SUCCESS means that the ADC was configured successfully and
    * <code>getData()</code> can be called to start with the first conversion.
    */ 
-  async command error_t configureMultipleRepeat(const msp430adc12_channel_config_t *config, uint16_t buffer[], uint8_t numSamples, uint16_t jiffies);
+  async command error_t configureMultipleRepeat(const msp430adc12_channel_config_t *ONE config, uint16_t *COUNT(numSamples) buffer, uint8_t numSamples, uint16_t jiffies);
 
 
   /** 
@@ -224,7 +224,7 @@ interface Msp430Adc12SingleChannel
    * <code>numSamples</code> entries. The return value is ignored if the ADC
    * was configured with <code>configureMultiple()</code>.
    */    
-  async event uint16_t* multipleDataReady(uint16_t buffer[], uint16_t numSamples); 
+  async event uint16_t * ONE_NOK multipleDataReady(uint16_t *COUNT(numSamples) buffer, uint16_t numSamples); 
 
 }
 
index 57102aaf7d0dccd839aa3ea623c0ff2aefca9152..9409ecba120d3ab518a52458fe16948465ee3f5c 100644 (file)
@@ -56,9 +56,9 @@ implementation {
     SPI_ATOMIC_SIZE = 2,
   };
 
-  norace uint8_t* m_tx_buf;
-  norace uint8_t* m_rx_buf;
   norace uint16_t m_len;
+  norace uint8_t* COUNT_NOK(m_len) m_tx_buf;
+  norace uint8_t* COUNT_NOK(m_len) m_rx_buf;
   norace uint16_t m_pos;
   norace uint8_t m_client;
 
index ca408466913a96e4d9335bd4c487bed0e060a5e2..0f598f91a399d5244260d01d53a2914f21f6a63b 100644 (file)
@@ -56,8 +56,8 @@ generic module Msp430UartP() {
 
 implementation {
   
-  norace uint8_t *m_tx_buf, *m_rx_buf;
   norace uint16_t m_tx_len, m_rx_len;
+  norace uint8_t * COUNT_NOK(m_tx_len) m_tx_buf, * COUNT_NOK(m_rx_len) m_rx_buf;
   norace uint16_t m_tx_pos, m_rx_pos;
   norace uint8_t m_byte_time;
   norace uint8_t current_owner;