mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2025-10-14 05:35:06 -07:00
adding a NE2000 compatible network driver and updated README.md
This commit is contained in:
41
src/drivers/network/ne2000.c
Normal file
41
src/drivers/network/ne2000.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <stdint.h>
|
||||
|
||||
// NE2000 registers
|
||||
#define NE2000_COMMAND 0x00
|
||||
#define NE2000_PSTART 0x01
|
||||
#define NE2000_PSTOP 0x02
|
||||
// ... more registers ...
|
||||
|
||||
// NE2000 commands
|
||||
#define NE2000_CMD_START 0x02
|
||||
#define NE2000_CMD_STOP 0x01
|
||||
// ... more commands ...
|
||||
|
||||
// Write a value to a NE2000 register
|
||||
void ne2000_write_reg(uint16_t base_addr, uint8_t reg, uint8_t value) {
|
||||
// Write to the register
|
||||
// This will depend on your specific hardware interface
|
||||
}
|
||||
|
||||
// Read a value from a NE2000 register
|
||||
uint8_t ne2000_read_reg(uint16_t base_addr, uint8_t reg) {
|
||||
// Read from the register
|
||||
// This will depend on your specific hardware interface
|
||||
}
|
||||
|
||||
// Initialize the NE2000 card
|
||||
void ne2000_init(uint16_t base_addr) {
|
||||
// Stop the NE2000 card
|
||||
ne2000_write_reg(base_addr, NE2000_COMMAND, NE2000_CMD_STOP);
|
||||
|
||||
// Set up the packet buffer
|
||||
ne2000_write_reg(base_addr, NE2000_PSTART, 0x40);
|
||||
ne2000_write_reg(base_addr, NE2000_PSTOP, 0x80);
|
||||
|
||||
// ... more initialization ...
|
||||
|
||||
// Start the NE2000 card
|
||||
ne2000_write_reg(base_addr, NE2000_COMMAND, NE2000_CMD_START);
|
||||
}
|
||||
|
||||
// ... more driver functions ..
|
23
src/drivers/network/ne2000.h
Normal file
23
src/drivers/network/ne2000.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef NE2000_H
|
||||
#define NE2000_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// NE2000 registers
|
||||
#define NE2000_COMMAND 0x00
|
||||
#define NE2000_PSTART 0x01
|
||||
#define NE2000_PSTOP 0x02
|
||||
// ... more registers ...
|
||||
|
||||
// NE2000 commands
|
||||
#define NE2000_CMD_START 0x02
|
||||
#define NE2000_CMD_STOP 0x01
|
||||
// ... more commands ...
|
||||
|
||||
// Function prototypes
|
||||
void ne2000_write_reg(uint16_t base_addr, uint8_t reg, uint8_t value);
|
||||
uint8_t ne2000_read_reg(uint16_t base_addr, uint8_t reg);
|
||||
void ne2000_init(uint16_t base_addr);
|
||||
// ... more function prototypes ...
|
||||
|
||||
#endif // NE2000_H
|
Reference in New Issue
Block a user