Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / minix / chardriver.h @ 14

History | View | Annotate | Download (1.47 KB)

1
#ifndef _MINIX_CHARDRIVER_H
2
#define _MINIX_CHARDRIVER_H
3

    
4
#include <minix/driver.h>
5

    
6
typedef unsigned int cdev_id_t;
7

    
8
/* Entry points into the device dependent code of character drivers. */
9
struct chardriver {
10
  int (*cdr_open)(devminor_t minor, int access, endpoint_t user_endpt);
11
  int (*cdr_close)(devminor_t minor);
12
  ssize_t (*cdr_read)(devminor_t minor, u64_t position, endpoint_t endpt,
13
        cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
14
  ssize_t (*cdr_write)(devminor_t minor, u64_t position, endpoint_t endpt,
15
        cp_grant_id_t grant, size_t size, int flags, cdev_id_t id);
16
  int (*cdr_ioctl)(devminor_t minor, unsigned long request, endpoint_t endpt,
17
        cp_grant_id_t grant, int flags, endpoint_t user_endpt, cdev_id_t id);
18
  int (*cdr_cancel)(devminor_t minor, endpoint_t endpt, cdev_id_t id);
19
  int (*cdr_select)(devminor_t minor, unsigned int ops, endpoint_t endpt);
20
  void (*cdr_intr)(unsigned int mask);
21
  void (*cdr_alarm)(clock_t stamp);
22
  void (*cdr_other)(message *m_ptr, int ipc_status);
23
};
24

    
25
/* Functions defined by libchardriver. */
26
void chardriver_announce(void);
27
int chardriver_get_minor(const message *m, devminor_t *minor);
28
void chardriver_process(const struct chardriver *cdp, message *m_ptr,
29
        int ipc_status);
30
void chardriver_terminate(void);
31
void chardriver_task(const struct chardriver *cdp);
32

    
33
void chardriver_reply_task(endpoint_t endpt, cdev_id_t id, int r);
34
void chardriver_reply_select(endpoint_t endpt, devminor_t minor, int ops);
35

    
36
#endif /* _MINIX_CHARDRIVER_H */