#include #include "altera_avalon_sem_regs.h" #include "alt_types.h" #include "system.h" #define TIME_SETS 4 #define TIME_STATES 4 const alt_u32 divisors[TIME_SETS][TIME_STATES] = { {0x0ff00010, 0x0ff00010, 0x0ff00005, 0x00700010}, {0x0ff00010, 0x0ff00020, 0x0ff00010, 0x00700010}, {0x0ff000f1, 0x0ff000f1, 0x0ff000f1, 0x00700011}, {0x0ff000d1, 0x0ff000f1, 0x0ff000f1, 0x00700011} }; int main() { int i,j; volatile alt_u32 *p; alt_u32 tmp; //program divisors p = (alt_u32*) SEM_RAM_SLAVE_BASE; for (i = 0; i < TIME_SETS; i++) { for (j = TIME_STATES; j > 0; j--) { *p = divisors[i][j - 1]; alt_dcache_flush(); p++; } } //select timeset and run semafor IOWR_ALTERA_AVALON_SEM_DIVSET(SEM_CTL_SLAVE_BASE,0x02); IOWR_ALTERA_AVALON_SEM_CTL(SEM_CTL_SLAVE_BASE,0x01); printf("Ready\n"); while (1) { ; } return 0; }