You might have a look at the open source Wait Processor Expert component which is available on SourceForge, see
McuOnEclipse Releases on SourceForge | MCU on Eclipse
It comes with various busy wait routines:

If you are not using Processor Expert: you simply generate the code and use the WAIT1.c and WAIT1.h files in your project.
I hope this helps,
Erich