45,13 → 45,10 |
|
/* Character device operations interface. */ |
typedef struct { |
/** Suspend pushing characters. */ |
void (* suspend)(struct chardev *); |
/** Resume pushing characters. */ |
void (* resume)(struct chardev *); |
/** Write character to stream. */ |
void (* write)(struct chardev *, char c); |
/** Read character directly from device, assume interrupts disabled. */ |
void (* suspend)(struct chardev *); /**< Suspend pushing characters. */ |
void (* resume)(struct chardev *); /**< Resume pushing characters. */ |
void (* write)(struct chardev *, char c); /**< Write character to stream. */ |
/** Read character directly from device, assume interrupts disabled */ |
char (* read)(struct chardev *); |
} chardev_operations_t; |
|
60,18 → 57,17 |
char *name; |
|
waitq_t wq; |
/** Protects everything below. */ |
SPINLOCK_DECLARE(lock); |
SPINLOCK_DECLARE(lock); /**< Protects everything below. */ |
uint8_t buffer[CHARDEV_BUFLEN]; |
count_t counter; |
/** Implementation of chardev operations. */ |
chardev_operations_t *op; |
chardev_operations_t *op; /**< Implementation of chardev operations. */ |
index_t index; |
void *data; |
} chardev_t; |
|
extern void chardev_initialize(char *name, chardev_t *chardev, |
chardev_operations_t *op); |
extern void chardev_initialize(char *name, |
chardev_t *chardev, |
chardev_operations_t *op); |
extern void chardev_push_character(chardev_t *chardev, uint8_t ch); |
|
#endif /* KERN_CHARDEV_H_ */ |