diff options
author | Pavan Savoy <pavan_savoy@ti.com> | 2010-04-08 14:16:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-11 14:35:55 -0400 |
commit | 53618cc1e51e1f406a467eca9d1dd2675f3ad88e (patch) | |
tree | b7aea16b21309ccd51bc4ee14a2a5ca9b781291c /drivers/staging/ti-st/st_core.h | |
parent | fb2a8c88bf87b47169218f15ab21f1c089f7fe17 (diff) |
Staging: sources for ST core
Texas Instruments BT, FM and GPS combo chips/drivers
make use of a single TTY to communicate with the chip.
This module constitutes the core logic, TTY ldisc driver
and the exported symbols for registering/unregistering of
the protocol drivers such as BT/FM/GPS.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/ti-st/st_core.h')
-rw-r--r-- | drivers/staging/ti-st/st_core.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/drivers/staging/ti-st/st_core.h b/drivers/staging/ti-st/st_core.h new file mode 100644 index 00000000000..f271c88a808 --- /dev/null +++ b/drivers/staging/ti-st/st_core.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * Shared Transport Core header file | ||
3 | * | ||
4 | * Copyright (C) 2009 Texas Instruments | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | #ifndef ST_CORE_H | ||
22 | #define ST_CORE_H | ||
23 | |||
24 | #include <linux/skbuff.h> | ||
25 | #include "st.h" | ||
26 | |||
27 | /* states of protocol list */ | ||
28 | #define ST_NOTEMPTY 1 | ||
29 | #define ST_EMPTY 0 | ||
30 | |||
31 | /* | ||
32 | * possible st_states | ||
33 | */ | ||
34 | #define ST_INITIALIZING 1 | ||
35 | #define ST_REG_IN_PROGRESS 2 | ||
36 | #define ST_REG_PENDING 3 | ||
37 | #define ST_WAITING_FOR_RESP 4 | ||
38 | |||
39 | /* | ||
40 | * local data required for ST/KIM/ST-HCI-LL | ||
41 | */ | ||
42 | struct st_data_s { | ||
43 | unsigned long st_state; | ||
44 | /* | ||
45 | * an instance of tty_struct & ldisc ops to move around | ||
46 | */ | ||
47 | struct tty_struct *tty; | ||
48 | struct tty_ldisc_ops *ldisc_ops; | ||
49 | /* | ||
50 | * the tx skb - | ||
51 | * if the skb is already dequeued and the tty failed to write the same | ||
52 | * maintain the skb to write in the next transaction | ||
53 | */ | ||
54 | struct sk_buff *tx_skb; | ||
55 | #define ST_TX_SENDING 1 | ||
56 | #define ST_TX_WAKEUP 2 | ||
57 | unsigned long tx_state; | ||
58 | /* | ||
59 | * list of protocol registered | ||
60 | */ | ||
61 | struct st_proto_s *list[ST_MAX]; | ||
62 | /* | ||
63 | * lock | ||
64 | */ | ||
65 | unsigned long rx_state; | ||
66 | unsigned long rx_count; | ||
67 | struct sk_buff *rx_skb; | ||
68 | struct sk_buff_head txq, tx_waitq; | ||
69 | spinlock_t lock; /* ST LL state lock */ | ||
70 | unsigned char protos_registered; | ||
71 | unsigned long ll_state; /* ST LL power state */ | ||
72 | }; | ||
73 | |||
74 | /* point this to tty->driver->write or tty->ops->write | ||
75 | * depending upon the kernel version | ||
76 | */ | ||
77 | int st_int_write(struct st_data_s*, const unsigned char*, int); | ||
78 | /* internal write function, passed onto protocol drivers | ||
79 | * via the write function ptr of protocol struct | ||
80 | */ | ||
81 | long st_write(struct sk_buff *); | ||
82 | /* function to be called from ST-LL | ||
83 | */ | ||
84 | void st_ll_send_frame(enum proto_type, struct sk_buff *); | ||
85 | /* internal wake up function */ | ||
86 | void st_tx_wakeup(struct st_data_s *st_data); | ||
87 | |||
88 | int st_core_init(struct st_data_s **); | ||
89 | void st_core_exit(struct st_data_s *); | ||
90 | void st_kim_ref(struct st_data_s **); | ||
91 | |||
92 | #define GPS_STUB_TEST | ||
93 | #ifdef GPS_STUB_TEST | ||
94 | int gps_chrdrv_stub_write(const unsigned char*, int); | ||
95 | void gps_chrdrv_stub_init(void); | ||
96 | #endif | ||
97 | |||
98 | #endif /*ST_CORE_H */ | ||