K2J\awX /*
>U%gctIg *
&ge "x{,? * Bluetooth driver for the Anycom BlueCard (LSE039/LSE041)
MBqt&_?K *
C!fMW+C@ * Copyright (C) 2001-2002 Marcel Holtmann <
marcel@holtmann.org>
Ib+Y~
XYR *
n
p\TlUc *
P@9t;dZN * This program is free software; you can redistribute it and/or modify
T`5bZu^c * it under the terms of the GNU General Public License version 2 as
Y?(r3E^x * published by the Free Software Foundation;
nv@8tdrc *
fSs4ZXC * Software distributed under the License is distributed on an "AS
)i!o8YB * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
O"F_* * implied. See the License for the specific language governing
mg*qiScfW * rights and limitations under the License.
w+1|9Y *
bdQ_?S( * The initial developer of the original code is David A. Hinds
I?ae\X@M * <
dahinds@users.sourceforge.net>. Portions created by David A. Hinds
NiU2@zgl * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
T>R0T{A *
t.`@{R$hoA */
kw"SwdP5 .ys6"V|31 #include <linux/module.h>
<N_+=_ 8]M_z:F7F #include <linux/kernel.h>
b\-&sM(W" #include <linux/init.h>
wnM9('\ #include <linux/slab.h>
=jX8.K4] #include <linux/types.h>
"CUty"R8 #include <linux/sched.h>
>rJnayLF #include <linux/delay.h>
E#ul IgD #include <linux/timer.h>
w8Sp<6* #include <linux/errno.h>
n&-qaoNl #include <linux/ptrace.h>
Q4f/Z #include <linux/ioport.h>
J|w\@inQ #include <linux/spinlock.h>
YwZ
Z{+n #include <linux/moduleparam.h>
,!7 H]4Qx #include <linux/wait.h>
2\7`/,U6 W!?7D0q #include <linux/skbuff.h>
^xij{W`| #include <linux/io.h>
A7%:05 v(EEG/~ #include <pcmcia/cistpl.h>
m6',SY9T #include <pcmcia/ciscode.h>
-5I2ga #include <pcmcia/ds.h>
{
T-'t/0e( #include <pcmcia/cisreg.h>
*
v75O7l \hM|(*DL #include <net/bluetooth/bluetooth.h>
)FpZPdN+h #include <net/bluetooth/hci_core.h>
0IfKJ*]M 0o9 3iu=& ; =X P & oE(7v7iY /* ======================== Module parameters ======================== */
dVsE^jsL >|twyb U` Wauv& MODULE_AUTHOR("Marcel Holtmann <
marcel@holtmann.org>");
UmQ?rS8d MODULE_DESCRIPTION("Bluetooth driver for the Anycom BlueCard (LSE039/LSE041)");
)e a :Q? MODULE_LICENSE("GPL");
K9OYri^TQ ^sVX)% _c,'>aH= 8AnP7}n;?' /* ======================== Local structures ======================== */
~fT_8z !-,t'GF( + j W1V}h typedef struct bluecard_info_t {
uwjGDw struct pcmcia_device *p_dev;
zJ)*Z,7 {6~l$ struct hci_dev *hdev;
%5A+V0D0' j&
<i& spinlock_t lock; /* For serializing operations */
S6AU[ASY. struct timer_list timer; /* For LED control */
aEWWFN US%^#D q struct sk_buff_head txq;
FxVZ[R unsigned long tx_state;
t| 'N+-T3 yq NzdzX unsigned long rx_state;
U
)l,'y2 unsigned long rx_count;
opJMS6%r struct sk_buff *rx_skb;
y^}6!>Ou: 4=Krq6{ unsigned char ctrl_reg;
])Qs {hs~s unsigned long hw_state; /* Status of the hardware and LED control */
QNxl/y\l0 } bluecard_info_t;
d\ ~QBr? W~p/,H cM 4y5UkU9| static int bluecard_config(struct pcmcia_device *link);
ijdXU8 static void bluecard_release(struct pcmcia_device *link);
&bp=`=* 61jI static void bluecard_detach(struct pcmcia_device *p_dev);
^pe{b9c Hx\H $Y ~I799Xi /* Default baud rate: 57600, 115200, 230400 or 460800 */
e&qh9mlE #define DEFAULT_BAUD_RATE 230400
Vw&HVo D*YM[sN` |)K]U /* Hardware states */
(>I`{9x>6 #define CARD_READY 1
E4W zU #define CARD_HAS_PCCARD_ID 4
X0M1(BJgGo #define CARD_HAS_POWER_LED 5
BYo/57&: #define CARD_HAS_ACTIVITY_LED 6
d GFGr}&s *L'>U[Pl7 /* Transmit states */
/M*a,o #define XMIT_SENDING 1
ZU9c 5/J #define XMIT_WAKEUP 2
SY^dWLf #define XMIT_BUFFER_NUMBER 5 /* unset = buffer one, set = buffer two */
f4guz #define XMIT_BUF_ONE_READY 6
sPb=82~z #define XMIT_BUF_TWO_READY 7
QtJg^2@ #define XMIT_SENDING_READY 8
^=^z1M2P 4|`Bq}sjZf /* Receiver states */
K&U7H: #define RECV_WAIT_PACKET_TYPE 0
eU N"w,@y #define RECV_WAIT_EVENT_HEADER 1
3:f[gV9K #define RECV_WAIT_ACL_HEADER 2
}oKG}wgY #define RECV_WAIT_SCO_HEADER 3
{|yob4N #define RECV_WAIT_DATA 4
~35U]s@v n]u<!.X /* Special packet types */
!E-Pa5s #define PKT_BAUD_RATE_57600 0x80
]+m/;&0 #define PKT_BAUD_RATE_115200 0x81
WwUv5GZTW #define PKT_BAUD_RATE_230400 0x82
ocyb5j #define PKT_BAUD_RATE_460800 0x83
UEzb^(8> Kmdlf,[3d jh.@- /* These are the register offsets */
!Y:0c#MPH #define REG_COMMAND 0x20
wprX!)w<i #define REG_INTERRUPT 0x21
TcGoSj<Z #define REG_CONTROL 0x22
xGG,2W+z #define REG_RX_CONTROL 0x24
4#'("#R #define REG_CARD_RESET 0x30
5&e<#" #define REG_LED_CTRL 0x30
7oR:1DXw| iK IOh('G /* REG_COMMAND */
1<h>B: #define REG_COMMAND_TX_BUF_ONE 0x01
BkZV!Eg #define REG_COMMAND_TX_BUF_TWO 0x02