3586a3195a45f87601f6e1d335cb8c9fb84b1dc9
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 UART firmware for testing i...

Stefan Schuermans authored 12 years ago

7) #define CFG_DELAY
8) #define CFG_LCD
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

9) #define CFG_UART
Stefan Schuermans UART firmware for testing i...

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;
Stefan Schuermans add UART error check to FW

Stefan Schuermans authored 12 years ago

57)   unsigned short chr;
Stefan Schuermans UART firmware for testing i...

Stefan Schuermans authored 12 years ago

58)   unsigned char leds;
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

59) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

63) #ifdef CFG_LCD
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

64)   lcd_init();
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

67) #endif
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

92) 
Stefan Schuermans UART firmware for testing i...

Stefan Schuermans authored 12 years ago

93)   leds = 0x11;
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

94)   while (1) {
Stefan Schuermans UART firmware for testing i...

Stefan Schuermans authored 12 years ago

95) #ifdef CFG_UART
Stefan Schuermans add UART error check to FW

Stefan Schuermans authored 12 years ago

96)     if (uart_can_rx()) {
97)       chr = uart_rx();
98)       if (uart_is_err(chr))
99)         leds = 0;
100)       else
101)         leds = chr;
102)     }
Stefan Schuermans UART firmware for testing i...

Stefan Schuermans authored 12 years ago

103) #endif
104)     leds_set_state(leds);
105)     leds = leds << 1 | leds >> 7;
106)     delay();
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

107)   }
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

108)