rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /*! |
| 2 | * @file ufpm_struct.h |
| 3 | * @author Bo-Kai Huang <bo-kai.haung@mediatek.com> |
| 4 | * @version 1.0 |
| 5 | * @section LICENSE |
| 6 | * |
| 7 | * This software is protected by Copyright and the information contained |
| 8 | * herein is confidential. The software may not be copied and the information |
| 9 | * contained herein may not be used or disclosed except with the written |
| 10 | * permission of MediaTek Inc. (C) 2005 |
| 11 | * |
| 12 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 13 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 14 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 15 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 18 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 19 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 20 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 21 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 22 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 23 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 24 | * |
| 25 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 26 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 27 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 28 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 29 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 30 | * |
| 31 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 32 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 33 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 34 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 35 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 36 | * |
| 37 | * @section DESCRIPTION |
| 38 | * This file provides main definitions of usbcore |
| 39 | */ |
| 40 | |
| 41 | #ifndef _UFPM_STRUCT_H |
| 42 | #define _UFPM_STRUCT_H |
| 43 | |
| 44 | #include "hif_mw_msgid.h" |
| 45 | #include "kal_public_api.h" |
| 46 | #include "ufpm_enum.h" |
| 47 | #include "ipc_msgsvc_msgid.h" |
| 48 | #include "ccci_ipc_if.h" |
| 49 | #include "mw_sap.h" |
| 50 | #include "ufpm_usb_struct.h" |
| 51 | |
| 52 | #define UFPM_USB_MAP_MAX_SIZE 8 |
| 53 | |
| 54 | /************************************** |
| 55 | * UFPM ENUM and Types |
| 56 | **************************************/ |
| 57 | typedef union _ufpm_func_activation_info { |
| 58 | tethering_activate_meta_info_t tethering_info; |
| 59 | logging_activate_meta_info_t logging_info; |
| 60 | } ufpm_func_activation_info_t; |
| 61 | |
| 62 | typedef union _ufpm_func_deactivation_info { |
| 63 | tethering_deactivate_meta_info_t tethering_info; |
| 64 | logging_deactivate_meta_info_t logging_info; |
| 65 | } ufpm_func_deactivation_info_t; |
| 66 | |
| 67 | typedef struct _ufpm_usb_property { |
| 68 | kal_bool isSupport; |
| 69 | ufpm_func_state_e state; |
| 70 | ufpm_usb_mapping_t mapTable[UFPM_USB_MAP_MAX_SIZE]; |
| 71 | ufpm_func_activation_info_t activate_meta_info; |
| 72 | ufpm_func_deactivation_info_t deactivate_meta_info; |
| 73 | } ufpm_usb_property_t; |
| 74 | |
| 75 | typedef struct _ufpm_mpu_info { |
| 76 | kal_uint8 apUsbDomain; // AP USB MPU domain ID |
| 77 | kal_uint8 mdCldmaDomain; // MD CLDMA MPU domain ID |
| 78 | kal_uint8 reserved[6]; |
| 79 | kal_uint64 memBank0BaseAddr; // Memory bank0 base address |
| 80 | kal_uint64 memBank0Size; // Memory bank0 size |
| 81 | kal_uint64 memBank4BaseAddr; // Memory bank4 base address |
| 82 | kal_uint64 memBank4Size; // Memory bank4 size |
| 83 | } ufpm_mpu_info_t; |
| 84 | |
| 85 | typedef struct _ufpm_md_fast_path_common_req { |
| 86 | LOCAL_PARA_HDR |
| 87 | kal_uint8 mode; |
| 88 | kal_uint8 reserved[3]; |
| 89 | } ufpm_md_fast_path_common_req_t; |
| 90 | |
| 91 | typedef struct _ufpm_md_fast_path_common_rsp { |
| 92 | LOCAL_PARA_HDR |
| 93 | kal_uint8 mode; |
| 94 | kal_uint8 result; // bool |
| 95 | kal_uint8 reserved[2]; |
| 96 | } ufpm_md_fast_path_common_rsp_t; |
| 97 | |
| 98 | typedef struct _ufpm_md_fast_path_common_ind { |
| 99 | LOCAL_PARA_HDR |
| 100 | kal_uint8 mode; |
| 101 | kal_uint8 reserved[3]; |
| 102 | } ufpm_md_fast_path_common_ind_t; |
| 103 | |
| 104 | typedef struct _ufpm_notify_md_bus_event_req { |
| 105 | LOCAL_PARA_HDR |
| 106 | kal_uint8 state; |
| 107 | kal_uint8 reserved[3]; |
| 108 | } ufpm_notify_md_bus_event_req_t; |
| 109 | |
| 110 | typedef struct _ufpm_activate_md_func_req { |
| 111 | LOCAL_PARA_HDR |
| 112 | kal_uint8 mode; |
| 113 | kal_uint8 address; // USB address |
| 114 | kal_uint8 configuration; // USB configuraton number |
| 115 | kal_uint8 speed; // USB 2.0/3.0 |
| 116 | ufpm_usb_mapping_t ap_usb_map[UFPM_USB_MAP_MAX_SIZE]; // AP released IF/EP |
| 117 | tethering_activate_meta_info_t tethering_meta_info; // tethering meta data |
| 118 | logging_activate_meta_info_t logging_meta_info; // logging meta data |
| 119 | } ufpm_activate_md_func_req_t; |
| 120 | |
| 121 | typedef struct _ufpm_enable_md_func_req { |
| 122 | LOCAL_PARA_HDR |
| 123 | kal_uint8 mode; |
| 124 | kal_uint8 version; |
| 125 | kal_uint8 reserved[2]; |
| 126 | ufpm_mpu_info_t mpuInfo; |
| 127 | } ufpm_enable_md_func_req_t; |
| 128 | |
| 129 | typedef struct _ufpm_send_md_ep0_msg { |
| 130 | LOCAL_PARA_HDR |
| 131 | kal_uint8 mode; |
| 132 | kal_uint8 reserved[3]; |
| 133 | kal_uint8 pBuffer[1024]; //hifusb_setup_packet_t packet; |
| 134 | } ufpm_send_md_ep0_msg_t; |
| 135 | |
| 136 | typedef struct _ufpm_enable_md_func_rsp { |
| 137 | LOCAL_PARA_HDR |
| 138 | kal_uint8 mode; |
| 139 | kal_uint8 result; // bool |
| 140 | kal_uint8 version; |
| 141 | kal_uint8 reserved; |
| 142 | } ufpm_enable_md_func_rsp_t; |
| 143 | |
| 144 | typedef struct _ufpm_deactivate_md_func_rsp { |
| 145 | LOCAL_PARA_HDR |
| 146 | kal_uint8 mode; |
| 147 | kal_uint8 result; // bool |
| 148 | kal_uint8 reserved[2]; |
| 149 | tethering_deactivate_meta_info_t tethering_meta_info; |
| 150 | logging_deactivate_meta_info_t logging_meta_info; |
| 151 | } ufpm_deactivate_md_func_rsp_t; |
| 152 | |
| 153 | typedef struct _ufpm_t { |
| 154 | // USB properties |
| 155 | ufpm_usb_property_t ufpm_usb_property[UFPM_FUNC_MODE_MAX_NUM]; |
| 156 | |
| 157 | // FSM for USB data path |
| 158 | ufpm_usb_state_e ufpm_usb_sm; |
| 159 | |
| 160 | // USB bus state |
| 161 | ufpm_bus_state_e ufpm_bus_state; |
| 162 | |
| 163 | // MPU information |
| 164 | ufpm_mpu_info_t ufpm_mpu_info; |
| 165 | |
| 166 | // USB EP cache table for mapping speed-up. ufpm_ep_mapping_cache_tlb[0][i] for EP IN, ufpm_ep_mapping_cache_tlb[1][i] for EP OUT |
| 167 | kal_uint8 ufpm_ep_mapping_cache_tlb[2][UFPM_USB_MAP_MAX_SIZE]; |
| 168 | |
| 169 | // L4C MSG flag |
| 170 | kal_bool is_l4c_msg; |
| 171 | |
| 172 | // L4C MSG source ID |
| 173 | kal_uint8 l4c_src_id; |
| 174 | |
| 175 | } ufpm_t; |
| 176 | |
| 177 | /************************************** |
| 178 | * L4C and UFPM Structure |
| 179 | **************************************/ |
| 180 | typedef struct _l4c_ufpm_activate_md_fast_path_req { |
| 181 | LOCAL_PARA_HDR |
| 182 | kal_uint8 mode; |
| 183 | kal_uint8 src_id; // l4c source ID |
| 184 | kal_uint8 reserved[2]; |
| 185 | } l4c_ufpm_activate_md_fast_path_req_struct; |
| 186 | |
| 187 | typedef struct _l4c_ufpm_enable_md_fast_path_req { |
| 188 | LOCAL_PARA_HDR |
| 189 | kal_uint8 mode; |
| 190 | kal_uint8 src_id; // l4c source ID |
| 191 | kal_uint8 reserved[2]; |
| 192 | } l4c_ufpm_enable_md_fast_path_req_struct; |
| 193 | |
| 194 | typedef struct _l4c_ufpm_deactivate_md_fast_path_req { |
| 195 | LOCAL_PARA_HDR |
| 196 | kal_uint8 mode; |
| 197 | kal_uint8 src_id; // l4c source ID |
| 198 | kal_uint8 reserved[2]; |
| 199 | } l4c_ufpm_deactivate_md_fast_path_req_struct; |
| 200 | |
| 201 | typedef struct _l4c_ufpm_disable_md_fast_path_req { |
| 202 | LOCAL_PARA_HDR |
| 203 | kal_uint8 mode; |
| 204 | kal_uint8 src_id; // l4c source ID |
| 205 | kal_uint8 reserved[2]; |
| 206 | } l4c_ufpm_disable_md_fast_path_req_struct; |
| 207 | |
| 208 | typedef struct _l4c_ufpm_deactivate_md_fast_path_cnf{ |
| 209 | LOCAL_PARA_HDR |
| 210 | kal_uint8 mode; |
| 211 | kal_uint8 result; // bool |
| 212 | kal_uint8 src_id; // l4c source ID |
| 213 | kal_uint8 reserved[1]; |
| 214 | } l4c_ufpm_deactivate_md_fast_path_cnf_struct; |
| 215 | |
| 216 | typedef struct _l4c_ufpm_activate_md_fast_path_cnf{ |
| 217 | LOCAL_PARA_HDR |
| 218 | kal_uint8 mode; |
| 219 | kal_uint8 result; // bool |
| 220 | kal_uint8 src_id; // l4c source ID |
| 221 | kal_uint8 reserved[1]; |
| 222 | } l4c_ufpm_activate_md_fast_path_cnf_struct; |
| 223 | |
| 224 | typedef struct _l4c_ufpm_disable_md_fast_path_cnf{ |
| 225 | LOCAL_PARA_HDR |
| 226 | kal_uint8 mode; |
| 227 | kal_uint8 result; // bool |
| 228 | kal_uint8 src_id; // l4c source ID |
| 229 | kal_uint8 reserved[1]; |
| 230 | } l4c_ufpm_disable_md_fast_path_cnf_struct; |
| 231 | |
| 232 | typedef struct _l4c_ufpm_enable_md_fast_path_cnf{ |
| 233 | LOCAL_PARA_HDR |
| 234 | kal_uint8 mode; |
| 235 | kal_uint8 result; // bool |
| 236 | kal_uint8 src_id; // l4c source ID |
| 237 | kal_uint8 reserved[1]; |
| 238 | } l4c_ufpm_enable_md_fast_path_cnf_struct; |
| 239 | |
| 240 | #endif // _UFPM_STRUCT_H |
| 241 | |