[Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/pxa27x/lib
queue.c, 1.1, 1.2 queue.h, 1.1, 1.2
Lama Nachman
lnachman at users.sourceforge.net
Tue Oct 18 14:32:35 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4692
Modified Files:
queue.c queue.h
Log Message:
Index: queue.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/lib/queue.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** queue.c 6 Sep 2005 18:19:35 -0000 1.1
--- queue.c 18 Oct 2005 21:32:32 -0000 1.2
***************
*** 1,7 ****
#include "queue.h"
! int pushqueue(queue_t *queue, unsigned long val){
//check to see if there is room in the queue
! unsigned short availableslots = (queue->head <= queue->tail) ? queue->size - queue->tail + queue->head: queue->head - queue->tail;
//available entries in the queue is really size-1 since we need to guard against aliasing
if(availableslots > 1 ){
--- 1,7 ----
#include "queue.h"
! int pushqueue(queue_t *queue, uint32_t val){
//check to see if there is room in the queue
! uint16_t availableslots = (queue->head <= queue->tail) ? queue->size - queue->tail + queue->head: queue->head - queue->tail;
//available entries in the queue is really size-1 since we need to guard against aliasing
if(availableslots > 1 ){
***************
*** 18,22 ****
}
! int popqueue(queue_t *queue, unsigned long *val) {
if(queue->head != queue->tail){
*val = queue->entries[queue->head];
--- 18,22 ----
}
! int popqueue(queue_t *queue, uint32_t *val) {
if(queue->head != queue->tail){
*val = queue->entries[queue->head];
***************
*** 34,38 ****
}
! void initqueue(queue_t *queue, unsigned long size) {
queue->head = 0;
queue->tail = 0;
--- 34,38 ----
}
! void initqueue(queue_t *queue, uint32_t size) {
queue->head = 0;
queue->tail = 0;
Index: queue.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/pxa27x/lib/queue.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** queue.h 6 Sep 2005 18:19:35 -0000 1.1
--- queue.h 18 Oct 2005 21:32:32 -0000 1.2
***************
*** 2,5 ****
--- 2,7 ----
#define __QUEUE_H__
+ #include "inttypes.h"
+
#define QUEUE_SIZE 256
***************
*** 9,20 ****
typedef struct{
! unsigned long entries[QUEUE_SIZE];
! unsigned short head, tail;
! unsigned short size;
} queue_t;
! int pushqueue(queue_t *queue, unsigned long val);
! int popqueue(queue_t *queue, unsigned long *val);
! void initqueue(queue_t *queue, unsigned long size);
#endif
--- 11,22 ----
typedef struct{
! uint32_t entries[QUEUE_SIZE];
! uint16_t head, tail;
! uint16_t size;
} queue_t;
! int pushqueue(queue_t *queue, uint32_t val);
! int popqueue(queue_t *queue, uint32_t *val);
! void initqueue(queue_t *queue, uint32_t size);
#endif
More information about the Tinyos-beta-commits
mailing list