[1177] | 1 | #ifndef WARP_TIMER_MACROS_H |
---|
| 2 | #define WARP_TIMER_MACROS_H |
---|
[1019] | 3 | |
---|
| 4 | #include "xbasic_types.h" |
---|
| 5 | #include "xstatus.h" |
---|
| 6 | #include "xio.h" |
---|
| 7 | |
---|
[1177] | 8 | #define TIMER_MASK_CALC(id) ((unsigned int)(0xF << (id * 4))) |
---|
[1019] | 9 | |
---|
[1177] | 10 | #define TIMER0_MASK 0x0000000F |
---|
| 11 | #define TIMER1_MASK 0x000000F0 |
---|
| 12 | #define TIMER2_MASK 0x00000F00 |
---|
| 13 | #define TIMER3_MASK 0x0000F000 |
---|
| 14 | #define TIMER4_MASK 0x000F0000 |
---|
| 15 | #define TIMER5_MASK 0x00F00000 |
---|
| 16 | #define TIMER6_MASK 0x0F000000 |
---|
| 17 | #define TIMER7_MASK 0xF0000000 |
---|
| 18 | |
---|
| 19 | #define TIMER_CONTROL_START_MASK 0x11111111 |
---|
| 20 | #define TIMER_CONTROL_PAUSE_MASK 0x22222222 |
---|
| 21 | #define TIMER_CONTROL_MODE_MASK 0x44444444 |
---|
| 22 | #define TIMER_CONTROL_RESETDONE_MASK 0x88888888 |
---|
| 23 | |
---|
| 24 | #define TIMER_STATUS_PASUED_MASK 0x11111111 |
---|
| 25 | #define TIMER_STATUS_RUNNING_MASK 0x22222222 |
---|
| 26 | #define TIMER_STATUS_DONE_MASK 0x44444444 |
---|
| 27 | |
---|
| 28 | //Register writing macros |
---|
| 29 | #define warp_timer_WriteReg_control(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER_CONTROL, (unsigned int)(d)) |
---|
| 30 | #define warp_timer_WriteReg_timer0_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER0_SLOTCOUNT, (unsigned int)(d)) |
---|
| 31 | #define warp_timer_WriteReg_timer1_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER1_SLOTCOUNT, (unsigned int)(d)) |
---|
| 32 | #define warp_timer_WriteReg_timer2_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER2_SLOTCOUNT, (unsigned int)(d)) |
---|
| 33 | #define warp_timer_WriteReg_timer3_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER3_SLOTCOUNT, (unsigned int)(d)) |
---|
| 34 | #define warp_timer_WriteReg_timer4_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER4_SLOTCOUNT, (unsigned int)(d)) |
---|
| 35 | #define warp_timer_WriteReg_timer5_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER5_SLOTCOUNT, (unsigned int)(d)) |
---|
| 36 | #define warp_timer_WriteReg_timer6_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER6_SLOTCOUNT, (unsigned int)(d)) |
---|
| 37 | #define warp_timer_WriteReg_timer7_slotCount(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER7_SLOTCOUNT, (unsigned int)(d)) |
---|
| 38 | #define warp_timer_WriteReg_timers01_slotTime(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS01_SLOTTIME, (unsigned int)(d)) |
---|
| 39 | #define warp_timer_WriteReg_timers23_slotTime(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS23_SLOTTIME, (unsigned int)(d)) |
---|
| 40 | #define warp_timer_WriteReg_timers45_slotTime(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS45_SLOTTIME, (unsigned int)(d)) |
---|
| 41 | #define warp_timer_WriteReg_timers67_slotTime(d) XIo_Out32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS67_SLOTTIME, (unsigned int)(d)) |
---|
| 42 | |
---|
| 43 | //Register reading macros |
---|
| 44 | //Read-only reg |
---|
| 45 | #define warp_timer_ReadReg_status() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER_STATUS) |
---|
| 46 | |
---|
| 47 | //Read-write regs |
---|
| 48 | #define warp_timer_ReadReg_control() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER_CONTROL) |
---|
| 49 | #define warp_timer_ReadReg_timer0_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER0_SLOTCOUNT) |
---|
| 50 | #define warp_timer_ReadReg_timer1_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER1_SLOTCOUNT) |
---|
| 51 | #define warp_timer_ReadReg_timer2_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER2_SLOTCOUNT) |
---|
| 52 | #define warp_timer_ReadReg_timer3_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER3_SLOTCOUNT) |
---|
| 53 | #define warp_timer_ReadReg_timer4_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER4_SLOTCOUNT) |
---|
| 54 | #define warp_timer_ReadReg_timer5_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER5_SLOTCOUNT) |
---|
| 55 | #define warp_timer_ReadReg_timer6_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER6_SLOTCOUNT) |
---|
| 56 | #define warp_timer_ReadReg_timer7_slotCount() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMER7_SLOTCOUNT) |
---|
| 57 | #define warp_timer_ReadReg_timers01_slotTime() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS01_SLOTTIME) |
---|
| 58 | #define warp_timer_ReadReg_timers23_slotTime() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS23_SLOTTIME) |
---|
| 59 | #define warp_timer_ReadReg_timers45_slotTime() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS45_SLOTTIME) |
---|
| 60 | #define warp_timer_ReadReg_timers67_slotTime() XIo_In32(XPAR_WARP_TIMER_PLBW_0_MEMMAP_TIMERS67_SLOTTIME) |
---|
| 61 | |
---|
| 62 | |
---|
[1019] | 63 | #endif |
---|