yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * usbc_custom.c |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * MOLY |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This file implements usb customer support |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | *------------------------------------------------------------------------------ |
| 60 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 61 | *============================================================================ |
| 62 | ****************************************************************************/ |
| 63 | #ifdef __HIF_USB_SUPPORT__ |
| 64 | |
| 65 | #include "usbc_custom.h" |
| 66 | #include "dcl.h" |
| 67 | #include "usbc_custom_def.h" |
| 68 | #include "kal_public_api.h" |
| 69 | |
| 70 | static kal_uint16 usb_manufacturer_string[] = |
| 71 | { |
| 72 | 0x031c, /* bDescriptorType:0x03, bLength:0x1c */ |
| 73 | 'M', |
| 74 | 'e', |
| 75 | 'd', |
| 76 | 'i', |
| 77 | 'a', |
| 78 | 'T', |
| 79 | 'e', |
| 80 | 'k', |
| 81 | ' ', |
| 82 | 'I', |
| 83 | 'n', |
| 84 | 'c', |
| 85 | '.' |
| 86 | }; |
| 87 | |
| 88 | static kal_uint16 usb_product_string[] = |
| 89 | { |
| 90 | #if defined(MT6880) |
| 91 | 0x031c, |
| 92 | 'U', |
| 93 | 'S', |
| 94 | 'B', |
| 95 | ' ', |
| 96 | 'D', |
| 97 | 'A', |
| 98 | 'T', |
| 99 | 'A', |
| 100 | ' ', |
| 101 | 'C', |
| 102 | 'A', |
| 103 | 'R', |
| 104 | 'D' |
| 105 | #else |
| 106 | 0x031a, |
| 107 | 'L', |
| 108 | 'T', |
| 109 | 'E', |
| 110 | ' ', |
| 111 | 'U', |
| 112 | 'S', |
| 113 | 'B', |
| 114 | ' ', |
| 115 | 'C', |
| 116 | 'A', |
| 117 | 'R', |
| 118 | 'D' |
| 119 | #endif |
| 120 | }; |
| 121 | |
| 122 | static kal_uint16 usb_serial_num[] = |
| 123 | { |
| 124 | #ifdef __PRODUCTION_RELEASE__ |
| 125 | 0x0320, |
| 126 | '0', |
| 127 | '0', |
| 128 | '0', |
| 129 | '0', |
| 130 | '0', |
| 131 | '0', |
| 132 | '0', |
| 133 | '0', |
| 134 | '0', |
| 135 | '0', |
| 136 | '0', |
| 137 | '0', |
| 138 | '0', |
| 139 | '0', |
| 140 | '0' |
| 141 | #else |
| 142 | /* under construction !*/ |
| 143 | /* under construction !*/ |
| 144 | /* under construction !*/ |
| 145 | /* under construction !*/ |
| 146 | /* under construction !*/ |
| 147 | /* under construction !*/ |
| 148 | /* under construction !*/ |
| 149 | /* under construction !*/ |
| 150 | /* under construction !*/ |
| 151 | /* under construction !*/ |
| 152 | /* under construction !*/ |
| 153 | /* under construction !*/ |
| 154 | /* under construction !*/ |
| 155 | /* under construction !*/ |
| 156 | /* under construction !*/ |
| 157 | /* under construction !*/ |
| 158 | #endif |
| 159 | }; |
| 160 | |
| 161 | static usb_dev_param_t usb_dev_param = |
| 162 | { |
| 163 | 0x0001, /* bcdDevice */ |
| 164 | |
| 165 | usb_manufacturer_string, |
| 166 | sizeof(usb_manufacturer_string)/sizeof(kal_uint16), |
| 167 | usb_product_string, |
| 168 | sizeof(usb_product_string)/sizeof(kal_uint16), |
| 169 | usb_serial_num, |
| 170 | sizeof(usb_serial_num)/sizeof(kal_uint16), |
| 171 | |
| 172 | 2, // morphing sub id |
| 173 | |
| 174 | /* Mode Parameter: each mode is defined in a file of usbc_custom_mode folder */ |
| 175 | /* And each mode will register to this structure array.*/ |
| 176 | /* ========================================================== */ |
| 177 | {{0}}, |
| 178 | |
| 179 | { |
| 180 | #ifdef BTT_STANDALONE_MODE |
| 181 | USB_MODE_BTT_STANDALONE, //USB_OS_WIN8 |
| 182 | USB_MODE_BTT_STANDALONE, //USB_OS_WIN |
| 183 | USB_MODE_BTT_STANDALONE, //USB_OS_LINUX |
| 184 | USB_MODE_BTT_STANDALONE, //USB_OS_MAC |
| 185 | USB_MODE_BTT_STANDALONE //USB_OS_OTHERS |
| 186 | #else // #ifdef BTT_STANDALONE_MODE |
| 187 | USB_MODE_DEFAULT, //USB_OS_WIN8 |
| 188 | USB_MODE_DEFAULT, //USB_OS_WIN |
| 189 | USB_MODE_DEFAULT, //USB_OS_LINUX |
| 190 | USB_MODE_DEFAULT, //USB_OS_MAC |
| 191 | USB_MODE_DEFAULT //USB_OS_OTHERS |
| 192 | #endif // #ifdef BTT_STANDALONE_MODE |
| 193 | } |
| 194 | }; |
| 195 | |
| 196 | // |
| 197 | // ACM1 String Descriptor |
| 198 | // |
| 199 | static kal_uint16 acm1_string_descr_interface[] = |
| 200 | { |
| 201 | 0x031A, /* bDescriptorType:0x03, bLength:0x1A */ |
| 202 | 'U', 'S', 'B', ' ', |
| 203 | 'C', 'O', 'M', ' ', |
| 204 | 'P', 'o', 'r', 't', |
| 205 | }; |
| 206 | static const usb_class_acm1_param_t usb_class_acm1_param_c = |
| 207 | { |
| 208 | acm1_string_descr_interface, // interface_string; |
| 209 | sizeof(acm1_string_descr_interface)/sizeof(kal_uint16), // interface_string_size; |
| 210 | }; |
| 211 | |
| 212 | // |
| 213 | // ACM2 String Descriptor |
| 214 | // |
| 215 | static kal_uint16 acm2_string_descr_comm_interface[] = |
| 216 | { |
| 217 | 0x0340, /* bDescriptorType:0x03, bLength:0x40 */ |
| 218 | 'U', 'S', 'B', ' ', |
| 219 | 'C', 'O', 'M', ' ', |
| 220 | 'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ', |
| 221 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 222 | }; |
| 223 | static kal_uint16 acm2_string_descr_data_interface[] = |
| 224 | { |
| 225 | 0x032E, /* bDescriptorType:0x03, bLength:0x2E */ |
| 226 | 'U', 'S', 'B', ' ', |
| 227 | 'C', 'O', 'M', ' ', |
| 228 | 'D', 'a', 't', 'a', ' ', |
| 229 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 230 | }; |
| 231 | static kal_uint16 acm2_string_descr_iad[] = |
| 232 | { |
| 233 | 0x031A, /* bDescriptorType:0x03, bLength:0x1A */ |
| 234 | 'U', 'S', 'B', ' ', |
| 235 | 'C', 'O', 'M', ' ', |
| 236 | 'P', 'o', 'r', 't', |
| 237 | }; |
| 238 | static const usb_class_acm2_param_t usb_class_acm2_param_c = |
| 239 | { |
| 240 | acm2_string_descr_comm_interface, // comm_interface_string; |
| 241 | sizeof(acm2_string_descr_comm_interface)/sizeof(kal_uint16), // comm_interface_string_size; |
| 242 | acm2_string_descr_data_interface, // data_interface_string; |
| 243 | sizeof(acm2_string_descr_data_interface)/sizeof(kal_uint16), // data_interface_string_size; |
| 244 | acm2_string_descr_iad, // iad_string; |
| 245 | sizeof(acm2_string_descr_iad)/sizeof(kal_uint16), // iad_string_size; |
| 246 | }; |
| 247 | |
| 248 | // |
| 249 | // ACM3 String Descriptor |
| 250 | // |
| 251 | static kal_uint16 acm3_string_descr_interface[] = |
| 252 | { |
| 253 | 0x031A, /* bDescriptorType:0x03, bLength:0x1A */ |
| 254 | 'U', 'S', 'B', ' ', |
| 255 | 'C', 'O', 'M', ' ', |
| 256 | 'P', 'o', 'r', 't', |
| 257 | }; |
| 258 | static const usb_class_acm3_param_t usb_class_acm3_param_c = |
| 259 | { |
| 260 | acm3_string_descr_interface, // interface_string; |
| 261 | sizeof(acm3_string_descr_interface)/sizeof(kal_uint16), // interface_string_size; |
| 262 | }; |
| 263 | |
| 264 | // |
| 265 | // RNDIS String Descriptor |
| 266 | // |
| 267 | static kal_uint16 rndis_string_descr_comm_interface[] = |
| 268 | { |
| 269 | 0x033C, /* bDescriptorType:0x03, bLength:0x3C */ |
| 270 | 'R', 'N', 'D', 'I', 'S', ' ', |
| 271 | 'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ', |
| 272 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 273 | }; |
| 274 | static kal_uint16 rndis_string_descr_data_interface[] = |
| 275 | { |
| 276 | 0x032A, /* bDescriptorType:0x03, bLength:0x2A */ |
| 277 | 'R', 'N', 'D', 'I', 'S', ' ', |
| 278 | 'D', 'a', 't', 'a', ' ', |
| 279 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 280 | }; |
| 281 | static kal_uint16 rndis_string_descr_iad[] = |
| 282 | { |
| 283 | 0x0326, /* bDescriptorType:0x03, bLength:0x26 */ |
| 284 | 'R', 'E', 'M', 'O', 'T', 'E', ' ', |
| 285 | 'N', 'D', 'I', 'S', ' ', |
| 286 | 'D', 'e', 'v', 'i', 'c', 'e', |
| 287 | }; |
| 288 | static const usb_class_rndis_param_t usb_class_rndis_param_c = |
| 289 | { |
| 290 | rndis_string_descr_comm_interface, // comm_interface_string; |
| 291 | sizeof(rndis_string_descr_comm_interface)/sizeof(kal_uint16), // comm_interface_string_size; |
| 292 | rndis_string_descr_data_interface, // data_interface_string; |
| 293 | sizeof(rndis_string_descr_data_interface)/sizeof(kal_uint16), // data_interface_string_size; |
| 294 | rndis_string_descr_iad, // iad_string; |
| 295 | sizeof(rndis_string_descr_iad)/sizeof(kal_uint16), // iad_string_size; |
| 296 | }; |
| 297 | |
| 298 | // |
| 299 | // ECM String Descriptor |
| 300 | // |
| 301 | static kal_uint16 ecm_string_descr_comm_interface[] = |
| 302 | { |
| 303 | 0x033A, /* bDescriptorType:0x03, bLength:0x3A */ |
| 304 | 'E', 'C', 'M', ' ', |
| 305 | 'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ', |
| 306 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 307 | }; |
| 308 | static kal_uint16 ecm_string_descr_null_data_interface[] = |
| 309 | { |
| 310 | 0x0330, /* bDescriptorType:0x03, bLength:0x30 */ |
| 311 | 'E', 'C', 'M', ' ', |
| 312 | 'N', 'U', 'L', 'L', ' ', |
| 313 | 'D', 'a', 't', 'a', ' ', |
| 314 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 315 | }; |
| 316 | |
| 317 | static kal_uint16 ecm_string_descr_data_interface[] = |
| 318 | { |
| 319 | 0x0326, /* bDescriptorType:0x03, bLength:0x26 */ |
| 320 | 'E', 'C', 'M', ' ', |
| 321 | 'D', 'a', 't', 'a', ' ', |
| 322 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 323 | }; |
| 324 | static kal_uint16 ecm_string_descr_iad[] = |
| 325 | { |
| 326 | 0x0328, /* bDescriptorType:0x03, bLength:0x28 */ |
| 327 | 'U', 'S', 'B', ' ', |
| 328 | 'E', 't', 'h', 'e', 'r', 'n', 'e', 't', ' ', |
| 329 | 'D', 'e', 'v', 'i', 'c', 'e', |
| 330 | }; |
| 331 | static kal_uint16 ecm_string_descr_mac_addr[3][13] = |
| 332 | { |
| 333 | {0x031A, /* bDescriptorType:0x03, bLength:0x1A */ |
| 334 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 335 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, |
| 336 | |
| 337 | {0x031A, /* bDescriptorType:0x03, bLength:0x1A */ |
| 338 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 339 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, |
| 340 | |
| 341 | {0x031A, /* bDescriptorType:0x03, bLength:0x1A */ |
| 342 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 343 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, |
| 344 | }; |
| 345 | static const usb_class_ecm_param_t usb_class_ecm_param_c = |
| 346 | { |
| 347 | ecm_string_descr_comm_interface, // comm_interface_string; |
| 348 | sizeof(ecm_string_descr_comm_interface)/sizeof(kal_uint16), // comm_interface_string_size; |
| 349 | ecm_string_descr_null_data_interface, // null_data_interface_string; -- Disable data interface |
| 350 | sizeof(ecm_string_descr_null_data_interface)/sizeof(kal_uint16), // null_data_interface_string_size; |
| 351 | ecm_string_descr_data_interface, // data_interface_string; -- Enable data interface |
| 352 | sizeof(ecm_string_descr_data_interface)/sizeof(kal_uint16), // data_interface_string_size; |
| 353 | ecm_string_descr_iad, // iad_string; |
| 354 | sizeof(ecm_string_descr_iad)/sizeof(kal_uint16), // iad_string_size; |
| 355 | // mac_addr_string; |
| 356 | { ecm_string_descr_mac_addr[0], ecm_string_descr_mac_addr[1], ecm_string_descr_mac_addr[2] }, |
| 357 | // mac_addr_string_size; |
| 358 | { sizeof(ecm_string_descr_mac_addr[0])/sizeof(kal_uint16), sizeof(ecm_string_descr_mac_addr[1])/sizeof(kal_uint16), sizeof(ecm_string_descr_mac_addr[2])/sizeof(kal_uint16) }, |
| 359 | }; |
| 360 | |
| 361 | |
| 362 | // |
| 363 | // MBIM String Descriptor |
| 364 | // |
| 365 | static kal_uint16 mbim_string_descr_comm_interface[] = |
| 366 | { |
| 367 | 0x033A, /* bDescriptorType:0x03, bLength:0x3A */ |
| 368 | 'M', 'B', 'I', 'M', ' ', |
| 369 | 'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ', |
| 370 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 371 | }; |
| 372 | static kal_uint16 mbim_string_descr_null_data_interface[] = |
| 373 | { |
| 374 | 0x0332, /* bDescriptorType:0x03, bLength:0x32 */ |
| 375 | 'M', 'B', 'I', 'M', ' ', |
| 376 | 'N', 'U', 'L', 'L', ' ', |
| 377 | 'D', 'a', 't', 'a', ' ', |
| 378 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 379 | }; |
| 380 | static kal_uint16 mbim_string_descr_data_interface[] = |
| 381 | { |
| 382 | 0x0328, /* bDescriptorType:0x03, bLength:0x28 */ |
| 383 | 'M', 'B', 'I', 'M', ' ', |
| 384 | 'D', 'a', 't', 'a', ' ', |
| 385 | 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', |
| 386 | }; |
| 387 | static kal_uint16 mbim_string_descr_iad[] = |
| 388 | { |
| 389 | 0x0330, /* bDescriptorType:0x03, bLength:0x30 */ |
| 390 | 'M', 'o', 'b', 'i', 'l', 'e', ' ', |
| 391 | 'B', 'r', 'o', 'a', 'd', 'b', 'a', 'n', 'd', ' ', |
| 392 | 'D', 'e', 'v', 'i', 'c', 'e', |
| 393 | }; |
| 394 | static const usb_class_mbim_param_t usb_class_mbim_param_c = |
| 395 | { |
| 396 | mbim_string_descr_comm_interface, // comm_interface_string; |
| 397 | sizeof(mbim_string_descr_comm_interface)/sizeof(kal_uint16), // comm_interface_string_size; |
| 398 | mbim_string_descr_null_data_interface, // null_data_interface_string; -- Disable data interface |
| 399 | sizeof(mbim_string_descr_null_data_interface)/sizeof(kal_uint16), // null_data_interface_string_size; |
| 400 | mbim_string_descr_data_interface, // data_interface_string; -- Enable data interface |
| 401 | sizeof(mbim_string_descr_data_interface)/sizeof(kal_uint16), // data_interface_string_size; |
| 402 | mbim_string_descr_iad, // iad_string; |
| 403 | sizeof(mbim_string_descr_iad)/sizeof(kal_uint16), // iad_string_size; |
| 404 | }; |
| 405 | |
| 406 | // |
| 407 | // ADB String Descriptor |
| 408 | // |
| 409 | static kal_uint16 adb_string_descr_interface[] = |
| 410 | { |
| 411 | 0x031C, /* bDescriptorType:0x03, bLength:0x1A */ |
| 412 | 'A', 'D', 'B', ' ', |
| 413 | 'I', 'n', 't', 'e', |
| 414 | 'r', 'f', 'a', 'c', 'e' |
| 415 | }; |
| 416 | static const usb_class_adb_param_t usb_class_adb_param_c = |
| 417 | { |
| 418 | adb_string_descr_interface, // interface_string; |
| 419 | sizeof(adb_string_descr_interface)/sizeof(kal_uint16), // interface_string_size; |
| 420 | }; |
| 421 | |
| 422 | static kal_uint16 ms_string_descr_interface[] = |
| 423 | { |
| 424 | 0x031c, |
| 425 | 'M', |
| 426 | 'a', |
| 427 | 's', |
| 428 | 's', |
| 429 | ' ', |
| 430 | 'S', |
| 431 | 't', |
| 432 | 'o', |
| 433 | 'r', |
| 434 | 'a', |
| 435 | 'g', |
| 436 | 'e', |
| 437 | ' ' |
| 438 | }; |
| 439 | static const usb_class_ms_param_t usb_class_ms_param_c = |
| 440 | { |
| 441 | ms_string_descr_interface, // interface_string; |
| 442 | sizeof(ms_string_descr_interface)/sizeof(kal_uint16), // interface_string_size; |
| 443 | }; |
| 444 | #if 0 |
| 445 | /* under construction !*/ |
| 446 | /* under construction !*/ |
| 447 | #if defined(__MTK_TARGET__) |
| 448 | /* under construction !*/ |
| 449 | #else |
| 450 | /* under construction !*/ |
| 451 | #endif |
| 452 | /* under construction !*/ |
| 453 | /* under construction !*/ |
| 454 | /* under construction !*/ |
| 455 | /* under construction !*/ |
| 456 | /* under construction !*/ |
| 457 | #if defined(__MTK_TARGET__) |
| 458 | #if defined(__MSDC_SD_MMC__) |
| 459 | /* under construction !*/ |
| 460 | #endif |
| 461 | /* under construction !*/ |
| 462 | #else |
| 463 | /* under construction !*/ |
| 464 | #endif |
| 465 | /* under construction !*/ |
| 466 | /* under construction !*/ |
| 467 | /* under construction !*/ |
| 468 | /* under construction !*/ |
| 469 | #if defined(__MTK_TARGET__) |
| 470 | #if defined(__MSDC_SD_MMC__) |
| 471 | /* under construction !*/ |
| 472 | #endif |
| 473 | /* under construction !*/ |
| 474 | #else |
| 475 | /* under construction !*/ |
| 476 | #endif |
| 477 | /* under construction !*/ |
| 478 | /* under construction !*/ |
| 479 | /* under construction !*/ |
| 480 | /* under construction !*/ |
| 481 | #if defined(__MTK_TARGET__) |
| 482 | #if defined(__MSDC_SD_MMC__) |
| 483 | /* under construction !*/ |
| 484 | #endif |
| 485 | /* under construction !*/ |
| 486 | #else |
| 487 | /* under construction !*/ |
| 488 | #endif |
| 489 | /* under construction !*/ |
| 490 | /* under construction !*/ |
| 491 | /* under construction !*/ |
| 492 | /* under construction !*/ |
| 493 | #if defined(__MTK_TARGET__) |
| 494 | #if defined(__MSDC_SD_MMC__) |
| 495 | /* under construction !*/ |
| 496 | #endif |
| 497 | /* under construction !*/ |
| 498 | #else |
| 499 | /* under construction !*/ |
| 500 | #endif |
| 501 | /* under construction !*/ |
| 502 | /* under construction !*/ |
| 503 | /* under construction !*/ |
| 504 | /* under construction !*/ |
| 505 | #if defined(__MTK_TARGET__) |
| 506 | /* under construction !*/ |
| 507 | #else |
| 508 | /* under construction !*/ |
| 509 | #endif |
| 510 | /* under construction !*/ |
| 511 | /* under construction !*/ |
| 512 | /* under construction !*/ |
| 513 | /* under construction !*/ |
| 514 | #if defined(__MTK_TARGET__) |
| 515 | #if defined(__MSDC_SD_MMC__) |
| 516 | /* under construction !*/ |
| 517 | #endif |
| 518 | /* under construction !*/ |
| 519 | #else |
| 520 | /* under construction !*/ |
| 521 | #endif |
| 522 | /* under construction !*/ |
| 523 | /* under construction !*/ |
| 524 | /* under construction !*/ |
| 525 | /* under construction !*/ |
| 526 | /* under construction !*/ |
| 527 | /* under construction !*/ |
| 528 | /* under construction !*/ |
| 529 | /* under construction !*/ |
| 530 | /* under construction !*/ |
| 531 | /* under construction !*/ |
| 532 | /* under construction !*/ |
| 533 | /* under construction !*/ |
| 534 | /* under construction !*/ |
| 535 | /* under construction !*/ |
| 536 | /* under construction !*/ |
| 537 | /* under construction !*/ |
| 538 | /* under construction !*/ |
| 539 | /* under construction !*/ |
| 540 | /* under construction !*/ |
| 541 | /* under construction !*/ |
| 542 | /* under construction !*/ |
| 543 | /* under construction !*/ |
| 544 | /* under construction !*/ |
| 545 | /* under construction !*/ |
| 546 | /* under construction !*/ |
| 547 | /* under construction !*/ |
| 548 | /* under construction !*/ |
| 549 | /* under construction !*/ |
| 550 | /* under construction !*/ |
| 551 | /* under construction !*/ |
| 552 | /* under construction !*/ |
| 553 | /* under construction !*/ |
| 554 | /* under construction !*/ |
| 555 | /* under construction !*/ |
| 556 | /* under construction !*/ |
| 557 | /* under construction !*/ |
| 558 | /* under construction !*/ |
| 559 | /* under construction !*/ |
| 560 | /* under construction !*/ |
| 561 | /* under construction !*/ |
| 562 | /* under construction !*/ |
| 563 | /* under construction !*/ |
| 564 | /* under construction !*/ |
| 565 | /* under construction !*/ |
| 566 | /* under construction !*/ |
| 567 | /* under construction !*/ |
| 568 | /* under construction !*/ |
| 569 | /* under construction !*/ |
| 570 | /* under construction !*/ |
| 571 | /* under construction !*/ |
| 572 | /* under construction !*/ |
| 573 | /* under construction !*/ |
| 574 | /* under construction !*/ |
| 575 | /* under construction !*/ |
| 576 | /* under construction !*/ |
| 577 | /* under construction !*/ |
| 578 | /* under construction !*/ |
| 579 | /* under construction !*/ |
| 580 | /* under construction !*/ |
| 581 | /* under construction !*/ |
| 582 | /* under construction !*/ |
| 583 | /* under construction !*/ |
| 584 | /* under construction !*/ |
| 585 | /* under construction !*/ |
| 586 | /* under construction !*/ |
| 587 | /* under construction !*/ |
| 588 | /* under construction !*/ |
| 589 | /* under construction !*/ |
| 590 | /* under construction !*/ |
| 591 | /* under construction !*/ |
| 592 | /* under construction !*/ |
| 593 | /* under construction !*/ |
| 594 | /* under construction !*/ |
| 595 | /* under construction !*/ |
| 596 | /* under construction !*/ |
| 597 | /* under construction !*/ |
| 598 | /* under construction !*/ |
| 599 | /* under construction !*/ |
| 600 | /* under construction !*/ |
| 601 | /* under construction !*/ |
| 602 | /* under construction !*/ |
| 603 | /* under construction !*/ |
| 604 | /* under construction !*/ |
| 605 | /* under construction !*/ |
| 606 | /* under construction !*/ |
| 607 | /* under construction !*/ |
| 608 | /* under construction !*/ |
| 609 | /* under construction !*/ |
| 610 | /* under construction !*/ |
| 611 | /* under construction !*/ |
| 612 | /* under construction !*/ |
| 613 | /* under construction !*/ |
| 614 | /* under construction !*/ |
| 615 | /* under construction !*/ |
| 616 | /* under construction !*/ |
| 617 | /* under construction !*/ |
| 618 | /* under construction !*/ |
| 619 | /* under construction !*/ |
| 620 | /* under construction !*/ |
| 621 | /* under construction !*/ |
| 622 | /* under construction !*/ |
| 623 | /* under construction !*/ |
| 624 | /* under construction !*/ |
| 625 | /* under construction !*/ |
| 626 | /* under construction !*/ |
| 627 | #endif |
| 628 | |
| 629 | /* |
| 630 | * Public Function |
| 631 | */ |
| 632 | const usb_dev_param_t *usb_get_device_param(void) |
| 633 | { |
| 634 | return (&usb_dev_param); |
| 635 | } |
| 636 | |
| 637 | const usb_class_acm1_param_t *usb_get_acm1_param(void) |
| 638 | { |
| 639 | return &usb_class_acm1_param_c; |
| 640 | } |
| 641 | |
| 642 | const usb_class_acm2_param_t *usb_get_acm2_param(void) |
| 643 | { |
| 644 | return &usb_class_acm2_param_c; |
| 645 | } |
| 646 | |
| 647 | const usb_class_acm3_param_t *usb_get_acm3_param(void) |
| 648 | { |
| 649 | return &usb_class_acm3_param_c; |
| 650 | } |
| 651 | |
| 652 | const usb_class_mbim_param_t *usb_get_mbim_param(void) |
| 653 | { |
| 654 | return &usb_class_mbim_param_c; |
| 655 | } |
| 656 | |
| 657 | const usb_class_rndis_param_t *usb_get_rndis_param(void) |
| 658 | { |
| 659 | return &usb_class_rndis_param_c; |
| 660 | } |
| 661 | |
| 662 | const usb_class_ecm_param_t *usb_get_ecm_param(void) |
| 663 | { |
| 664 | return &usb_class_ecm_param_c; |
| 665 | } |
| 666 | |
| 667 | const usb_class_adb_param_t *usb_get_adb_param(void) |
| 668 | { |
| 669 | return &usb_class_adb_param_c; |
| 670 | } |
| 671 | |
| 672 | const usb_class_ms_param_t *usb_get_ms_param(void) |
| 673 | { |
| 674 | return &usb_class_ms_param_c; |
| 675 | } |
| 676 | |
| 677 | /* get USB custom parameter function*/ |
| 678 | static const usb_custom_func_t usb_custom_func = |
| 679 | { |
| 680 | usb_get_device_param, |
| 681 | usb_get_ms_param, |
| 682 | usb_get_acm1_param, |
| 683 | usb_get_acm2_param, |
| 684 | usb_get_acm3_param, |
| 685 | usb_get_mbim_param, |
| 686 | usb_get_rndis_param, |
| 687 | usb_get_ecm_param, |
| 688 | usb_get_adb_param, |
| 689 | }; |
| 690 | |
| 691 | const usb_custom_func_t *usb_get_custom_func(void) |
| 692 | { |
| 693 | return(&usb_custom_func); |
| 694 | } |
| 695 | |
| 696 | kal_uint32 usb_mode_register_index = 0; |
| 697 | void usb_register_mode_param(usb_mode_param_t *mode_param) |
| 698 | { |
| 699 | if(mode_param != NULL && usb_mode_register_index < (USB_MODE_MAX -1)) |
| 700 | kal_mem_cpy(&(usb_dev_param.mode_param[usb_mode_register_index++]), mode_param, sizeof(usb_mode_param_t)); |
| 701 | |
| 702 | return; |
| 703 | } |
| 704 | |
| 705 | void usb_replace_mode_param(usb_mode_param_t *mode_param, kal_uint8 index) |
| 706 | { |
| 707 | if(mode_param != NULL && index < (USB_MODE_MAX -1)) |
| 708 | { |
| 709 | kal_mem_cpy(&(usb_dev_param.mode_param[index]), mode_param, sizeof(usb_mode_param_t)); |
| 710 | } |
| 711 | return; |
| 712 | } |
| 713 | #endif /* __HIF_USB_SUPPORT__ */ |