I have a function in which I used. On debugging I can see count value as 1000 in watch.
static void func1(void) { uint32_t cnt; cnt = 1000; /* Create a counter variable */ while( (--cnt) && ( SD_WHILE_TX_FIFO_EMPTY ) ); /* Wait while not TX_FIFO Empty */ if(cnt == 0) { sd_card_error = 1; /* Error Write failed */ } SSP0_DATA_REG = value; /* Write the value */ }
However if I use. On debugging, cnt value is always zero in watch. Even if it is at statement cnt = 1000;:
__attribute__( ( always_inline ) ) __STATIC_INLINE void func1(void) { uint32_t cnt; cnt = 1000; /* Create a counter variable */ while( (--cnt) && ( SD_WHILE_TX_FIFO_EMPTY ) ); /* Wait while not TX_FIFO Empty */ if(cnt == 0) { sd_card_error = 1; /* Error Write failed */ } SSP0_DATA_REG = value; /* Write the value */ }