[Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/imote2
UARTBufferM.nc, 1.1, 1.2
Robbie Adler
radler at users.sourceforge.net
Mon Jul 25 18:37:39 PDT 2005
- Previous message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/imote2
BulkTxRx.nc, NONE, 1.1 HPLSSP.nc, NONE, 1.1 HPLSSP1M.nc, NONE,
1.1 SingleTxRx.nc, NONE, 1.1 SSP.nc, NONE, 1.1 SSP1C.nc, NONE,
1.1 SSP1M.nc, NONE, 1.1
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/pxa27x
pxa27x_registers.h, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/beta/platform/imote2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26779
Modified Files:
UARTBufferM.nc
Log Message:
fixed lots of atomic errors/warnings
Index: UARTBufferM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/imote2/UARTBufferM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UARTBufferM.nc 9 Mar 2005 00:59:24 -0000 1.1
--- UARTBufferM.nc 26 Jul 2005 01:37:37 -0000 1.2
***************
*** 76,83 ****
command result_t Control.init() {
- Head = 0;
- Tail = 0;
atomic {
! BytePending = FALSE;
}
--- 76,83 ----
command result_t Control.init() {
atomic {
! Head = 0;
! Tail = 0;
! BytePending = FALSE;
}
***************
*** 101,118 ****
result_t SendNextByte() {
bool busy;
atomic {
busy = (BytePending == TRUE);
}
if (busy) {
return FAIL;
}
!
! if (Head == Tail) return SUCCESS; // buffer is empty
atomic {
BytePending = TRUE;
}
! call ByteComm.txByte(Buffer[Tail]);
// if (call ByteComm.txByte(Buffer[Tail]) == FAIL) {
// // UART not enabled
--- 101,122 ----
result_t SendNextByte() {
bool busy;
+ uint32_t queueEmpty;
+ char nextChar;
atomic {
busy = (BytePending == TRUE);
+ queueEmpty = (Head ==Tail);
}
if (busy) {
return FAIL;
}
!
! if (queueEmpty) return SUCCESS; // buffer is empty
atomic {
BytePending = TRUE;
+ nextChar = Buffer[Tail];
}
! call ByteComm.txByte(nextChar);
// if (call ByteComm.txByte(Buffer[Tail]) == FAIL) {
// // UART not enabled
***************
*** 133,147 ****
// see if there's enough room for this packet
! size = (Head < Tail) ? Head + BUFFER_SIZE - Tail : Head - Tail;
if (size + length >= BUFFER_SIZE) return FAIL; // not enough room
// copy incoming bytes to the buffer
! for (i = 0; i < length; i++) {
! Buffer[Head] = data[i];
! Head = NEXT_BUFFER(Head, BUFFER_SIZE);
! }
!
! atomic {
! not_busy = (BytePending == FALSE);
}
--- 137,152 ----
// see if there's enough room for this packet
! atomic{
! size = (Head < Tail) ? Head + BUFFER_SIZE - Tail : Head - Tail;
! }
if (size + length >= BUFFER_SIZE) return FAIL; // not enough room
// copy incoming bytes to the buffer
! atomic{
! for (i = 0; i < length; i++) {
! Buffer[Head] = data[i];
! Head = NEXT_BUFFER(Head, BUFFER_SIZE);
! }
! not_busy = (BytePending == FALSE);
}
***************
*** 167,175 ****
async event result_t ByteComm.txByteReady(bool success) {
atomic {
BytePending = FALSE;
}
- if (Head == Tail) return SUCCESS;
- Tail = NEXT_BUFFER(Tail, BUFFER_SIZE);
SendNextByte();
--- 172,184 ----
async event result_t ByteComm.txByteReady(bool success) {
+ uint32_t queueEmpty;
atomic {
BytePending = FALSE;
+ queueEmpty = (Head == Tail);
+ }
+ if (queueEmpty) return SUCCESS;
+ atomic {
+ Tail = NEXT_BUFFER(Tail, BUFFER_SIZE);
}
SendNextByte();
***************
*** 181,184 ****
--- 190,194 ----
async event result_t ByteComm.rxByteReady(uint8_t data, bool error, uint16_t str) {
+ //arguably need to add receive fifo here, however what should its behavior be?
signal ReceiveData.receive(&data, 1);
return SUCCESS;
- Previous message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/imote2
BulkTxRx.nc, NONE, 1.1 HPLSSP.nc, NONE, 1.1 HPLSSP1M.nc, NONE,
1.1 SingleTxRx.nc, NONE, 1.1 SSP.nc, NONE, 1.1 SSP1C.nc, NONE,
1.1 SSP1M.nc, NONE, 1.1
- Next message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/pxa27x
pxa27x_registers.h, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-beta-commits
mailing list