BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
6360daf
Branches
Tags
master
mips_sys
fw
main.c
added debug output functions
Stefan Schuermans
commited
6360daf
at 2012-04-05 21:31:40
main.c
Blame
History
Raw
#include "arp.h" #include "cyc_cnt.h" #include "debug.h" #include "dhcp.h" #include "eth.h" #include "ip.h" #include "leds.h" #include "menu.h" #include "uart.h" #include "udp.h" unsigned char leds_val = 0x88; void uart_rx_task(void) { unsigned short chr; while (uart_can_rx()) { chr = uart_rx(); if (!uart_is_err(chr)) uart_tx(chr); } } void eth_rx_task(void) { void *vptr; unsigned int sz; while (eth_rx(&vptr, &sz)) ethernet_recv(vptr, sz); } void tasks(void) { uart_rx_task(); eth_rx_task(); menu_task(); } void leds_tick200(void) { leds_val = leds_val << 1 | leds_val >> 7; leds_set_state(leds_val); } void tick200(void) { leds_tick200(); arp_tick200(); ip_tick200(); udp_tick200(); dhcp_tick200(); } int main() { leds_set_state(0x01); uart_cfg_scale(62); /* 115200 */ uart_cfg_bits(8); uart_cfg_stop(1); debug_str("MIPS I\r\n"); leds_set_state(0x02); menu_init(); leds_set_state(0x04); eth_mac_init(); eth_rx_init(); eth_tx_init(); leds_set_state(0x08); arp_init(); ip_init(); leds_set_state(0x10); while (1) { unsigned int start_cyc = cyc_cnt_read(); while (cyc_cnt_read() - start_cyc < 200 * CYC_CNT_MS) tasks(); tick200(); } return 0; }