diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-02-07 15:39:25 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2002-02-07 15:39:25 +0000 |
commit | a0bd71af0d41b17337b362ed9564184a11ae4a54 (patch) | |
tree | 9422e6816a462197e08a5fd3ac6cc5b8b0e0bce0 /wcusb.h | |
parent | 1e707c832ebae8549e40d7bf5ee375a5fa01a053 (diff) |
Version 0.1.6 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@52 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcusb.h')
-rwxr-xr-x | wcusb.h | 119 |
1 files changed, 119 insertions, 0 deletions
@@ -0,0 +1,119 @@ + +#ifndef _WCUSB_H +#define _WCUSB_H + +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/module.h> +#include <linux/usb.h> +#include "zaptel.h" + +#define WC_MAX_IFACES 128 + +#define POWERSAVE_TIME 4000 /* Powersaving timeout for devices with a proslic */ + +/* Various registers and data ports on the tigerjet part */ +#define WCUSB_SPORT0 0x26 +#define WCUSB_SPORT1 0x27 +#define WCUSB_SPORT2 0x28 +#define WCUSB_SPORT_CTRL 0x29 + +#define WC_AUX0 0x1 +#define WC_AUX1 0x2 +#define WC_AUX2 0x4 +#define WC_AUX3 0x8 + +#define CONTROL_TIMEOUT_MS (500) /* msec */ +#define CONTROL_TIMEOUT_JIFFIES ((CONTROL_TIMEOUT_MS * HZ) / 1000) + +#define REQUEST_NORMAL 4 + +#define FLAG_RUNNING (1 << 0) + +/* Important data structures and data types */ + + +/* States for the Proslic read state machine */ +typedef enum { + STATE_WCREAD_WRITEREG, + STATE_WCREAD_READRES, + STATE_WCWRITE_WRITEREG, + STATE_WCWRITE_WRITERES, +} proslic_state_t; + +/* Used for current stream state */ +typedef enum { + STREAM_NORMAL, /* Sends normal (unmodified) audio data */ + STREAM_DTMF, /* (For keypad device) Sends dtmf data */ +} stream_t; + +/* States for the Keypad state machine */ +typedef enum { + STATE_FOR_LOOP_1_OUT, + STATE_FOR_LOOP_2_IN, + STATE_FOR_LOOP_PROC_DATA, + STATE_FOR_LOOP_CLEAR_DIGIT, +} keypad_state_t; + +/* Device types. For radical changes in a new device, use a switch based on the device type */ +typedef enum { + WC_KEYPAD, /* The tigerjet phone with the keypad. That was a bugger to implement */ + WC_PROSLIC, /* For various devices with a proslic */ +} dev_type_t; + +struct wc_keypad_data { + keypad_state_t state; /* Current state in the keypad detect routine */ + urb_t urb; /* urb used for the keypad data transport ... can't remember whether it is used or not */ + int running; + char data; + char data12; + char tmp; + int scanned_event; + int i; + int count; + /* DTMF tone generation stuff for zaptel */ + struct zt_tone_state ts; + struct zt_tone *tone; +}; + +struct stinky_urb { + urb_t urb; + iso_packet_descriptor_t isoframe[1]; +}; + +struct wc_usb_pvt { + struct usb_device *dev; + dev_type_t devclass; + int usecount; + int dead; + struct zt_span span; + struct zt_chan chan; + struct stinky_urb dataread[2]; + struct stinky_urb datawrite[2]; + urb_t control; + devrequest dr; + proslic_state_t controlstate; + int urbcount; + int flags; + int timer; + int lowpowertimer; + int idletxhookstate; + int hookstate; + __u8 newtxhook; + __u8 txhook; + int pos; + unsigned char auxstatus; + unsigned char wcregindex; + unsigned char wcregbuf[4]; + unsigned char wcregval; + short readchunk[ZT_MAX_CHUNKSIZE * 2]; + short writechunk[ZT_MAX_CHUNKSIZE * 2]; + stream_t sample; + void *pvt_data; +}; + +struct wc_usb_desc { + char *name; + int flags; +}; +#endif |