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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

58) 
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

62) #ifdef CFG_LCD
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

63)   lcd_init();
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

66) #endif
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

94) #ifdef CFG_UART
95)     if (uart_can_rx())
96)       leds = uart_rx();
97) #endif
98)     leds_set_state(leds);
99)     leds = leds << 1 | leds >> 7;
100)     delay();
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

102)