Add support for command history

This adds a command history, both for the CLI as well as for
commands sent by the web-interface. They are written to a ring buffer
in order to work safely with a relatively small amount of RAM
The buffer is used to read the current in-RAM configuration
from the switch by the web-interface. It could also be used
to implement cmd history via cursor up/down in the CLI.
This commit is contained in:
logicog
2025-11-29 12:44:23 +01:00
parent 9d4ba57cd0
commit 4d915a0d80
2 changed files with 60 additions and 12 deletions
+10 -1
View File
@@ -47,6 +47,15 @@
#define IS_SFP(port) (i == maxPort || i == 3)
#endif
#define CONFIG_START 0x70000
#define CONFIG_LEN 0x1000
#define CODE0_SIZE 0x4000
#define CODE_BANK_SIZE 0xc000
// Constants for the circular command buffer, the size must be 2^n
#define CMD_HISTORY_SIZE 0x400
#define CMD_HISTORY_MASK (CMD_HISTORY_SIZE - 1)
/**
* Representation of a 48-bit Ethernet address.
*/
@@ -94,6 +103,6 @@ uint16_t strlen_x(register __xdata const char *s);
uint16_t strtox(register __xdata uint8_t *dst, register __code const char *s);
void tcpip_output(void);
void print_string_x(__xdata char *p);
uint8_t read_flash(uint8_t bank, __code uint8_t *addr);
#endif