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 uint16_t m_byte_time;
norace uint8_t m_rx_intr;
else if ( m_tx_buf )
return EBUSY;
- m_tx_buf = buf;
m_tx_len = len;
+ m_tx_buf = buf;
m_tx_pos = 0;
m_tx_intr = 1;
call HplUart.enableTxIntr();
/* 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;
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 = 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);
nextAlarm();
}
}
}
}
implementation {
- uint8_t* txBuffer;
- uint8_t* rxBuffer;
uint16_t len;
+ uint8_t* COUNT_NOK(len) txBuffer;
+ uint8_t* COUNT_NOK(len) rxBuffer;
uint16_t pos;
enum {
error_t sendNextPart() {
uint16_t end;
uint16_t tmpPos;
- uint8_t* tx;
- uint8_t* rx;
+ uint16_t myLen;
+ uint8_t* COUNT_NOK(myLen) tx;
+ uint8_t* COUNT_NOK(myLen) rx;
atomic {
+ myLen = len;
tx = txBuffer;
rx = rxBuffer;
tmpPos = pos;
task void zeroTask() {
- uint8_t* rx;
- uint8_t* tx;
uint16_t myLen;
+ uint8_t* COUNT_NOK(myLen) rx;
+ uint8_t* COUNT_NOK(myLen) tx;
+
atomic {
+ myLen = len;
rx = rxBuffer;
tx = txBuffer;
- myLen = len;
rxBuffer = NULL;
txBuffer = NULL;
len = 0;
uint16_t bufLen) {
uint8_t discard;
atomic {
+ len = bufLen;
txBuffer = writeBuf;
rxBuffer = readBuf;
- len = bufLen;
pos = 0;
}
if (bufLen > 0) {
sendNextPart();
}
else {
- uint8_t* rx;
- uint8_t* tx;
- uint16_t myLen;
uint8_t discard;
+ uint16_t myLen;
+ uint8_t* COUNT_NOK(myLen) rx;
+ uint8_t* COUNT_NOK(myLen) tx;
atomic {
+ myLen = len;
rx = rxBuffer;
tx = txBuffer;
- myLen = len;
rxBuffer = NULL;
txBuffer = NULL;
len = 0;
//=== Read the control registers. =====================================
async command Atm128TimerCtrlCompare_t TimerCtrl.getCtrlCompare() {
- return *(Atm128TimerCtrlCompare_t*)&TCCR1A;
+ return *(Atm128TimerCtrlCompare_t*ONE)&TCCR1A;
}
async command Atm128TimerCtrlCapture_t TimerCtrl.getCtrlCapture() {
- return *(Atm128TimerCtrlCapture_t*)&TCCR1B;
+ return *(Atm128TimerCtrlCapture_t*ONE)&TCCR1B;
}
async command Atm128TimerCtrlClock_t TimerCtrl.getCtrlClock() {
- return *(Atm128TimerCtrlClock_t*)&TCCR1C;
+ return *(Atm128TimerCtrlClock_t*ONE)&TCCR1C;
}
//=== Read the interrupt flags. =====================================
async command Atm128_ETIFR_t TimerCtrl.getInterruptFlag() {
- return *(Atm128_ETIFR_t*)&ETIFR;
+ return *(Atm128_ETIFR_t*ONE)&ETIFR;
}
//=== Write the interrupt flags. ====================================