
#include "delay.h"
#include "trigger.h"


void DelayNs(u32 ns)
{
	u32 bns, tmpns;
	bns = Get100NsSoftTimer();
	ns /= 100;
	do
	{
		tmpns = Get100NsSoftTimer();
		if (tmpns - bns > ns)
		{
			break;
		}
	}while(1);
}


void DelayUs(u32 us)
{
	u32 bus, tmpus;
	bus = GetUsSoftTimer();
	do
	{
		tmpus = GetUsSoftTimer();
		if (tmpus - bus > us)
		{
			break;
		}
	}while(1);
}

void DelayMs(u32 ms)
{
	u32 bus, msus, tmpus;
	bus = GetUsSoftTimer();
	msus = ms * 1000;
	do
	{
		tmpus = GetUsSoftTimer();
		if (tmpus - bus > msus)
		{
			break;
		}
	}while(1);
}
