#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
void mdelay(int ms_count)
{
struct timeval tpStart, tpEnd;
float timeUse;
gettimeofday(&tpStart, NULL);
do {
gettimeofday(&tpEnd, NULL);
timeUse = 1000 * (tpEnd.tv_sec - tpStart.tv_sec) + 0.001 * (tpEnd.tv_usec - tpStart.tv_usec);
} while(timeUse < ms_count);
}