2 * Header file for the Linux CAN-bus driver.
3 * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4 * This software is released under the GPL-License.
5 * Version 0.7.1-pi2 15 Nov 2002
7 * added by Pavel Pisa pisa@cmp.felk.cvut.cz
10 #include <linux/autoconf.h>
11 #if defined (CONFIG_MODVERSIONS) && !defined (MODVERSIONS)
15 #if defined (MODVERSIONS)
16 #include <linux/modversions.h>
19 #include <linux/version.h>
20 #include <linux/poll.h>
22 #include "../include/main.h"
23 #include "../include/select.h"
25 unsigned int can_poll(struct file *file, poll_table *wait)
27 unsigned int mask = 0;
29 struct canfifo_t *fifo;
31 /* Initialize hardware pointers */
32 if ( (obj = objects_p[MINOR_NR]) == NULL) {
33 CANMSG("Could not assign buffer structure\n");
36 if ( (fifo = obj->fifo) == NULL) {
37 CANMSG("Could not assign buffer memory.\n");
41 if (file->f_mode & FMODE_WRITE) {
42 poll_wait(file, &fifo->writeq, wait);
44 if (file->f_mode & FMODE_READ) {
45 poll_wait(file, &fifo->readq, wait);
47 if ((file->f_mode & FMODE_READ)&&
48 (fifo->rx_readp != fifo->rx_writep)) {
49 mask |= POLLIN | POLLRDNORM;
51 if ((file->f_mode & FMODE_WRITE)&&
52 (fifo->tx_readp == fifo->tx_writep)) {
53 mask |= POLLOUT | POLLWRNORM;