rebase first prototype

This commit is contained in:
feelfree69
2026-04-12 12:57:49 +02:00
parent d4d12fe3b4
commit b21bfac917
6 changed files with 156 additions and 4 deletions
+22 -2
View File
@@ -23,6 +23,7 @@
#include "uip/uip_arp.h"
#include "machine.h"
#include "phy.h"
#include "syslog.h"
extern __code const struct machine machine;
extern __xdata uint32_t flash_size;
@@ -33,6 +34,12 @@ void crc16(__xdata uint8_t *v) __naked;
void flash_default_config(void);
void early_boot_handle_button(void);
extern __xdata char logbuf[LOGBUF_SIZE];
extern __xdata uint16_t logptr_w;
extern __xdata uint8_t full_line_available;
extern __xdata uint8_t syslog_enabled;
extern __xdata char char_to_write;
// See setup_serial_timer1() for valid baudrate settings!
#define SERIAL_BAUD_RATE 115200
@@ -185,8 +192,17 @@ void write_char(char c)
}
tx_buf_empty = 0;
SBUF = c;
}
char_to_write = c;
// syslog_write_char(); // why does this gives a linker error?
if (syslog_enabled) {
logbuf[logptr_w++] = c;
logptr_w &= (LOGBUF_SIZE - 1);
if (c == '\n')
full_line_available = 1;
}
}
void itoa(uint8_t v)
{
@@ -1013,7 +1029,7 @@ void handle_rx(void)
if (uip_len) {
tcpip_output();
}
} else if (uip_buf[ETHERTYPE_OFFSET] == 0x08 && uip_buf[ETHERTYPE_OFFSET + 1] == 0x00) { // TCP?
} else if (uip_buf[ETHERTYPE_OFFSET] == 0x08 && uip_buf[ETHERTYPE_OFFSET + 1] == 0x00) { // IP?
if (!management_vlan || management_vlan == rx_packet_vlan) {
uip_arp_ipin(); // Learn MAC addresses in TCP packets
uip_input();
@@ -1311,6 +1327,8 @@ void idle(void)
cmd_parser();
print_string("\n> ");
}
handle_syslog();
}
@@ -2177,6 +2195,7 @@ void main(void)
uip_init();
uip_arp_init();
httpd_init();
syslog_init();
management_vlan = 0; // Disabled
@@ -2203,6 +2222,7 @@ void main(void)
set_sys_led_state(SYS_LED_ON);
cmd_editor_init();
while (1) {
cmd_edit();
idle(); // Enter Idle mode until interrupt occurs