47f05ce618f31c873c88ab640434eacbf4513740
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

1) #include "cyc_cnt.h"
Stefan Schuermans begin of ethernet RX implem...

Stefan Schuermans authored 12 years ago

2) #include "eth.h"
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

8) #define CFG_DELAY
Stefan Schuermans begin of ethernet RX implem...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

13) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

18) volatile int data[100];
19) 
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

20) void switches(void)
21) {
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

22) #ifdef CFG_LCD
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

42) #endif
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

43) }
44) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

46) {
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

47)   unsigned int i;
Stefan Schuermans begin of ethernet RX implem...

Stefan Schuermans authored 12 years ago

48)   unsigned char chr;
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

49)   for (i = 0; i < 10; ++i) {
50)     switches();
Stefan Schuermans begin of ethernet RX implem...

Stefan Schuermans authored 12 years ago

51) #ifdef CFG_ETH
52)   while (eth_can_rx()) {
53)     chr = eth_rx();
54) #ifdef CFG_UART
55)   uart_tx(chr);
56) #endif
57)   }
58) #endif
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

59) #ifdef CFG_DELAY
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

61) #endif
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

63) }
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

64) 
65) int main()
66) {
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

67)   unsigned int i;
Stefan Schuermans add UART error check to FW

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

70) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

71)   for (i = 0; i < sizeof(data) / sizeof(data[0]); ++i)
72)     data[i] = i;
73) 
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

74) #ifdef CFG_LCD
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

75)   lcd_init();
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

78) #endif
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

81)   uart_cfg_scale(62); /* 115200 */
82)   uart_cfg_bits(8);
83)   uart_cfg_stop(1);
84)   uart_tx('M');
85)   uart_tx('I');
86)   uart_tx('P');
87)   uart_tx('S');
88)   uart_tx(' ');
89)   uart_tx('I');
90)   uart_tx('\r');
91)   uart_tx('\n');
Stefan Schuermans added FIFO to UART RX

Stefan Schuermans authored 12 years ago

92) #ifdef CFG_UART_CHK
93)   if (uart_rx() != 'M') while(1);
94)   if (uart_rx() != 'I') while(1);
95)   if (uart_rx() != 'P') while(1);
96)   if (uart_rx() != 'S') while(1);
97)   if (uart_rx() != ' ') while(1);
98)   if (uart_rx() != 'I') while(1);
99)   if (uart_rx() != '\r') while(1);
100)   if (uart_rx() != '\n') while(1);
101) #endif
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

107)     if (uart_can_rx()) {
108)       chr = uart_rx();
109)       if (uart_is_err(chr))
110)         leds = 0;
111)       else
112)         leds = chr;
113)     }
Stefan Schuermans UART firmware for testing i...

Stefan Schuermans authored 12 years ago

114) #endif
115)     leds_set_state(leds);
116)     leds = leds << 1 | leds >> 7;
117)     delay();
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

119)