1PARPORT_REGISTER_DEV(9)      Parallel Port Devices     PARPORT_REGISTER_DEV(9)
2
3
4

NAME

6       parport_register_device - register a device on a parallel port
7

SYNOPSIS

9       struct pardevice * parport_register_device(struct parport * port,
10                                                  const char * name,
11                                                  int (*pf) (void *),
12                                                  void (*kf) (void *),
13                                                  void (*irq_func) (void *),
14                                                  int flags, void * handle);
15

ARGUMENTS

17       port
18           port to which the device is attached
19
20       name
21           a name to refer to the device
22
23       pf
24           preemption callback
25
26       kf
27           kick callback (wake-up)
28
29       irq_func
30           interrupt handler
31
32       flags
33           registration flags
34
35       handle
36           data for callback functions
37

DESCRIPTION

39       This function, called by parallel port device drivers, declares that a
40       device is connected to a port, and tells the system all it needs to
41       know.
42
43       The name is allocated by the caller and must not be deallocated until
44       the caller calls parport_unregister_device for that device.
45
46       The preemption callback function, pf, is called when this device driver
47       has claimed access to the port but another device driver wants to use
48       it. It is given handle as its parameter, and should return zero if it
49       is willing for the system to release the port to another driver on its
50       behalf. If it wants to keep control of the port it should return
51       non-zero, and no action will be taken. It is good manners for the
52       driver to try to release the port at the earliest opportunity after its
53       preemption callback rejects a preemption attempt. Note that if a
54       preemption callback is happy for preemption to go ahead, there is no
55       need to release the port; it is done automatically. This function may
56       not block, as it may be called from interrupt context. If the device
57       driver does not support preemption, pf can be NULL.
58
59       The wake-up (“kick”) callback function, kf, is called when the port is
60       available to be claimed for exclusive access; that is, parport_claim is
61       guaranteed to succeed when called from inside the wake-up callback
62       function. If the driver wants to claim the port it should do so;
63       otherwise, it need not take any action. This function may not block, as
64       it may be called from interrupt context. If the device driver does not
65       want to be explicitly invited to claim the port in this way, kf can be
66       NULL.
67
68       The interrupt handler, irq_func, is called when an interrupt arrives
69       from the parallel port. Note that if a device driver wants to use
70       interrupts it should use parport_enable_irq, and can also check the irq
71       member of the parport structure representing the port.
72
73       The parallel port (lowlevel) driver is the one that has called
74       request_irq and whose interrupt handler is called first. This handler
75       does whatever needs to be done to the hardware to acknowledge the
76       interrupt (for PC-style ports there is nothing special to be done). It
77       then tells the IEEE 1284 code about the interrupt, which may involve
78       reacting to an IEEE 1284 event depending on the current IEEE 1284
79       phase. After this, it calls irq_func. Needless to say, irq_func will be
80       called from interrupt context, and may not block.
81
82       The PARPORT_DEV_EXCL flag is for preventing port sharing, and so should
83       only be used when sharing the port with other device drivers is
84       impossible and would lead to incorrect behaviour. Use it sparingly!
85       Normally, flags will be zero.
86
87       This function returns a pointer to a structure that represents the
88       device on the port, or NULL if there is not enough memory to allocate
89       space for that structure.
90
92Kernel Hackers Manual 3.10         June 2019           PARPORT_REGISTER_DEV(9)
Impressum