Tool/software: TI C/C++ Compiler
I looked for and couldn't find an example of a sub microsecond delay macro or function. Though I did see a few related questions.
The method isn't perfect. Hopefully this will be useful for anyone else in need of reliable delays less than 1 microsecond.
Spacing in several areas of the final macro are important.
#define HASH # #define GLUE(x) x #define QUOTES_HELPER(x) #x #define QUOTES(x) QUOTES_HELPER(x) // On the TMS320F28379D there are 15 ns of overhead, and each nsChunk is 5 ns (200 MHz). // e.g. nsDelay(0,D1) will delay for 15 ns, the overhead amount. // nsDelay(1,D2) for 20 ns, nsDelay(2,D2) for 25 ns, and so on. // The 'label' parameter must be unique for each instance of nsDelay() #define nsDelay(nsChunk, label) asm(QUOTES(label: RPT GLUE(HASH)GLUE(nsChunk) || nop))