24e5d842d5bbe7de2650c872adf41f2c0b2cdb0d
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
10) 
Stefan Schuermans implemented loading of data...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

19) #ifdef CFG_LCD
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

39) #endif
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

40) }
41) 
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

43) {
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

47) #ifdef CFG_DELAY
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

49) #endif
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

51) }
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

60) #ifdef CFG_LCD
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

61)   lcd_init();
Stefan Schuermans implemented switches

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

64) #endif
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

67)   uart_cfg_scale(62); /* 115200 */
68)   uart_cfg_bits(8);
69)   uart_cfg_stop(1);
70)   uart_tx('M');
71)   uart_tx('I');
72)   uart_tx('P');
73)   uart_tx('S');
74)   uart_tx(' ');
75)   uart_tx('I');
76)   uart_tx('\r');
77)   uart_tx('\n');
Stefan Schuermans implemented RX part of UART...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

80)   while (1) {
81)     for (i = 0x1; i < 0x80; i <<= 1) {
82)       leds_set_state(i);
83)       delay();
84)     }
85)     for (i = 0x80; i > 0x1; i >>= 1) {
86)       leds_set_state(i);
87)       delay();
88)     }
89)   }
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

90)