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);
}
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;
/* 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;
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;
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
{
}
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;
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() */
case MULTI_CHANNEL:
{
uint16_t i = 0, k;
+ resultBufferStart = resultBuffer;
do {
*resultBuffer++ = call HplAdc12.getMem(i);
} while (++i < numChannels);
case MULTIPLE_DATA:
{
uint16_t i = 0, length, k;
+ resultBufferStart = resultBuffer;
if (resultBufferLength - resultBufferIndex > 16)
length = 16;
else
case MULTIPLE_DATA_REPEAT:
{
uint8_t i = 0;
+ resultBufferStart = resultBuffer;
do {
*resultBuffer++ = call HplAdc12.getMem(i);
} while (++i < resultBufferLength);
* @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
* @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);
/**
* @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);
/**
*
* @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);
/**
* <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);
}
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;
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;