refractor fifo_t to handle generic data
add more check guard for fifo_read & fifo_write
change the test_fifo.c to use new fifo API