ju8',ZC /*
tpN]evp| *
Q,[rrG;?@ * Bluetooth driver for the Anycom BlueCard (LSE039/LSE041)
, LCH2r *
OI)&vQ5k * Copyright (C) 2001-2002 Marcel Holtmann <
marcel@holtmann.org>
>:3xi{ *
p=:7 atE *
oA(. vr * This program is free software; you can redistribute it and/or modify
i n[n Aa * it under the terms of the GNU General Public License version 2 as
fs]#/* RR * published by the Free Software Foundation;
=YS!soO *
*O"%tp6 * Software distributed under the License is distributed on an "AS
rU/-Wq`B * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
E#yCcC!wMY * implied. See the License for the specific language governing
nEjo, * rights and limitations under the License.
MAsWds`bpB *
HV]~=Bw2I * The initial developer of the original code is David A. Hinds
7AZ5%o * <
dahinds@users.sourceforge.net>. Portions created by David A. Hinds
k@'?"CP\Xq * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
aRFi0h
\ *
A5 &>!y */
=Bcux8wA#6 eukX#0/^ #include <linux/module.h>
r< d? (H|%?F;{l #include <linux/kernel.h>
fS;m+ D!j@ #include <linux/init.h>
VZ9e~){xA #include <linux/slab.h>
T>AI0R3 #include <linux/types.h>
X m_Ub>N5 #include <linux/sched.h>
DzX6U[= #include <linux/delay.h>
KD[)O7hYC #include <linux/timer.h>
D@/9+]-, #include <linux/errno.h>
7v4-hfN #include <linux/ptrace.h>
>tE,8 #include <linux/ioport.h>
C9"f6>i #include <linux/spinlock.h>
qiwQUm{ #include <linux/moduleparam.h>
YyX^lL_ #include <linux/wait.h>
];YglHH vZ1D3ytfG #include <linux/skbuff.h>
QjW~6Z.tI #include <linux/io.h>
ijR-?nrR Q rrZF. #include <pcmcia/cistpl.h>
8ESkG #include <pcmcia/ciscode.h>
=6"hj,[Q #include <pcmcia/ds.h>
~@a) E+LsF #include <pcmcia/cisreg.h>
;I0yQlx|U g*"J10hyP #include <net/bluetooth/bluetooth.h>
AR[M8RA #include <net/bluetooth/hci_core.h>
^qSf .q'FSEkMJ 0*]<RM v]d?6g /* ======================== Module parameters ======================== */
t&p:vXF2 f6/\JVi)- N?`GZ+5 MODULE_AUTHOR("Marcel Holtmann <
marcel@holtmann.org>");
6w .iEb MODULE_DESCRIPTION("Bluetooth driver for the Anycom BlueCard (LSE039/LSE041)");
2yVGEp^ MODULE_LICENSE("GPL");
Q>+_W2~] :#"OCXr e-T9HM&%P r(/P||`l /* ======================== Local structures ======================== */
pqNoL*
H B=nx8s KlSY^(kHR typedef struct bluecard_info_t {
'DB({s struct pcmcia_device *p_dev;
H]]>sE z<C~DH struct hci_dev *hdev;
rnt$BB[g zfT'!kb,( spinlock_t lock; /* For serializing operations */
EZNB`gO struct timer_list timer; /* For LED control */
n
B|C-.F 4tN~UMw? struct sk_buff_head txq;
BfO}4 unsigned long tx_state;
T=)L5 Vuq< W0C$*oe!_i unsigned long rx_state;
h?O%XnD unsigned long rx_count;
4 9+}OIX struct sk_buff *rx_skb;
t3h \.(mq 4h2bk\z- unsigned char ctrl_reg;
Yv|bUZ@ unsigned long hw_state; /* Status of the hardware and LED control */
9#A{C!75(y } bluecard_info_t;
!&<Wc^PG ZpP6Q TuT= static int bluecard_config(struct pcmcia_device *link);
r;s3(@[,@ static void bluecard_release(struct pcmcia_device *link);
(4/`@;[ -1Ki7|0, static void bluecard_detach(struct pcmcia_device *p_dev);
.cnw?EI _a02# L?pvz} /* Default baud rate: 57600, 115200, 230400 or 460800 */
ckkM)|kK #define DEFAULT_BAUD_RATE 230400
Lw78v@dY =I*ZOE3n tLGwF3e$A /* Hardware states */
n$VPh/ #define CARD_READY 1
Nl>b'G96 #define CARD_HAS_PCCARD_ID 4
-
&LZle&M #define CARD_HAS_POWER_LED 5
)fcpE,g' #define CARD_HAS_ACTIVITY_LED 6
|kRx[UL ny;)+v?mN\ /* Transmit states */
SF}L3/C&h #define XMIT_SENDING 1
[ZpG+VAJ8 #define XMIT_WAKEUP 2
t`/RcAwA #define XMIT_BUFFER_NUMBER 5 /* unset = buffer one, set = buffer two */
w[7HY@[ #define XMIT_BUF_ONE_READY 6
!N2 n@bo #define XMIT_BUF_TWO_READY 7
pPqbD}p #define XMIT_SENDING_READY 8
vnT
Vam8NnZ|r /* Receiver states */
E~U|v'GCd #define RECV_WAIT_PACKET_TYPE 0
eFI9S.6 #define RECV_WAIT_EVENT_HEADER 1
k-p7Y@`+a #define RECV_WAIT_ACL_HEADER 2
/VOST^z! #define RECV_WAIT_SCO_HEADER 3
$+yQ48Wq #define RECV_WAIT_DATA 4
h3ZL0Fi* +(hwe
jyC /* Special packet types */
8YkH #define PKT_BAUD_RATE_57600 0x80
q+=@kXs>+ #define PKT_BAUD_RATE_115200 0x81
I.0Usa"z #define PKT_BAUD_RATE_230400 0x82
e(5Px!B #define PKT_BAUD_RATE_460800 0x83
3B]+]e~ LGue=Hkp )HiTYV)]' /* These are the register offsets */
-|UX}t* #define REG_COMMAND 0x20
[UrS%]OSR #define REG_INTERRUPT 0x21
:'Kx?Es #define REG_CONTROL 0x22
UmMYe4LQR #define REG_RX_CONTROL 0x24
)Syf5I #define REG_CARD_RESET 0x30
"U~@o4u; #define REG_LED_CTRL 0x30
8&iI+\lCy &dMSX}t /* REG_COMMAND */
n/|`Dz. #define REG_COMMAND_TX_BUF_ONE 0x01
6aK2{-+ #define REG_COMMAND_TX_BUF_TWO 0x02