Mobil_surveillance_system 1
FIFO.c
Go to the documentation of this file.
00001 #include "FIFO.h"
00002 
00004 
00011 //*****************************************************************************
00012 //
00013 // Function definitions
00014 //
00015 //*****************************************************************************
00016 
00017 
00019 tBoolean FIFO_isBufferFull( unsigned int *pulRead, unsigned int *pulWrite, unsigned int ulSize )
00021 {
00022     //  if the writing pointer catch up the read pointer the fifo is full
00023     return ( ( ( ( *pulWrite + 1 ) % ulSize ) == *pulRead ) ? 1 : 0 );
00024 }
00025 
00026 
00028 tBoolean FIFO_isBufferEmpty( unsigned int *pulRead, unsigned int *pulWrite )
00030 {
00031     // if the number of the read characters are the same as the written the fifo is empty
00032     return ( ( *pulWrite  == *pulRead ) ? 1 : 0 );
00033 }
00034 
00035 
00037 unsigned int FIFO_getBufferCount( unsigned int *pulRead, unsigned int *pulWrite, unsigned int ulSize )
00039 {
00040     return ( ( *pulWrite >= *pulRead ) ? ( *pulWrite - *pulRead ) : ( ulSize - ( *pulRead - *pulWrite ) ) );
00041 }
 All Data Structures Files Functions Variables Typedefs Enumerations Defines