7f7ba9accbce36eabadcd8a1a0437311ed848e5d
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

1) #include "cyc_cnt.h"
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

2) #include "lcd.h"
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

3) #include "leds.h"
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

4) #include "uart.h"
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

5) #include "switches.h"
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

6) 
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

7) //#define CFG_DELAY
8) //#define CFG_LCD
9) #define CFG_UART
Stefan Schuermans added FIFO to UART RX

Stefan Schuermans authored 12 years ago

10) #define CFG_UART_CHK
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

11) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

12) const int myconst = 0x12345678;
13) 
14) int myvar = 0x11223344;
15) 
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

16) volatile int data[100];
17) 
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

18) void switches(void)
19) {
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

20) #ifdef CFG_LCD
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

21)   lcd_chr(1, 0, switches_get_state(sw_0) ? '0' : ' ');
22)   lcd_chr(1, 1, switches_get_state(sw_1) ? '1' : ' ');
23)   lcd_chr(1, 2, switches_get_state(sw_2) ? '2' : ' ');
24)   lcd_chr(1, 3, switches_get_state(sw_3) ? '3' : ' ');
25)   lcd_chr(1, 4, switches_get_state(sw_east) ? 'E' : ' ');
26)   lcd_chr(1, 5, switches_get_state(sw_north) ? 'N' : ' ');
27)   lcd_chr(1, 6, switches_get_state(sw_south) ? 'S' : ' ');
28)   lcd_chr(1, 7, switches_get_state(sw_west) ? 'W' : ' ');
29)   lcd_chr(1, 8, switches_get_state(sw_center) ? 'C' : ' ');
30)   lcd_chr(1, 9, switches_get_state(sw_rot_a) ? 'a' : ' ');
31)   lcd_chr(1, 10, switches_get_state(sw_rot_b) ? 'b' : ' ');
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

32) #endif
Stefan Schuermans implemented displaying rota...

Stefan Schuermans authored 12 years ago

33) 
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

34) #ifdef CFG_LCD
Stefan Schuermans implemented displaying rota...

Stefan Schuermans authored 12 years ago

35)   unsigned int cnt = switches_get_rot_cnt();
36)   lcd_chr(1, 12, '0' + (cnt >> 9 & 0x7));
37)   lcd_chr(1, 13, '0' + (cnt >> 6 & 0x7));
38)   lcd_chr(1, 14, '0' + (cnt >> 3 & 0x7));
39)   lcd_chr(1, 15, '0' + (cnt & 0x7));
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

40) #endif
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

41) }
42) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

43) void delay(void)
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

44) {
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

45)   unsigned int i;
46)   for (i = 0; i < 10; ++i) {
47)     switches();
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

48) #ifdef CFG_DELAY
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

49)     cyc_cnt_delay_ms(20);
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

50) #endif
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

51)   }
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

52) }
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

53) 
54) int main()
55) {
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

56)   unsigned int i;
57) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

58)   for (i = 0; i < sizeof(data) / sizeof(data[0]); ++i)
59)     data[i] = i;
60) 
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

61) #ifdef CFG_LCD
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

62)   lcd_init();
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

63)   lcd_str(0, "MIPS I system");
64)   lcd_str(1, "");
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

65) #endif
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

66) 
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

67) #ifdef CFG_UART
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

68)   uart_cfg_scale(62); /* 115200 */
69)   uart_cfg_bits(8);
70)   uart_cfg_stop(1);
71)   uart_tx('M');
72)   uart_tx('I');
73)   uart_tx('P');
74)   uart_tx('S');
75)   uart_tx(' ');
76)   uart_tx('I');
77)   uart_tx('\r');
78)   uart_tx('\n');
Stefan Schuermans added FIFO to UART RX

Stefan Schuermans authored 12 years ago

79) #ifdef CFG_UART_CHK
80)   if (uart_rx() != 'M') while(1);
81)   if (uart_rx() != 'I') while(1);
82)   if (uart_rx() != 'P') while(1);
83)   if (uart_rx() != 'S') while(1);
84)   if (uart_rx() != ' ') while(1);
85)   if (uart_rx() != 'I') while(1);
86)   if (uart_rx() != '\r') while(1);
87)   if (uart_rx() != '\n') while(1);
88) #endif
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

89) #endif
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

90) 
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

91)   while (1) {
92)     for (i = 0x1; i < 0x80; i <<= 1) {
93)       leds_set_state(i);
94)       delay();
95)     }
96)     for (i = 0x80; i > 0x1; i >>= 1) {
97)       leds_set_state(i);
98)       delay();
99)     }
100)   }
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

101)