Mobil_surveillance_system 1
Functions
FIFO.c File Reference

FIFO container source file. More...

#include "FIFO.h"

Go to the source code of this file.

Functions

tBoolean FIFO_isBufferFull (unsigned int *pulRead, unsigned int *pulWrite, unsigned int ulSize)
tBoolean FIFO_isBufferEmpty (unsigned int *pulRead, unsigned int *pulWrite)
unsigned int FIFO_getBufferCount (unsigned int *pulRead, unsigned int *pulWrite, unsigned int ulSize)

Detailed Description

FIFO container source file.

This file contains the definations of the basic functions of the FIFO data stucture.

Definition in file FIFO.c.


Function Documentation

unsigned int FIFO_getBufferCount ( unsigned int *  pulRead,
unsigned int *  pulWrite,
unsigned int  ulSize 
)
Parameters:
pulRead
pulWrite
ulSize
Returns:

Definition at line 37 of file FIFO.c.

{
    return ( ( *pulWrite >= *pulRead ) ? ( *pulWrite - *pulRead ) : ( ulSize - ( *pulRead - *pulWrite ) ) );
}
tBoolean FIFO_isBufferEmpty ( unsigned int *  pulRead,
unsigned int *  pulWrite 
)
Parameters:
pulRead
pulWrite
Returns:

Definition at line 28 of file FIFO.c.

{
    // if the number of the read characters are the same as the written the fifo is empty
    return ( ( *pulWrite  == *pulRead ) ? 1 : 0 );
}
tBoolean FIFO_isBufferFull ( unsigned int *  pulRead,
unsigned int *  pulWrite,
unsigned int  ulSize 
)
Parameters:
pulRead
pulWrite
ulSize
Returns:

Definition at line 19 of file FIFO.c.

{
    //  if the writing pointer catch up the read pointer the fifo is full
    return ( ( ( ( *pulWrite + 1 ) % ulSize ) == *pulRead ) ? 1 : 0 );
}
 All Data Structures Files Functions Variables Typedefs Enumerations Defines