/**
 * @file ethernetif.h
 * @brief CH390 Ethernet interface for lwIP NO_SYS mode.
 */

#ifndef __ETHERNETIF_H__
#define __ETHERNETIF_H__

#include "lwip/err.h"
#include "lwip/netif.h"
#include "ch390_runtime.h"

struct ethernetif {
    uint16_t rx_len;
    uint8_t rx_status;
};

extern struct netif ch390_netif;

err_t ethernetif_init(struct netif *netif);
void ethernetif_input(struct netif *netif);
void lwip_netif_init(const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw);
void ethernetif_check_link(void);
void ethernetif_poll(void);
void ethernetif_set_irq_pending(void);
uint8_t ethernetif_is_irq_pending(void);

#endif
