FDD-book/examples/part-07/ch29-portability/lab03-backend/portdrv_backend.h
Edson Brandi 6e6dac94fe Add book companion files under examples/
Organize companion code and materials by book part:

  part-01/      Foundations
  part-02/      Kernel & driver fundamentals
  part-03/      Character & block devices
  part-04/      Networking & storage
  part-05/      Buses & advanced topics
  part-06/      Debugging & performance
  part-07/      Real-world drivers
  appendices/   Supplementary material
  README.md     Overview and build instructions
2026-04-25 16:51:00 +00:00

26 lines
822 B
C

/*
* portdrv_backend.h - backend interface for portdrv (Lab 3).
*
* The core dispatches every register access through this interface.
* The Lab 3 driver still lives in a single portdrv.c, so the backend
* instance is defined in that same file. Lab 4 will move each backend
* into its own source file without changing this header.
*/
#ifndef _PORTDRV_BACKEND_H_
#define _PORTDRV_BACKEND_H_
struct portdrv_softc;
struct portdrv_backend {
const char *name; /* "pci", "sim", ... */
int (*attach)(struct portdrv_softc *sc);
void (*detach)(struct portdrv_softc *sc);
uint32_t (*read_reg)(struct portdrv_softc *sc, bus_size_t off);
void (*write_reg)(struct portdrv_softc *sc, bus_size_t off,
uint32_t val);
};
extern const struct portdrv_backend portdrv_pci_backend;
#endif /* !_PORTDRV_BACKEND_H_ */