Files
TCP2UART/Drivers/CH390/ch390_runtime.h
T
gaoro-xiao 14a532290d refactor: serialize CH390 runtime SPI access
Move runtime CH390 transactions behind a single ch390_runtime owner so main, lwIP glue, and EXTI no longer compete for SPI access. Keep the system stable under runtime load and capture the remaining CH390 readback failure as a credible low-level device-response issue in the handoff logs.
2026-04-01 03:39:08 +08:00

36 lines
782 B
C

#ifndef __CH390_RUNTIME_H__
#define __CH390_RUNTIME_H__
#include <stdbool.h>
#include <stdint.h>
#include "lwip/err.h"
struct netif;
struct pbuf;
typedef struct {
uint16_t vendor_id;
uint16_t product_id;
uint8_t revision;
uint8_t nsr;
uint8_t ncr;
uint8_t rcr;
uint8_t imr;
uint8_t intcr;
uint8_t gpr;
uint8_t isr;
uint8_t link_up;
uint8_t id_valid;
} ch390_diag_t;
void ch390_runtime_init(struct netif *netif, const uint8_t *mac);
void ch390_runtime_set_irq_pending(void);
void ch390_runtime_poll(struct netif *netif);
void ch390_runtime_check_link(struct netif *netif);
err_t ch390_runtime_output(struct netif *netif, struct pbuf *p);
void ch390_runtime_get_diag(ch390_diag_t *diag);
bool ch390_runtime_is_ready(void);
#endif