[Tinyos-2-commits] CVS: tinyos-2.x/tos/system AMQueueImplP.nc,
1.1.2.2, 1.1.2.3 AMQueueP.nc, 1.1.2.2, 1.1.2.3 RandomMlcgP.nc,
1.1.2.3, 1.1.2.4
Phil Levis
scipio at users.sourceforge.net
Mon May 15 09:42:06 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/system
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv9825
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
AMQueueImplP.nc AMQueueP.nc RandomMlcgP.nc
Log Message:
Make the AM send queue a generic, RandomMlcgP should be doing an
explicit cast.
Index: AMQueueImplP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/Attic/AMQueueImplP.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** AMQueueImplP.nc 29 Jan 2006 20:32:25 -0000 1.1.2.2
--- AMQueueImplP.nc 15 May 2006 16:42:04 -0000 1.1.2.3
***************
*** 32,36 ****
#include "AM.h"
! module AMQueueImplP {
provides interface Send[uint8_t client];
uses{
--- 32,36 ----
#include "AM.h"
! generic module AMQueueImplP(int numClients) {
provides interface Send[uint8_t client];
uses{
***************
*** 46,50 ****
enum {
QUEUE_EMPTY = 255,
- NUM_CLIENTS = uniqueCount(UQ_AMQUEUE_SEND),
};
--- 46,49 ----
***************
*** 54,58 ****
uint8_t current = QUEUE_EMPTY;
! queue_entry_t queue[NUM_CLIENTS];
--- 53,57 ----
uint8_t current = QUEUE_EMPTY;
! queue_entry_t queue[numClients];
***************
*** 66,71 ****
}
i = initial;
! for (; i < (initial + NUM_CLIENTS); i++) {
! uint8_t client = (uint8_t)i % NUM_CLIENTS;
if (queue[client].msg != NULL) {
current = client;
--- 65,70 ----
}
i = initial;
! for (; i < (initial + numClients); i++) {
! uint8_t client = (uint8_t)i % numClients;
if (queue[client].msg != NULL) {
current = client;
***************
*** 78,88 ****
command error_t Send.send[uint8_t clientId](message_t* msg,
! uint8_t len) {
! if (clientId > NUM_CLIENTS) {return FAIL;}
if (queue[clientId].msg != NULL) {return EBUSY;}
dbg("AMQueue", "AMQueue: request to send from %hhu (%p): passed checks\n", clientId, msg);
queue[clientId].msg = msg;
!
if (current == QUEUE_EMPTY) {
error_t err;
--- 77,88 ----
command error_t Send.send[uint8_t clientId](message_t* msg,
! uint8_t len) {
! if (clientId > numClients) {return FAIL;}
if (queue[clientId].msg != NULL) {return EBUSY;}
dbg("AMQueue", "AMQueue: request to send from %hhu (%p): passed checks\n", clientId, msg);
queue[clientId].msg = msg;
! call Packet.setPayloadLength(msg, len);
!
if (current == QUEUE_EMPTY) {
error_t err;
***************
*** 106,110 ****
command error_t Send.cancel[uint8_t clientId](message_t* msg) {
! if (clientId > NUM_CLIENTS || // Not a valid client
queue[clientId].msg == NULL || // No packet pending
queue[clientId].msg != msg) { // Not the right packet
--- 106,110 ----
command error_t Send.cancel[uint8_t clientId](message_t* msg) {
! if (clientId > numClients || // Not a valid client
queue[clientId].msg == NULL || // No packet pending
queue[clientId].msg != msg) { // Not the right packet
Index: AMQueueP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/Attic/AMQueueP.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** AMQueueP.nc 29 Jan 2006 20:32:25 -0000 1.1.2.2
--- AMQueueP.nc 15 May 2006 16:42:04 -0000 1.1.2.3
***************
*** 37,41 ****
implementation {
! components AMQueueImplP, ActiveMessageC;
Send = AMQueueImplP;
--- 37,45 ----
implementation {
! enum {
! NUM_CLIENTS = uniqueCount(UQ_AMQUEUE_SEND)
! };
!
! components new AMQueueImplP(NUM_CLIENTS), ActiveMessageC;
Send = AMQueueImplP;
Index: RandomMlcgP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/system/Attic/RandomMlcgP.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** RandomMlcgP.nc 29 Jan 2006 18:07:50 -0000 1.1.2.3
--- RandomMlcgP.nc 15 May 2006 16:42:04 -0000 1.1.2.4
***************
*** 77,81 ****
/* Return low 16 bits of next 32 bit random number */
async command uint16_t Random.rand16() {
! return call Random.rand32();
}
--- 77,81 ----
/* Return low 16 bits of next 32 bit random number */
async command uint16_t Random.rand16() {
! return (uint16_t)call Random.rand32();
}
More information about the Tinyos-2-commits
mailing list