| /* |
| * User Mode Init manager - For shared transport |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License as published by |
| * the Free Software Foundation; either version 2 of the License, or |
| * (at your option) any later version. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| * |
| * You should have received a copy of the GNU General Public License |
| * along with this program;if not, write to the Free Software |
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| */ |
| |
| #ifndef UIM_H |
| #define UIM_H |
| |
| /* Paramaters to set the baud rate*/ |
| #define FLOW_CTL 0x0001 |
| #define BOTHER 0x00001000 |
| #define ARM_NCCS 19 |
| |
| #ifndef TCGETS2 |
| #define TCGETS2 _IOR('T', 0x2A, struct termios2) |
| #endif |
| |
| #ifndef TCSETS2 |
| #define TCSETS2 _IOW('T', 0x2B, struct termios2) |
| #endif |
| |
| /*HCI Command and Event information*/ |
| #define HCI_HDR_OPCODE 0xff36 |
| #define RESP_PREFIX 0x04 |
| #define MAX_TRY 10 |
| |
| /* HCI Packet types */ |
| #define HCI_COMMAND_PKT 0x01 |
| #define HCI_EVENT_PKT 0x04 |
| |
| /* HCI command macros*/ |
| #define HCI_EVENT_HDR_SIZE 2 |
| #define HCI_COMMAND_HDR_SIZE 3 |
| |
| /* HCI event macros*/ |
| #define EVT_CMD_COMPLETE_SIZE 3 |
| #define EVT_CMD_STATUS_SIZE 4 |
| #define EVT_CMD_COMPLETE 0x0E |
| #define EVT_CMD_STATUS 0x0F |
| |
| #define VERBOSE |
| /*Debug logs*/ |
| #define UIM_ERR(fmt, arg...) printf("uim:"fmt"\n" , ##arg) |
| #if defined(UIM_DEBUG) /* limited debug messages */ |
| #define UIM_START_FUNC() printf("uim: Inside %s", __func__) |
| #define UIM_DBG(fmt, arg...) printf("uim:"fmt"\n" , ## arg) |
| #define UIM_VER(fmt, arg...) |
| #elif defined(VERBOSE) /* very verbose */ |
| #define UIM_START_FUNC() printf("uim: Inside %s", __func__) |
| #define UIM_DBG(fmt, arg...) printf("uim:"fmt"\n" , ## arg) |
| #define UIM_VER(fmt, arg...) printf("uim:"fmt"\n" , ## arg) |
| #else /* error msgs only */ |
| #define UIM_START_FUNC() |
| #define UIM_DBG(fmt, arg...) |
| #define UIM_VER(fmt, arg...) |
| #endif |
| |
| /*Termios2 structure for setting the Custom baud rate*/ |
| struct termios2 { |
| tcflag_t c_iflag; /* input mode flags */ |
| tcflag_t c_oflag; /* output mode flags */ |
| tcflag_t c_cflag; /* control mode flags */ |
| tcflag_t c_lflag; /* local mode flags */ |
| cc_t c_line; /* line discipline */ |
| cc_t c_cc[ARM_NCCS]; /* control characters */ |
| speed_t c_ispeed; /* input speed */ |
| speed_t c_ospeed; /* output speed */ |
| }; |
| |
| /* HCI command header*/ |
| struct hci_command_hdr { |
| uint16_t opcode; /* OCF & OGF */ |
| uint8_t plen; |
| } __attribute__ ((packed)); |
| |
| /* HCI event header*/ |
| struct hci_event_hdr { |
| uint8_t evt; |
| uint8_t plen; |
| } __attribute__ ((packed)); |
| |
| /* HCI command complete event*/ |
| struct evt_cmd_complete { |
| uint8_t ncmd; |
| uint16_t opcode; |
| } __attribute__ ((packed)); |
| |
| /* HCI event status*/ |
| struct evt_cmd_status { |
| uint8_t status; |
| uint8_t ncmd; |
| uint16_t opcode; |
| } __attribute__ ((packed)); |
| |
| /* HCI Event structure to set the cusrom baud rate*/ |
| struct command_complete_t { |
| uint8_t uart_prefix; |
| struct hci_event_hdr hci_hdr; |
| struct evt_cmd_complete cmd_complete; |
| uint8_t status; |
| uint8_t data[16]; |
| } __attribute__ ((packed)); |
| |
| /* HCI Command structure to set the cusrom baud rate*/ |
| struct uim_speed_change_cmd { |
| uint8_t uart_prefix; |
| struct hci_command_hdr hci_hdr; |
| uint32_t speed; |
| } __attribute__ ((packed)); |
| |
| /* Signal received from KIM will install line discipline at first, |
| * the next signal received from KIM will un-install the |
| * line discipline*/ |
| enum { |
| /* expecting signal from KIM to setup uart fd for ST */ |
| INSTALL_N_TI_WL, |
| |
| /* expecting signal from KIM to close uart fd */ |
| UNINSTALL_N_TI_WL, |
| }; |
| |
| /* Functions to insert and remove the kernel modules from the system*/ |
| extern int init_module(void *, unsigned int, const char *); |
| extern int delete_module(const char *, unsigned int); |
| extern int load_file(const char *, unsigned int *); |
| |
| #endif /* UIM_H */ |