c2b040193a777c09bdc595c95492b57a2521db87
Stefan Schuermans added file headers

Stefan Schuermans authored 12 years ago

1) /* MIPS I system
2)  * Copyright 2011-2012 Stefan Schuermans <stefan@schuermans.info>
3)  * Copyleft GNU public license V2 or later
4)  *          http://www.gnu.org/copyleft/gpl.html
5)  */
6) 
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

7) #include "arp.h"
Stefan Schuermans added cycle counter peripheral

Stefan Schuermans authored 12 years ago

8) #include "cyc_cnt.h"
Stefan Schuermans added debug output functions

Stefan Schuermans authored 12 years ago

9) #include "debug.h"
Stefan Schuermans implement menu on LCD

Stefan Schuermans authored 12 years ago

10) #include "dhcp.h"
Stefan Schuermans begin of ethernet RX implem...

Stefan Schuermans authored 12 years ago

11) #include "eth.h"
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

12) #include "ip.h"
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

13) #include "leds.h"
Stefan Schuermans implement menu on LCD

Stefan Schuermans authored 12 years ago

14) #include "menu.h"
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

15) #include "uart.h"
16) #include "udp.h"
Stefan Schuermans added "LEDs" I/O peripheral...

Stefan Schuermans authored 12 years ago

17) 
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

18) unsigned char leds_val = 0x88;
Stefan Schuermans send ethernet packet on cen...

Stefan Schuermans authored 12 years ago

19) 
Stefan Schuermans implement menu on LCD

Stefan Schuermans authored 12 years ago

20) void uart_rx_task(void)
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

21) {
22)   unsigned short chr;
23) 
24)   while (uart_can_rx()) {
25)     chr = uart_rx();
Stefan Schuermans improve 200ms tick and task...

Stefan Schuermans authored 12 years ago

26)     if (!uart_is_err(chr))
27)       uart_tx(chr);
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

28)   }
29) }
30) 
Stefan Schuermans implement menu on LCD

Stefan Schuermans authored 12 years ago

31) void eth_rx_task(void)
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

32) {
Stefan Schuermans implemented ethernet TX fir...

Stefan Schuermans authored 12 years ago

33)   void *vptr;
Stefan Schuermans remove unused variable

Stefan Schuermans authored 12 years ago

34)   unsigned int sz;
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

35) 
Stefan Schuermans improve 200ms tick and task...

Stefan Schuermans authored 12 years ago

36)   while (eth_rx(&vptr, &sz))
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

37)     ethernet_recv(vptr, sz);
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

38) }
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

39) 
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

40) void tasks(void)
41) {
Stefan Schuermans implement menu on LCD

Stefan Schuermans authored 12 years ago

42)   uart_rx_task();
43)   eth_rx_task();
44)   menu_task();
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

45) }
46) 
47) void leds_tick200(void)
48) {
49)   leds_val = leds_val << 1 | leds_val >> 7;
50)   leds_set_state(leds_val);
51) }
52) 
53) void tick200(void)
54) {
55)   leds_tick200();
56)   arp_tick200();
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

57)   ip_tick200();
58)   udp_tick200();
Stefan Schuermans implement menu on LCD

Stefan Schuermans authored 12 years ago

59)   dhcp_tick200();
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

60) }
61) 
Stefan Schuermans initial firmware and testbed

Stefan Schuermans authored 12 years ago

62) int main()
63) {
Stefan Schuermans implemented ethernet RX bus...

Stefan Schuermans authored 12 years ago

64)   leds_set_state(0x01);
65) 
Stefan Schuermans added debug output functions

Stefan Schuermans authored 12 years ago

66)   uart_cfg_scale(62); /* 115200 */
67)   uart_cfg_bits(8);
68)   uart_cfg_stop(1);
69)   debug_str("MIPS I\r\n");
Stefan Schuermans implemented ethernet RX bus...

Stefan Schuermans authored 12 years ago

70) 
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

71)   leds_set_state(0x02);
Stefan Schuermans implemented ethernet RX bus...

Stefan Schuermans authored 12 years ago

72) 
Stefan Schuermans added debug output functions

Stefan Schuermans authored 12 years ago

73)   menu_init();
Stefan Schuermans implemented LCD peripheral

Stefan Schuermans authored 12 years ago

74) 
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

75)   leds_set_state(0x04);
Stefan Schuermans implemented ethernet RX bus...

Stefan Schuermans authored 12 years ago

76) 
Stefan Schuermans added debug output functions

Stefan Schuermans authored 12 years ago

77)   eth_mac_init();
78)   eth_rx_init();
79)   eth_tx_init();
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

80) 
81)   leds_set_state(0x08);
82) 
83)   arp_init();
Stefan Schuermans implemented IP + ICMP, fixe...

Stefan Schuermans authored 12 years ago

84)   ip_init();
Stefan Schuermans implemented TX part of UART...

Stefan Schuermans authored 12 years ago

85) 
Stefan Schuermans implemented ethernet RX bus...

Stefan Schuermans authored 12 years ago

86)   leds_set_state(0x10);
87) 
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

88)   while (1) {
Stefan Schuermans added debug output functions

Stefan Schuermans authored 12 years ago

89)     unsigned int start_cyc = cyc_cnt_read();
Stefan Schuermans improve 200ms tick and task...

Stefan Schuermans authored 12 years ago

90)     while (cyc_cnt_read() - start_cyc < 200 * CYC_CNT_MS)
Stefan Schuermans implementation of ethernet...

Stefan Schuermans authored 12 years ago

91)       tasks();
92)     tick200();
Stefan Schuermans slower LED animation for ex...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

94)