mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
In HEALTH=1 builds health_phase(HEALTH_LLDP) used id 7 while ph_max[] and ph_slow[] had HEALTH_PHASES = 6 entries. The LLDP checkpoint therefore wrote one byte past ph_max (into the high byte of ph_slow[0]) and, when the phase took two ticks or more, incremented two bytes past ph_slow (dhcp_state.state and transaction_id on KP_9000_6XHML_X2). Rename it HEALTH_PH_LLDP = 6, derive HEALTH_PHASES from it so the arrays always cover the last phase, print an lldp line in "health" and document it. Fixes #658
49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
#ifndef _CMD_PARSER_H_
|
|
#define _CMD_PARSER_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "rtl837x_common.h"
|
|
|
|
extern __xdata uint8_t cmd_buffer[CMD_BUF_SIZE];
|
|
extern __bit __at(0x03) cmd_available;
|
|
extern __xdata uint8_t err_status;
|
|
|
|
/* Health instrumentation, built with HEALTH=1. Without it the hooks below
|
|
* compile to nothing and the "health" command does not exist. */
|
|
#ifdef HEALTH
|
|
/* Phase ids, in main-loop order */
|
|
#define HEALTH_PH_LINK 0
|
|
#define HEALTH_PH_SFP 1
|
|
#define HEALTH_PH_RX 2
|
|
#define HEALTH_PH_TX 3
|
|
#define HEALTH_PH_STP 4
|
|
#define HEALTH_PH_CMD 5
|
|
#define HEALTH_PH_LLDP 6
|
|
#define HEALTH_PHASES (HEALTH_PH_LLDP + 1) /* last id + 1: sizes the arrays in cmd_parser.c */
|
|
|
|
extern __xdata uint16_t health_rx_frames;
|
|
#define health_rx_frame() health_rx_frames++
|
|
|
|
void health_loop_start(void) __banked; /* once per idle() pass, resets the phase baseline */
|
|
void health_phase(uint8_t id) __banked; /* after each phase; accounts ticks since last checkpoint */
|
|
void health_stack_paint(void) __banked; /* paint the unused stack area once at boot */
|
|
void health_show(void) __banked; /* "health" CLI dump */
|
|
#else
|
|
#define health_rx_frame()
|
|
#define health_loop_start()
|
|
#define health_phase(id)
|
|
#define health_stack_paint()
|
|
#endif
|
|
|
|
void cmd_tokenize(void) __banked;
|
|
void cmd_parser(void) __banked;
|
|
void execute_config(void) __banked;
|
|
void execute_commands(__xdata uint8_t *p) __banked;
|
|
void print_ip(__xdata uint8_t *ptr) __banked;
|
|
void print_mac(__xdata uint8_t *ptr) __banked;
|
|
void print_sw_version(void) __banked;
|
|
void clear_command_history(void) __banked;
|
|
|
|
#endif
|