1 /* 2 * User Mode Init manager - For shared transport 3 * 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. 8 * 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. 13 * 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 17 */ 18 19 #ifndef UIM_H 20 #define UIM_H 21 22 /* the line discipline ideally should be coming 23 * from tty.h 24 */ 25 #define N_TI_WL 22 26 27 /* Paramaters to set the baud rate*/ 28 #define FLOW_CTL 0x0001 29 #define BOTHER 0x00001000 30 #define ARM_NCCS 19 31 32 #ifndef TCGETS2 33 #define TCGETS2 _IOR('T',0x2A, struct termios2) 34 #endif 35 #ifndef TCSETS2 36 #define TCSETS2 _IOW('T',0x2B, struct termios2) 37 #endif 38 39 /*HCI Command and Event information*/ 40 #define HCI_HDR_OPCODE 0xff36 41 #define WRITE_BD_ADDR_OPCODE 0xFC06 42 #define RESP_PREFIX 0x04 43 #define MAX_TRY 10 44 45 /* HCI Packet types */ 46 #define HCI_COMMAND_PKT 0x01 47 #define HCI_EVENT_PKT 0x04 48 49 /* HCI command macros*/ 50 #define HCI_EVENT_HDR_SIZE 2 51 #define HCI_COMMAND_HDR_SIZE 3 52 #define HCI_COMMAND_HDR_SIZE 3 53 54 /* HCI event macros*/ 55 #define EVT_CMD_COMPLETE_SIZE 3 56 #define EVT_CMD_STATUS_SIZE 4 57 #define EVT_CMD_COMPLETE 0x0E 58 #define EVT_CMD_STATUS 0x0F 59 60 /* use it for string lengths and buffers */ 61 #define UART_DEV_NAME_LEN 32 62 /* BD address length in format xx:xx:xx:xx:xx:xx */ 63 #define BD_ADDR_LEN 17 64 65 /* the sysfs entries with device configuration set by 66 * shared transport driver 67 */ 68 #define INSTALL_SYSFS_ENTRY "/sys/devices/platform/kim/install" 69 #define DEV_NAME_SYSFS "/sys/devices/platform/kim/dev_name" 70 #define BAUD_RATE_SYSFS "/sys/devices/platform/kim/baud_rate" 71 #define FLOW_CTRL_SYSFS "/sys/devices/platform/kim/flow_cntrl" 72 73 74 #define VERBOSE 75 /*Debug logs*/ 76 #define UIM_ERR(fmt, arg...) printf("uim:"fmt"\n" , ##arg) 77 #if defined(UIM_DEBUG) /* limited debug messages */ 78 #define UIM_START_FUNC() printf("uim: Inside %s", __FUNCTION__) 79 #define UIM_DBG(fmt, arg...) printf("uim:"fmt"\n" , ## arg) 80 #define UIM_VER(fmt, arg...) 81 #elif defined(VERBOSE) /* very verbose */ 82 #define UIM_START_FUNC() printf("uim:@ %s\n", __FUNCTION__) 83 #define UIM_DBG(fmt, arg...) printf("uim:"fmt"\n" , ## arg) 84 #define UIM_VER(fmt, arg...) printf("uim:"fmt"\n" , ## arg) 85 #else /* error msgs only */ 86 #define UIM_START_FUNC() 87 #define UIM_DBG(fmt, arg...) 88 #define UIM_VER(fmt, arg...) 89 #endif 90 91 /* HCI command header*/ 92 typedef struct { 93 uint16_t opcode; /* OCF & OGF */ 94 uint8_t plen; 95 } __attribute__ ((packed)) hci_command_hdr; 96 97 /* HCI event header*/ 98 typedef struct { 99 uint8_t evt; 100 uint8_t plen; 101 } __attribute__ ((packed)) hci_event_hdr; 102 103 /* HCI command complete event*/ 104 typedef struct { 105 uint8_t ncmd; 106 uint16_t opcode; 107 } __attribute__ ((packed)) evt_cmd_complete; 108 109 /* HCI event status*/ 110 typedef struct { 111 uint8_t status; 112 uint8_t ncmd; 113 uint16_t opcode; 114 } __attribute__ ((packed)) evt_cmd_status; 115 116 /* HCI Event structure to set the cusrom baud rate*/ 117 typedef struct { 118 uint8_t uart_prefix; 119 hci_event_hdr hci_hdr; 120 evt_cmd_complete cmd_complete; 121 uint8_t status; 122 uint8_t data[16]; 123 } __attribute__ ((packed)) command_complete_t; 124 125 /* HCI Command structure to set the cusrom baud rate*/ 126 typedef struct { 127 uint8_t uart_prefix; 128 hci_command_hdr hci_hdr; 129 uint32_t speed; 130 } __attribute__ ((packed)) uim_speed_change_cmd; 131 132 /* BD address structure to set the uim BD address*/ 133 typedef struct { 134 unsigned char b[6]; 135 } __attribute__((packed)) bdaddr_t; 136 137 /* HCI Command structure to set the uim BD address*/ 138 typedef struct { 139 uint8_t uart_prefix; 140 hci_command_hdr hci_hdr; 141 bdaddr_t addr; 142 } __attribute__ ((packed)) uim_bdaddr_change_cmd;\ 143 144 #endif /* UIM_H */ 145