firmware: Guard the timer manipulation macro argument
This commit is contained in:
parent
394af632aa
commit
5fd891ecc0
@ -212,21 +212,21 @@ static void jmp_to_user_fw(void) __naked
|
|||||||
// timers clock is 2 MHz so we need to wait for 2000 ticks to get delay of 1ms
|
// timers clock is 2 MHz so we need to wait for 2000 ticks to get delay of 1ms
|
||||||
#define T0_SET_TIMEOUT(n) { \
|
#define T0_SET_TIMEOUT(n) { \
|
||||||
TL0 = 0x00; \
|
TL0 = 0x00; \
|
||||||
TH0 = (0x10000u - n) >> 8; \
|
TH0 = (0x10000u - (n)) >> 8; \
|
||||||
TL0 = (0x10000u - n) & 0xff; \
|
TL0 = (0x10000u - (n)) & 0xff; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define T1_SET_TIMEOUT(n) { \
|
#define T1_SET_TIMEOUT(n) { \
|
||||||
TL1 = 0x00; \
|
TL1 = 0x00; \
|
||||||
TH1 = (0x10000u - n) >> 8; \
|
TH1 = (0x10000u - (n)) >> 8; \
|
||||||
TL1 = (0x10000u - n) & 0xff; \
|
TL1 = (0x10000u - (n)) & 0xff; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define delay_us(n) { \
|
#define delay_us(n) { \
|
||||||
TL0 = 0x00; \
|
TL0 = 0x00; \
|
||||||
TF0 = 0; \
|
TF0 = 0; \
|
||||||
TH0 = (0x10000u - 2 * n) >> 8; \
|
TH0 = (0x10000u - 2 * (n)) >> 8; \
|
||||||
TL0 = (0x10000u - 2 * n) & 0xff; \
|
TL0 = (0x10000u - 2 * (n)) & 0xff; \
|
||||||
while (!TF0); \
|
while (!TF0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user