Ejemplo n.º 1
0
BT_s32 BT_FifoFillLevel(BT_HANDLE hFifo) {

	BT_u32 messages = 0;

	if(!isFifoHandle(hFifo)) {
		return BT_ERR_INVALID_HANDLE_TYPE;
	}

	messages = BT_QueueMessagesWaiting(hFifo->hQueue);

	return messages;
}
Ejemplo n.º 2
0
/*---------------------------------------------------------------------------*
 * Routine:  sys_mbox_free
 *---------------------------------------------------------------------------*
 * Description:
 *      Deallocates a mailbox. If there are messages still present in the
 *      mailbox when the mailbox is deallocated, it is an indication of a
 *      programming error in lwIP and the developer should be notified.
 * Inputs:
 *      sys_mbox_t mbox         -- Handle of mailbox
 * Outputs:
 *      sys_mbox_t              -- Handle to new mailbox
 *---------------------------------------------------------------------------*/
void sys_mbox_free( sys_mbox_t *pxMailBox ) {
	BT_u32 ulMessagesWaiting;

	ulMessagesWaiting = BT_QueueMessagesWaiting( *pxMailBox );

	#if SYS_STATS
	{
		if( ulMessagesWaiting != 0UL ) {
			SYS_STATS_INC( mbox.err );
		}

		SYS_STATS_DEC( mbox.used );
	}
	#endif /* SYS_STATS */

	BT_CloseHandle( *pxMailBox );
}
Ejemplo n.º 3
0
BT_BOOL BT_FifoIsFull(BT_HANDLE hFifo, BT_ERROR *pError) {

	BT_ERROR Error 	= BT_ERR_NONE;
	BT_u32 messages = 0;

	if(!isFifoHandle(hFifo)) {
		Error = BT_ERR_INVALID_HANDLE_TYPE;
		goto err_out;
	}

	messages = BT_QueueMessagesWaiting(hFifo->hQueue);

err_out:
	if(pError) {
		*pError = Error;
	}

	return Error ? BT_FALSE : (hFifo->ulElements == messages);
}