patch-2.3.24 linux/include/net/irda/irda_device.h
Next file: linux/include/net/irda/iriap.h
Previous file: linux/include/net/irda/irda.h
Back to the patch index
Back to the overall index
- Lines: 268
- Date:
Wed Oct 27 16:17:04 1999
- Orig file:
v2.3.23/linux/include/net/irda/irda_device.h
- Orig date:
Mon Oct 4 15:49:30 1999
diff -u --recursive --new-file v2.3.23/linux/include/net/irda/irda_device.h linux/include/net/irda/irda_device.h
@@ -1,17 +1,16 @@
/*********************************************************************
*
* Filename: irda_device.h
- * Version:
- * Description:
+ * Version: 0.9
+ * Description: Contains various declarations used by the drivers
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Apr 14 12:41:42 1998
- * Modified at: Mon Sep 20 11:21:31 1999
+ * Modified at: Tue Oct 19 20:00:03 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
* Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
- * Copyright (c) 1998 Haris Zukanovic, <haris@stud.cs.uit.no>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -36,18 +35,13 @@
#include <linux/tty.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
+#include <linux/irda.h>
#include <net/irda/irda.h>
#include <net/irda/qos.h>
-#include <net/irda/dongle.h>
#include <net/irda/irqueue.h>
#include <net/irda/irlap_frame.h>
-/* Some private IOCTL's */
-#define SIOCSDONGLE (SIOCDEVPRIVATE + 0)
-#define SIOCSBANDWIDTH (SIOCDEVPRIVATE + 1)
-#define SIOCSMEDIABUSY (SIOCDEVPRIVATE + 2)
-
/* Some non-standard interface flags (should not conflict with any in if.h) */
#define IFF_SIR 0x0001 /* Supports SIR speeds */
#define IFF_MIR 0x0002 /* Supports MIR speeds */
@@ -57,14 +51,74 @@
#define IFF_DMA 0x0020 /* Supports DMA transfer of data */
#define IFF_SHM 0x0040 /* Supports shared memory data transfers */
#define IFF_DONGLE 0x0080 /* Interface has a dongle attached */
-#define IFF_AIR 0x0100 /* Supports A(dvanced)IR standards */
+#define IFF_AIR 0x0100 /* Supports Advanced IR (AIR) standards */
#define IO_XMIT 0x01
#define IO_RECV 0x02
-struct dongle_q {
- QUEUE q;
- struct dongle *dongle;
+typedef enum {
+ IRDA_IRLAP, /* IrDA mode, and deliver to IrLAP */
+ IRDA_RAW, /* IrDA mode */
+ SHARP_ASK,
+ TV_REMOTE, /* Also known as Consumer Electronics IR */
+} INFRARED_MODE;
+
+typedef enum {
+ IRDA_TASK_INIT, /* All tasks are initialized with this state */
+ IRDA_TASK_DONE, /* Signals that the task is finished */
+ IRDA_TASK_WAIT,
+ IRDA_TASK_WAIT1,
+ IRDA_TASK_WAIT2,
+ IRDA_TASK_WAIT3,
+ IRDA_TASK_CHILD_INIT, /* Initializing child task */
+ IRDA_TASK_CHILD_WAIT, /* Waiting for child task to finish */
+ IRDA_TASK_CHILD_DONE /* Child task is finished */
+} TASK_STATE;
+
+struct irda_task;
+typedef int (*TASK_CALLBACK) (struct irda_task *task);
+
+struct irda_task {
+ queue_t q;
+ magic_t magic;
+
+ TASK_STATE state;
+ TASK_CALLBACK function;
+ TASK_CALLBACK finished;
+
+ /* struct net_device *dev; */
+ struct irda_task *parent;
+ struct timer_list timer;
+
+ void *instance; /* Instance being called */
+ void *param; /* Parameter to be used by instance */
+};
+
+/* Dongle info */
+struct dongle_reg;
+typedef struct {
+ struct dongle_reg *issue; /* Registration info */
+ struct net_device *dev; /* Device we are attached to */
+ __u32 speed; /* Current speed */
+
+ int busy;
+
+ /* Callbacks to the IrDA device driver */
+ int (*set_mode)(struct net_device *, int mode);
+ int (*read)(struct net_device *dev, __u8 *buf, int len);
+ int (*write)(struct net_device *dev, __u8 *buf, int len);
+ int (*set_dtr_rts)(struct net_device *dev, int dtr, int rts);
+} dongle_t;
+
+/* Dongle registration info */
+struct dongle_reg {
+ queue_t q; /* Must be first */
+ IRDA_DONGLE type;
+
+ void (*open)(dongle_t *dongle, struct qos_info *qos);
+ void (*close)(dongle_t *dongle);
+ int (*reset)(struct irda_task *task);
+ int (*change_speed)(struct irda_task *task);
};
/* Chip specific info */
@@ -79,7 +133,7 @@
int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */
int direction; /* Link direction, used by some FIR drivers */
- __u32 baudrate; /* Currently used baudrate */
+ __u32 speed; /* Currently used speed */
int dongle_id; /* Dongle or transceiver currently used */
};
@@ -95,87 +149,38 @@
int len; /* length of data */
int truesize; /* total size of buffer */
__u16 fcs;
-
- int flags; /* Allocation flags (GFP_KERNEL | GFP_DMA ) */
};
-/*
- * This structure contains data that _we_ would have liked to be in the device
- * structure, but we don't want to mess it up more than it is already. Better
- * to keep the data in separate structures! This structure abstracts common
- * stuff from IrDA port implementations.
- */
-struct irda_device {
- QUEUE q; /* Must be first */
- magic_t magic; /* Our magic bullet */
-
- char name[16]; /* Name of device "irda0" */
- char description[32]; /* Something like "irda0 <-> ttyS0" */
-
- struct irlap_cb *irlap; /* The link layer we are connected to */
- struct net_device netdev; /* Yes! we are some kind of netdevice */
- struct enet_statistics stats;
-
- __u32 flags; /* Interface flags (see defs above) */
-
- void *priv; /* Pointer to low level implementation */
-
- struct qos_info qos; /* QoS capabilities for this device */
-
- struct chipio_t io;
- struct iobuff_t tx_buff;
- struct iobuff_t rx_buff;
-
- struct dongle *dongle; /* Dongle driver */
-
- spinlock_t lock; /* For serializing operations */
-
- /* Media busy stuff */
- int media_busy;
- struct timer_list media_busy_timer;
-
- int raw_mode;
-
- /* Callbacks to driver specific implementations */
- void (*change_speed)(struct irda_device *idev, __u32 speed);
- int (*is_receiving)(struct irda_device *); /* receiving? */
- void (*set_dtr_rts)(struct irda_device *idev, int dtr, int rts);
- void (*set_raw_mode)(struct irda_device *dev, int mode);
- int (*raw_write)(struct irda_device *idev, __u8 *buf, int len);
- int (*raw_read)(struct irda_device *idev, __u8 *buf, int len,
- int timeout);
- void (*wait_until_sent)(struct irda_device *);
- void (*set_caddr)(struct irda_device *); /* Set connection addr */
-};
-
-extern hashbin_t *irda_device;
-
/* Function prototypes */
int irda_device_init(void);
void irda_device_cleanup(void);
-int irda_device_open(struct irda_device *, char *name, void *priv);
-void irda_device_close(struct irda_device *);
-
/* Interface to be uses by IrLAP */
void irda_device_set_media_busy(struct net_device *dev, int status);
int irda_device_is_media_busy(struct net_device *dev);
int irda_device_is_receiving(struct net_device *dev);
-struct qos_info *irda_device_get_qos(struct net_device *dev);
/* Interface for internal use */
-void irda_device_change_speed(struct irda_device *, int);
-int irda_device_txqueue_empty(struct irda_device *self);
-void irda_device_init_dongle(struct irda_device *self, int type);
-void irda_device_unregister_dongle(struct dongle *dongle);
-int irda_device_register_dongle(struct dongle *dongle);
-int irda_device_set_raw_mode(struct irda_device* self, int status);
+int irda_device_txqueue_empty(struct net_device *dev);
+int irda_device_set_raw_mode(struct net_device* self, int status);
+int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts);
int irda_device_setup(struct net_device *dev);
+/* Dongle interface */
+void irda_device_unregister_dongle(struct dongle_reg *dongle);
+int irda_device_register_dongle(struct dongle_reg *dongle);
+dongle_t *irda_device_dongle_init(struct net_device *dev, int type);
+int irda_device_dongle_cleanup(dongle_t *dongle);
+
void setup_dma(int channel, char *buffer, int count, int mode);
-int irda_device_net_open(struct net_device *dev);
-int irda_device_net_close(struct net_device *dev);
+int irda_task_kick(struct irda_task *task);
+int irda_task_execute(void *instance, TASK_CALLBACK function,
+ TASK_CALLBACK finished, struct irda_task *parent,
+ void *param);
+void irda_task_next_state(struct irda_task *task, TASK_STATE state);
+
+extern const char *infrared_mode[];
/*
* Function irda_get_mtt (skb)
@@ -197,21 +202,22 @@
return mtt;
}
-extern inline void irda_device_set_dtr_rts(struct irda_device *self, int dtr,
- int rts)
+/*
+ * Function irda_get_speed (skb)
+ *
+ * Extact the speed this frame should be sent out with from the skb
+ *
+ */
+extern inline __u32 irda_get_speed(struct sk_buff *skb)
{
- if (self->set_dtr_rts)
- self->set_dtr_rts(self, dtr, rts);
-}
+ __u32 speed;
-extern inline int irda_device_raw_write(struct irda_device *self, __u8 *buf,
- int len)
-{
- int ret = -1;
+ if (((struct irda_skb_cb *)(skb->cb))->magic != LAP_MAGIC)
+ speed = 9600;
+ else
+ speed = ((struct irda_skb_cb *)(skb->cb))->speed;
- if (self->raw_write)
- ret = self->raw_write(self, buf, len);
- return ret;
+ return speed;
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)