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) 2010 |
| 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 | * dcl_pfc.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * Header file of DCL (Driver Common Layer) for PFC. |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * |
| 53 | * Ansel Liao |
| 54 | * |
| 55 | *============================================================================ |
| 56 | * HISTORY |
| 57 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 58 | *------------------------------------------------------------------------------ |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * removed! |
| 74 | * |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * removed! |
| 82 | * |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * removed! |
| 86 | * |
| 87 | *------------------------------------------------------------------------------ |
| 88 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 89 | *============================================================================ |
| 90 | ****************************************************************************/ |
| 91 | |
| 92 | #ifdef DCL_DEFINITION_STRUCT |
| 93 | #ifndef __DCL_PFC_H_STRUCT__ |
| 94 | #define __DCL_PFC_H_STRUCT__ |
| 95 | |
| 96 | /******************************************************************************* |
| 97 | * DCL_OPTIONS for PFC |
| 98 | *******************************************************************************/ |
| 99 | #define PFC_OPTIONS |
| 100 | |
| 101 | /******************************************************************************* |
| 102 | * DCL_CONFIGURE_T for PFC |
| 103 | *******************************************************************************/ |
| 104 | #define PFC_CONFIGS |
| 105 | |
| 106 | /******************************************************************************* |
| 107 | * DCL_EVENT for PFC |
| 108 | *******************************************************************************/ |
| 109 | #define PFC_EVENTS |
| 110 | |
| 111 | /******************************************************************************* |
| 112 | * PPP_PFC_CHANNEL enum for PFC |
| 113 | *******************************************************************************/ |
| 114 | typedef enum { |
| 115 | PPP_PFC_CHANNEL_0 = 0, |
| 116 | PPP_PFC_CHANNEL_1, |
| 117 | PPP_PFC_CHANNEL_2, |
| 118 | } PPP_PFC_CHANNEL; |
| 119 | |
| 120 | /******************************************************************************* |
| 121 | * PPP_PFC_CHANNEL enum for PFC |
| 122 | *******************************************************************************/ |
| 123 | typedef enum { |
| 124 | PFC_ENCODE = 0, |
| 125 | PFC_DECODE, |
| 126 | } PFC_OPERATION_SEL_T; |
| 127 | |
| 128 | /******************************************************************************* |
| 129 | * DCL_CTRL_CMD for PFC |
| 130 | *******************************************************************************/ |
| 131 | /* The PFC Command Values in DCL_CTRL_CMD_T Enum of dcl.h */ |
| 132 | #ifdef __BUILD_DOM__ |
| 133 | typedef enum { |
| 134 | PFC_CMD_RESET, /* To Reset PFC */ |
| 135 | PFC_CMD_SET_CONFIG, /* to set config */ |
| 136 | PFC_CMD_ENCODE, /* To Encode PPP Framer */ |
| 137 | PFC_CMD_DECODE, /* To Decode PPP Framer */ |
| 138 | PFC_CMD_DEQUEUE, /* to de-Q encode/decode gpd list */ |
| 139 | PFC_CMD_RELOAD_RX /* to reload GPD list */ |
| 140 | } DCL_CTRL_CMD_T; |
| 141 | #else /* __BUILD_DOM__ */ |
| 142 | #define PFC_CMDS \ |
| 143 | PFC_CMD_RESET, \ |
| 144 | PFC_CMD_SET_CONFIG, \ |
| 145 | PFC_CMD_ENCODE, \ |
| 146 | PFC_CMD_DECODE, \ |
| 147 | PFC_CMD_DEQUEUE, \ |
| 148 | PFC_CMD_RELOAD_RX, |
| 149 | #endif /* __BUILD_DOM__ */ |
| 150 | |
| 151 | /******************************************************************************* |
| 152 | * DCL_CTRL_DATA_T: Define the Control data structure for each module's command |
| 153 | *******************************************************************************/ |
| 154 | |
| 155 | /* For PFC_CMD_RESET command. */ |
| 156 | typedef struct |
| 157 | { |
| 158 | DCL_UINT32 en_de; /* input: encode or decode */ |
| 159 | DCL_UINT32 channel; /* input: channel id */ |
| 160 | } PFC_CTRL_RESET_T; |
| 161 | |
| 162 | /* For PFC_CMD_SET_CONFIG command. */ |
| 163 | typedef struct |
| 164 | { |
| 165 | DCL_UINT32 en_de; /* input: encode or decode */ |
| 166 | DCL_UINT32 channel; /* input: channel id */ |
| 167 | DCL_BOOL f32; /* input: fcs mode */ |
| 168 | DCL_BOOL acfc; /* input: address and control field compression */ |
| 169 | DCL_BOOL pfc; /* input: protocol field compression */ |
| 170 | DCL_UINT16 max_pkt_sz; /* input: max packet size */ |
| 171 | DCL_UINT16 ptc; /* input: pfc protocol */ |
| 172 | DCL_UINT32 pfc_accm[7]; /* input: accm 0 ~ 6 */ |
| 173 | } PFC_CTRL_SET_CONFIG_T; |
| 174 | |
| 175 | /* For PFC_CMD_ENCODE command. */ |
| 176 | typedef struct |
| 177 | { |
| 178 | DCL_UINT32 channel; /* input: channel id */ |
| 179 | void *head; /* input: head of TGPD list */ |
| 180 | void *tail; /* input: tail of TGPD list */ |
| 181 | } PFC_CTRL_ENCODE_T; |
| 182 | |
| 183 | /* For PFC_CMD_DECODE command. */ |
| 184 | typedef struct |
| 185 | { |
| 186 | DCL_UINT32 channel; /* input: channel id */ |
| 187 | void *head; /* input: head of TGPD list */ |
| 188 | void *tail; /* input: tail of TGPD list */ |
| 189 | } PFC_CTRL_DECODE_T; |
| 190 | |
| 191 | /* For PFC_CMD_DEQUEUE command. */ |
| 192 | typedef struct |
| 193 | { |
| 194 | DCL_UINT32 en_de; /* input: encode or decode */ |
| 195 | DCL_UINT32 channel; /* input: channel id */ |
| 196 | void **head; /* output: head of RGPD list */ |
| 197 | void **tail; /* output: tail of RGPD list */ |
| 198 | DCL_UINT32 *queue_len; /* output: length of queue */ |
| 199 | } PFC_CTRL_DEQUEUE_T; |
| 200 | |
| 201 | /* For PFC_CMD_RELOAD_RX command. */ |
| 202 | typedef struct |
| 203 | { |
| 204 | DCL_UINT32 en_de; /* input: encode or decode */ |
| 205 | DCL_UINT32 channel; /* input: channel id */ |
| 206 | void *head; /* input: head of RGPD list */ |
| 207 | void *tail; /* input: tail of RGPD list */ |
| 208 | DCL_UINT32 queue_len; /* input: length of RGPD list */ |
| 209 | } PFC_CTRL_RELOAD_RX_T; |
| 210 | |
| 211 | /* The PFC Command Parameter Data Structure for Each Command in DCL_CTRL_DATA_T Enum of dcl.h */ |
| 212 | #ifdef __BUILD_DOM__ |
| 213 | typedef union |
| 214 | { |
| 215 | PFC_CTRL_RESET_T r_pfc_ctrl_reset; /* Data Structure for PFC_CMD_RESET */ |
| 216 | PFC_CTRL_SET_CONFIG_T r_pfc_ctrl_set_config; /* Data Structure for PFC_CMD_SET_CONFIG */ |
| 217 | PFC_CTRL_ENCODE_T r_pfc_ctrl_encode; /* Data Structure for PFC_CMD_ENCODE */ |
| 218 | PFC_CTRL_DECODE_T r_pfc_ctrl_decode; /* Data Structure for PFC_CMD_DECODE */ |
| 219 | PFC_CTRL_DEQUEUE_T r_pfc_ctrl_dequeue; /* Data Structure for PFC_CMD_DEQUEUE */ |
| 220 | PFC_CTRL_RELOAD_RX_T r_pfc_ctrl_reload_rx; /* Data Structure for PFC_CMD_RELOAD_RX */ |
| 221 | } DCL_CTRL_DATA_T; |
| 222 | #else /* __BUILD_DOM__ */ |
| 223 | #define PFC_CTRLS \ |
| 224 | PFC_CTRL_RESET_T r_pfc_ctrl_reset; \ |
| 225 | PFC_CTRL_SET_CONFIG_T r_pfc_ctrl_set_config; \ |
| 226 | PFC_CTRL_ENCODE_T r_pfc_ctrl_encode; \ |
| 227 | PFC_CTRL_DECODE_T r_pfc_ctrl_decode; \ |
| 228 | PFC_CTRL_DEQUEUE_T r_pfc_ctrl_dequeue; \ |
| 229 | PFC_CTRL_RELOAD_RX_T r_pfc_ctrl_reload_rx; |
| 230 | #endif /* __BUILD_DOM__ */ |
| 231 | |
| 232 | #endif // #ifndef __DCL_PFC_H_STRUCT__ |
| 233 | #endif // #ifdef DCL_DEFINITION_STRUCT |
| 234 | |
| 235 | #ifdef DCL_DEFINITION_PROTOTYPE |
| 236 | #ifndef __DCL_PFC_H_PROTOTYPE__ |
| 237 | #define __DCL_PFC_H_PROTOTYPE__ |
| 238 | |
| 239 | |
| 240 | /************************************************************************* |
| 241 | * FUNCTION |
| 242 | * DclPFC_Initialize |
| 243 | * |
| 244 | * DESCRIPTION |
| 245 | * This function is to initialize PFC module |
| 246 | * |
| 247 | * PARAMETERS |
| 248 | * None |
| 249 | * |
| 250 | * RETURNS |
| 251 | * Return the status of DclPFC_Initialize |
| 252 | * |
| 253 | * RETURN VALUES |
| 254 | * STATUS_OK: Initialize Finished |
| 255 | * |
| 256 | *************************************************************************/ |
| 257 | extern DCL_STATUS DclPFC_Initialize(void); |
| 258 | /************************************************************************* |
| 259 | * FUNCTION |
| 260 | * DclPFC_Open |
| 261 | * |
| 262 | * DESCRIPTION |
| 263 | * This function is to open the PFC module and return a handle |
| 264 | * |
| 265 | * PARAMETERS |
| 266 | * dev: [IN] Only valid for DCL_PFC |
| 267 | * flags: [IN] No sepcial flags is needed. Please use FLAGS_NONE |
| 268 | * |
| 269 | * RETURNS |
| 270 | * Return DCL_HANDLE of PFC |
| 271 | * |
| 272 | * RETURN VALUES |
| 273 | * DCL_HANDLE_INVALID : Open failed |
| 274 | * Other value : A valid handle |
| 275 | * |
| 276 | *************************************************************************/ |
| 277 | extern DCL_HANDLE DclPFC_Open(DCL_DEV dev, DCL_FLAGS flags); |
| 278 | /************************************************************************* |
| 279 | * FUNCTION |
| 280 | * DclPFC_ReadData |
| 281 | * |
| 282 | * DESCRIPTION |
| 283 | * This function is not supported for the PFC module now. |
| 284 | * |
| 285 | * PARAMETERS |
| 286 | * N/A |
| 287 | * |
| 288 | * RETURNS |
| 289 | * STATUS_UNSUPPORTED |
| 290 | * |
| 291 | *************************************************************************/ |
| 292 | extern DCL_STATUS DclPFC_ReadData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN *buf_len, DCL_OPTIONS options); |
| 293 | /************************************************************************* |
| 294 | * FUNCTION |
| 295 | * DclPFC_WriteData |
| 296 | * |
| 297 | * DESCRIPTION |
| 298 | * This function is not supported for the PFC module now. |
| 299 | * |
| 300 | * PARAMETERS |
| 301 | * N/A |
| 302 | * |
| 303 | * RETURNS |
| 304 | * STATUS_UNSUPPORTED |
| 305 | * |
| 306 | *************************************************************************/ |
| 307 | extern DCL_STATUS DclPFC_WriteData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN *buf_len, DCL_OPTIONS options); |
| 308 | /************************************************************************* |
| 309 | * FUNCTION |
| 310 | * DclPFC_Configure |
| 311 | * |
| 312 | * DESCRIPTION |
| 313 | * This function is not supported for the PFC module now. |
| 314 | * |
| 315 | * PARAMETERS |
| 316 | * N/A |
| 317 | * |
| 318 | * RETURNS |
| 319 | * STATUS_UNSUPPORTED |
| 320 | * |
| 321 | *************************************************************************/ |
| 322 | extern DCL_STATUS DclPFC_Configure(DCL_HANDLE handle, DCL_CONFIGURE_T *configure); |
| 323 | /************************************************************************* |
| 324 | * FUNCTION |
| 325 | * DclPFC_RegisterCallback |
| 326 | * |
| 327 | * DESCRIPTION |
| 328 | * This function is to set callback function for the PFC module. |
| 329 | * |
| 330 | * PARAMETERS |
| 331 | * handle: the returned handle value of DclPFC_Open |
| 332 | * event: Supported events: |
| 333 | * callback: the callback function for registered events |
| 334 | * |
| 335 | * RETURNS |
| 336 | * STATUS_OK: Successfully register the callback function. |
| 337 | * STATUS_INVALID_DCL_HANDLE: It's a invalid handle. |
| 338 | * STATUS_NOT_OPENED: The module has not been opened. |
| 339 | * STATUS_INVALID_EVENT: The event parameter is invalid. |
| 340 | * |
| 341 | *************************************************************************/ |
| 342 | extern DCL_STATUS DclPFC_RegisterCallback(DCL_HANDLE handle, DCL_EVENT event, PFN_DCL_CALLBACK callback); |
| 343 | /************************************************************************* |
| 344 | * FUNCTION |
| 345 | * DclPFC_Control |
| 346 | * |
| 347 | * DESCRIPTION |
| 348 | * This function is to send command to control the PFC module. |
| 349 | * |
| 350 | * PARAMETERS |
| 351 | * handle: [IN] The handle value returned from DclPFC_Open |
| 352 | * cmd: [IN] A control command for PFC module |
| 353 | * 1. PFC_CMD_RESET: to reset PFC Module |
| 354 | * 2. PFC_CMD_ENCODE: to Encode |
| 355 | * 3. PFC_CMD_DECODE: to Decode |
| 356 | * |
| 357 | * data: [IN] The data of the control command |
| 358 | * 1. PFC_CMD_RESET: pointer to a PFC_CTRL_RESET_T structure |
| 359 | * 2. PFC_CMD_ENCODE: pointer to a PFC_CTRL_ENCODE_T structure |
| 360 | * 3. PFC_CMD_DECODE: pointer to a PFC_CTRL_DECODE_T structure |
| 361 | * |
| 362 | * RETURNS |
| 363 | * Return the status of DclPFC_Control |
| 364 | * |
| 365 | * RETURN VALUES |
| 366 | * STATUS_OK: Command is executed successfully. |
| 367 | * STATUS_FAIL: Command is failed. |
| 368 | * STATUS_INVALID_CMD: It's a invalid command. |
| 369 | * |
| 370 | *************************************************************************/ |
| 371 | extern DCL_STATUS DclPFC_Control(DCL_HANDLE handle, DCL_CTRL_CMD cmd, DCL_CTRL_DATA_T *data); |
| 372 | /************************************************************************* |
| 373 | * FUNCTION |
| 374 | * DclPFC_Close |
| 375 | * |
| 376 | * DESCRIPTION |
| 377 | * This function is to close the PFC module. |
| 378 | * |
| 379 | * PARAMETERS |
| 380 | * handle: [IN] The returned handle value of DclPFC_Open |
| 381 | * |
| 382 | * RETURNS |
| 383 | * Return the status of DclPFC_Close |
| 384 | * |
| 385 | * RETURN VALUES |
| 386 | * STATUS_OK |
| 387 | * |
| 388 | *************************************************************************/ |
| 389 | extern DCL_STATUS DclPFC_Close(DCL_HANDLE handle); |
| 390 | |
| 391 | // MoDIS parser skip end |
| 392 | |
| 393 | #endif // #ifndef __DCL_PFC_H_PROTOTYPE__ |
| 394 | #endif // #ifdef DCL_DEFINITION_PROTOTYPE |