Record networking and DMA development progress

Add the current OS source tree, build scripts, system image layout, and development notes covering DMA page allocation, e1000 bring-up, net API dispatch, and DHCP work in progress.
This commit is contained in:
xyou
2026-07-02 16:17:09 +08:00
parent fbc14631e3
commit f1a2a110d7
182 changed files with 16472 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
#ifndef UTSM_NET_H
#define UTSM_NET_H
#include <utsm/types.h>
#define DKM_NET_MAX_DEVICES 8u
/* 网卡链路/能力标志。 */
#define DKM_NET_F_LINK_UP (1u << 0)
#define DKM_NET_F_TX_READY (1u << 1)
#define DKM_NET_F_RX_READY (1u << 2)
typedef int (*dkm_net_tx_fn)(void *ctx, const void *packet, u32 length);
typedef int (*dkm_net_rx_poll_fn)(void *ctx, void *buffer, u32 capacity, u32 *out_length);
typedef struct dkm_net_device_desc {
const char *name;
u8 mac[6];
u32 flags;
void *ctx;
dkm_net_tx_fn tx;
dkm_net_rx_poll_fn rx_poll;
} dkm_net_device_desc;
typedef struct dkm_net_device_info {
const char *name;
u8 mac[6];
u32 flags;
} dkm_net_device_info;
typedef struct dkm_net_api {
int (*register_device)(const dkm_net_device_desc *desc);
u32 (*device_count)(void);
int (*device_info)(u32 index, dkm_net_device_info *out);
int (*tx)(u32 index, const void *packet, u32 length);
int (*rx_poll)(u32 index, void *buffer, u32 capacity, u32 *out_length);
} dkm_net_api;
void net_init(void);
const dkm_net_api *net_get_api(void);
#endif