mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
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
25 lines
608 B
C
25 lines
608 B
C
#ifndef OPS_H
|
|
#define OPS_H
|
|
|
|
#include <stdio.h>
|
|
|
|
/* typedefs keep pointer-to-function types readable. */
|
|
typedef int (*ops_init_t)(void);
|
|
typedef void (*ops_start_t)(void);
|
|
typedef void (*ops_stop_t)(void);
|
|
typedef const char *(*ops_status_t)(void);
|
|
|
|
/* A tiny vtable of operations for a device. */
|
|
typedef struct {
|
|
const char *name;
|
|
ops_init_t init;
|
|
ops_start_t start;
|
|
ops_stop_t stop;
|
|
ops_status_t status;
|
|
} dev_ops_t;
|
|
|
|
/* Two concrete implementations declared here, defined in .c files. */
|
|
extern const dev_ops_t console_ops;
|
|
extern const dev_ops_t uart_ops;
|
|
|
|
#endif
|