2 * User Mode Init manager - For shared transport
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program;if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 /* Paramaters to set the baud rate*/
23 #define FLOW_CTL 0x0001
24 #define BOTHER 0x00001000
27 #define TCGETS2 _IOR('T',0x2A, struct termios2)
28 #define TCSETS2 _IOW('T',0x2B, struct termios2)
30 /*HCI Command and Event information*/
31 #define HCI_HDR_OPCODE 0xff36
32 #define WRITE_BD_ADDR_OPCODE 0xFC06
33 #define RESP_PREFIX 0x04
36 /* HCI Packet types */
37 #define HCI_COMMAND_PKT 0x01
38 #define HCI_EVENT_PKT 0x04
40 /* HCI command macros*/
41 #define HCI_EVENT_HDR_SIZE 2
42 #define HCI_COMMAND_HDR_SIZE 3
43 #define UIM_WRITE_BD_ADDR_CP_SIZE 6
47 #define EVT_CMD_COMPLETE_SIZE 3
48 #define EVT_CMD_STATUS_SIZE 4
49 #define EVT_CMD_COMPLETE 0x0E
50 #define EVT_CMD_STATUS 0x0F
55 #define LOG_TAG "uim-sysfs"
56 #define UIM_ERR(fmt, arg...) ALOGE("uim:"fmt"\n" , ##arg)
57 #if defined(UIM_DEBUG) /* limited debug messages */
58 #define UIM_START_FUNC() ALOGE("uim: Inside %s", __FUNCTION__)
59 #define UIM_DBG(fmt, arg...) ALOGE("uim:"fmt"\n" , ## arg)
60 #define UIM_VER(fmt, arg...)
61 #elif defined(VERBOSE) /* very verbose */
62 #define UIM_START_FUNC() ALOGE("uim: Inside %s", __FUNCTION__)
63 #define UIM_DBG(fmt, arg...) ALOGE("uim:"fmt"\n" , ## arg)
64 #define UIM_VER(fmt, arg...) ALOGE("uim:"fmt"\n" , ## arg)
65 #else /* error msgs only */
66 #define UIM_START_FUNC()
67 #define UIM_DBG(fmt, arg...)
68 #define UIM_VER(fmt, arg...)
71 #define UIM_START_FUNC()
72 #define UIM_DBG(fmt, arg...)
73 #define UIM_VER(fmt, arg...)
74 #define UIM_ERR(fmt, arg...)
77 /*Termios2 structure for setting the Custom baud rate*/
79 tcflag_t c_iflag; /* input mode flags */
80 tcflag_t c_oflag; /* output mode flags */
81 tcflag_t c_cflag; /* control mode flags */
82 tcflag_t c_lflag; /* local mode flags */
83 cc_t c_line; /* line discipline */
84 cc_t c_cc[ARM_NCCS]; /* control characters */
85 speed_t c_ispeed; /* input speed */
86 speed_t c_ospeed; /* output speed */
89 /* HCI command header*/
91 uint16_t opcode; /* OCF & OGF */
93 } __attribute__ ((packed)) hci_command_hdr;
99 } __attribute__ ((packed)) hci_event_hdr;
101 /* HCI command complete event*/
105 } __attribute__ ((packed)) evt_cmd_complete;
107 /* HCI event status*/
112 } __attribute__ ((packed)) evt_cmd_status;
114 /* HCI Event structure to set the cusrom baud rate*/
117 hci_event_hdr hci_hdr;
118 evt_cmd_complete cmd_complete;
121 } __attribute__ ((packed)) command_complete_t;
123 /* HCI Command structure to set the cusrom baud rate*/
126 hci_command_hdr hci_hdr;
128 } __attribute__ ((packed)) uim_speed_change_cmd;
130 /* BD address structure to set the uim BD address*/
133 } __attribute__((packed)) bdaddr_t;
135 /* HCI Command structure to set the uim BD address*/
138 hci_command_hdr hci_hdr;
140 } __attribute__ ((packed)) uim_bdaddr_change_cmd;
142 #define INSTALL_SYSFS_ENTRY "/sys/devices/platform/kim/install"
143 #define DEV_NAME_SYSFS "/sys/devices/platform/kim/dev_name"
144 #define BAUD_RATE_SYSFS "/sys/devices/platform/kim/baud_rate"
145 #define FLOW_CTRL_SYSFS "/sys/devices/platform/kim/flow_cntrl"
147 /* Functions to insert and remove the kernel modules from the system*/
148 extern int init_module(void *, unsigned int, const char *);
149 extern int delete_module(const char *, unsigned int);
150 extern int load_file(const char *, unsigned int *);