feat: 保存已验证的CH390网络打通基线

This commit is contained in:
2026-04-17 07:09:55 +08:00
parent 59eecf428f
commit 6aba77df9a
44 changed files with 6428 additions and 3372 deletions
+54
View File
@@ -359,6 +359,19 @@ enum ch390_phy_mode
#define CH390_PKT_MAX 1536 /* Received packet max size */
#define CH390_PKT_MIN 64
struct ch390_runtime_status
{
uint8_t int_status;
uint8_t nsr;
uint8_t bcastcr;
uint8_t mar7;
uint8_t mrcmdx;
uint8_t mrcmdx1;
uint8_t mrrl;
uint8_t mrrh;
uint8_t link_up;
};
/********************************************************************
* Functions
*/
@@ -620,4 +633,45 @@ void ch390_int_pin_config(uint8_t type, uint8_t pol);
*/
uint8_t ch390_get_int_status(void);
/**
* @name ch390_runtime_poll
* @brief Poll runtime state, sample diagnostic registers, and clear ISR flags.
* @param status - Output runtime status snapshot
* @return Interrupt status snapshot
*/
uint8_t ch390_runtime_poll(struct ch390_runtime_status *status);
/**
* @name ch390_runtime_link_up_from_status
* @brief Get link state from a runtime status snapshot
* @param status - Runtime status snapshot
* @return 0: Link down 1: Link up
*/
int ch390_runtime_link_up_from_status(const struct ch390_runtime_status *status);
/**
* @name ch390_probe_rx_header
* @brief Diagnostic helper: read 4-byte RX header directly from RX SRAM.
* Caller must restore MRR if a non-destructive probe is required.
* @param head - Output buffer with at least 4 bytes.
*/
void ch390_probe_rx_header(uint8_t *head);
/**
* @name ch390_runtime_receive_packet
* @brief Runtime RX entry point for packet receive
* @param buff - Size equal to CH390_PKT_MAX
* @param rx_status - Output abnormal status while receiving packet
* @return Packet length
*/
uint32_t ch390_runtime_receive_packet(uint8_t *buff, uint8_t *rx_status);
/**
* @name ch390_runtime_send_packet
* @brief Runtime TX entry point for packet transmit
* @param buff - Data to be sent
* @param length - Less than 3k bytes.
*/
void ch390_runtime_send_packet(uint8_t *buff, uint16_t length);
#endif /* __CH390_H */