DMU380ZA Series
User’s Manual
________________________________________________________________________
Doc# 7430-3810 Rev. 02
Page 100
}
return retval;
}
/*******************************************************************************
* FUNCTION: peekByte returns 1 byte from buffer without popping
* ARGUMENTS: queue_ptr is pointer to the queue to return byte from
*
index is offset into buffer to which byte to return
* RETURNS:
1 byte
* REMARKS:
does not do boundary checking. please do this first
*******************************************************************************/
char peekByte(QUEUE_TYPE *queue_ptr, unsigned int index) {
char byte;
int firstIndex;
firstIndex = (queue_ptr->front + index) % MAXQUEUE;
byte = queue_ptr->entry[firstIndex];
return byte;
}
/*******************************************************************************
* FUNCTION: peekWord returns 2-byte word from buffer without popping
* ARGUMENTS: queue_ptr is pointer to the queue to return word from
*
index is offset into buffer to which word to return
* RETURNS:
2-byte word
* REMARKS:
does not do boundary checking. please do this first
*******************************************************************************/
unsigned short peekWord(QUEUE_TYPE *queue_ptr, unsigned int index) {
unsigned short word, firstIndex, secondIndex;
firstIndex = (queue_ptr->front + index) % MAXQUEUE;
secondIndex = (queue_ptr->front + index + 1) % MAXQUEUE;
word = (queue_ptr->entry[firstIndex] << 8) & 0xFF00;
word |= (0x00FF & queue_ptr->entry[secondIndex]);
return word;
}
/*******************************************************************************
* FUNCTION: Pop - discard item(s) from queue
* ARGUMENTS: queue_ptr is pointer to the queue
*
numToPop is number of items to discard
* RETURNS:
return the number of items discarded