Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29532/beta/tos/sensorboards/mts400
Modified Files:
GpsPacket.nc
Log Message:
Added link message handling.
Index: GpsPacket.nc
===================================================================
RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GpsPacket.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GpsPacket.nc 28 May 2005 00:09:40 -0000 1.3
--- GpsPacket.nc 30 Jul 2005 03:15:38 -0000 1.4
***************
*** 152,156 ****
bufferIndex = 0;
(GPS_Msg*) bufferPtr = &buffer;
! atomic{
state_gps = GPS_SWITCH_IDLE;
state_gps_pkt = NO_GPS_START_BYTE;
--- 152,156 ----
bufferIndex = 0;
(GPS_Msg*) bufferPtr = &buffer;
! atomic {
state_gps = GPS_SWITCH_IDLE;
state_gps_pkt = NO_GPS_START_BYTE;
***************
*** 176,190 ****
command result_t txBytes(uint8_t *bytes, uint8_t numBytes) {
! if (txCount == 0)
! {
! txCount = 1;
! txLength = numBytes;
! sendPtr = bytes;
! /* send the first byte */
! if (call ByteComm.txByte(sendPtr[0]))
! return SUCCESS;
! else
! txCount = 0;
! }
return FAIL;
}
--- 176,190 ----
command result_t txBytes(uint8_t *bytes, uint8_t numBytes) {
!
! if (txCount == 0) {
! txCount = 1;
! txLength = numBytes;
! sendPtr = bytes;
! /* send the first byte */
! if (call ByteComm.txByte(sendPtr[0]))
! return SUCCESS;
! else
! txCount = 0;
! }
return FAIL;
}
***************
*** 238,242 ****
void sendComplete(result_t success) {
! atomic{
if (state == PACKET){
TOS_MsgPtr msg = (TOS_MsgPtr)sendPtr;
--- 238,242 ----
void sendComplete(result_t success) {
! atomic {
if (state == PACKET){
TOS_MsgPtr msg = (TOS_MsgPtr)sendPtr;
***************
*** 277,293 ****
Send the next byte if there are data pending to be sent */
async event result_t ByteComm.txByteReady(bool success) {
! atomic{
! if (txCount > 0){
if (!success){
dbg(DBG_ERROR, "TX_packet failed, TX_byte_failed");
sendComplete(FAIL);
! }
! else if (txCount < txLength){
dbg(DBG_PACKET, "PACKET: byte sent: %x, COUNT: %d\n",
sendPtr[txCount], txCount);
! if (!call ByteComm.txByte(sendPtr[txCount++])) sendComplete(FAIL);
}
}
! } //atomic
return SUCCESS;
}
--- 277,295 ----
Send the next byte if there are data pending to be sent */
async event result_t ByteComm.txByteReady(bool success) {
!
! atomic {
! if (txCount > 0) {
if (!success){
dbg(DBG_ERROR, "TX_packet failed, TX_byte_failed");
sendComplete(FAIL);
! } else if (txCount < txLength) {
dbg(DBG_PACKET, "PACKET: byte sent: %x, COUNT: %d\n",
sendPtr[txCount], txCount);
! if (!call ByteComm.txByte(sendPtr[txCount++])) {
! sendComplete(FAIL);
! }
}
}
! }
return SUCCESS;
}
***************
*** 309,312 ****
--- 311,315 ----
atomic state_gps_pkt = NO_GPS_START_BYTE;
}
+
/******************************************************************************
* Byte received from GPS
|