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) 2001 |
| 8 | * |
| 9 | *****************************************************************************/ |
| 10 | |
| 11 | /***************************************************************************** |
| 12 | * |
| 13 | * Filename: |
| 14 | * --------- |
| 15 | * dcl_adc.h |
| 16 | * |
| 17 | * Project: |
| 18 | * -------- |
| 19 | * Maui |
| 20 | * |
| 21 | * Description: |
| 22 | * ------------ |
| 23 | * Header file of DCL (Driver Common Layer) for ADC. |
| 24 | * |
| 25 | * Author: |
| 26 | * ------- |
| 27 | * ------- |
| 28 | * |
| 29 | *============================================================================ |
| 30 | * HISTORY |
| 31 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 32 | *------------------------------------------------------------------------------ |
| 33 | * removed! |
| 34 | * removed! |
| 35 | * removed! |
| 36 | * |
| 37 | * removed! |
| 38 | * removed! |
| 39 | * removed! |
| 40 | * |
| 41 | * removed! |
| 42 | * removed! |
| 43 | * removed! |
| 44 | * |
| 45 | * removed! |
| 46 | * removed! |
| 47 | * removed! |
| 48 | * |
| 49 | * removed! |
| 50 | * removed! |
| 51 | * removed! |
| 52 | * |
| 53 | * removed! |
| 54 | * removed! |
| 55 | * removed! |
| 56 | * |
| 57 | * removed! |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * |
| 61 | * removed! |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * |
| 65 | * removed! |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * |
| 69 | * removed! |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * |
| 73 | * removed! |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * |
| 77 | * removed! |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * |
| 81 | * removed! |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * |
| 85 | * removed! |
| 86 | * removed! |
| 87 | * removed! |
| 88 | * |
| 89 | * removed! |
| 90 | * removed! |
| 91 | * removed! |
| 92 | * |
| 93 | * removed! |
| 94 | * removed! |
| 95 | * removed! |
| 96 | * |
| 97 | * removed! |
| 98 | * removed! |
| 99 | * removed! |
| 100 | * |
| 101 | * removed! |
| 102 | * removed! |
| 103 | * removed! |
| 104 | * |
| 105 | * removed! |
| 106 | * removed! |
| 107 | * removed! |
| 108 | * |
| 109 | * removed! |
| 110 | * removed! |
| 111 | * removed! |
| 112 | * |
| 113 | * removed! |
| 114 | * removed! |
| 115 | * removed! |
| 116 | * |
| 117 | * removed! |
| 118 | * removed! |
| 119 | * removed! |
| 120 | * |
| 121 | *------------------------------------------------------------------------------ |
| 122 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 123 | *============================================================================ |
| 124 | ****************************************************************************/ |
| 125 | #ifdef DCL_DEFINITION_STRUCT |
| 126 | #ifndef __DCL_ADC_H_STRUCT__ |
| 127 | #define __DCL_ADC_H_STRUCT__ |
| 128 | |
| 129 | #define DCL_ADC_ERR_CHANNEL_NO 50 |
| 130 | /******************************************************************************* |
| 131 | * DCL_OPTIONS for ADC |
| 132 | *******************************************************************************/ |
| 133 | #define ADC_OPTIONS |
| 134 | |
| 135 | /******************************************************************************* |
| 136 | * DCL_CONFIGURE_T for ADC |
| 137 | *******************************************************************************/ |
| 138 | |
| 139 | #define ADC_CONFIGS |
| 140 | |
| 141 | /******************************************************************************* |
| 142 | * DCL_EVENT for ADC |
| 143 | *******************************************************************************/ |
| 144 | #define ADC_EVENTS |
| 145 | |
| 146 | /******************************************************************************* |
| 147 | * DCL_CTRL_CMD for ADC |
| 148 | *******************************************************************************/ |
| 149 | #define ADC_CMDS \ |
| 150 | ADC_CMD_CREATE_OBJECT, \ |
| 151 | ADC_CMD_MODIFY_PARAM, \ |
| 152 | ADC_CMD_START_MEASURE, \ |
| 153 | ADC_CMD_STOP_MEASURE, \ |
| 154 | ADC_CMD_SET_TIMER_PAGE_ALIGN, \ |
| 155 | ADC_CMD_REGISTER_MEASURE_CB, \ |
| 156 | ADC_CMD_REGISTER_COMPLETE_CB, \ |
| 157 | ADC_CMD_GET_CHANNEL, \ |
| 158 | ADC_CMD_SCHE_ID_GET_HANDLE, \ |
| 159 | ADC_CMD_TRANSFORM_INTO_VOLT, \ |
| 160 | ADC_CMD_TRANSFORM_INTO_TEMP, \ |
| 161 | ADC_CMD_TRANSFORM_INTO_CURR, \ |
| 162 | ADC_CMD_GET_SCHEDULER_PARAMETER, \ |
| 163 | ADC_CMD_SET_CALIBRATION_DATA, \ |
| 164 | ADC_CMD_READ_CALIBRATION_DATA, \ |
| 165 | ADC_CMD_READ_CALIBRATION_INFORM_IN_USBBOOT, \ |
| 166 | ADC_CMD_SET_MULTI_CHANNEL_READ, |
| 167 | |
| 168 | #define HADC_CMDS \ |
| 169 | ADC_CMD_IMM_MEASURE, \ |
| 170 | ADC_CMD_SYNC_MEASURE, \ |
| 171 | ADC_CMD_TDMA_SYNC_SETUP, \ |
| 172 | ADC_CMD_POWER, \ |
| 173 | ADC_CMD_GET_DATA_2_META, \ |
| 174 | ADC_CMD_GET_DATA, \ |
| 175 | ADC_CMD_GET_META_DATA, \ |
| 176 | ADC_CMD_GET_MAX_PHYSICAL_CH, \ |
| 177 | ADC_CMD_GET_IMM_DATA_ON_BOOTING, \ |
| 178 | ADC_CMD_GET_TEMP, \ |
| 179 | ADC_CMD_GET_PHYSICAL_CHANNEL, |
| 180 | |
| 181 | /******************************************************************************* |
| 182 | * DCL_CTRL_DATA_T: Define the Control data structure for each module's command |
| 183 | *******************************************************************************/ |
| 184 | /* For ADC_CMD_CREATE_OBJECT command. */ |
| 185 | typedef struct |
| 186 | { |
| 187 | DCL_UINT32 u4Period; // Measurement period (Uint is in Tick) |
| 188 | DCL_UINT32 u4Sapid; |
| 189 | DCL_UINT8 u1OwnerId; // Indicate the module to for ADC driver to notify the result |
| 190 | DCL_UINT8 u1AdcChannel; // To be measured physical ADC channel |
| 191 | DCL_UINT8 u1EvaluateCount; // Measurement count |
| 192 | DCL_BOOL fgSendPrimitive; // Whether to send message to owner module or NOT |
| 193 | } ADC_CTRL_CREATE_OBJECT_T; |
| 194 | |
| 195 | /* For ADC_CMD_MODIFY_PARAM command. */ |
| 196 | typedef struct |
| 197 | { |
| 198 | DCL_UINT32 u4Period; // Measurement period (Uint is in Tick) |
| 199 | DCL_UINT8 u1EvaluateCount; // Measurement count |
| 200 | } ADC_CTRL_MODIFY_PARAM_T; |
| 201 | /* For ADC_CMD_START_MEASURE command. */ |
| 202 | // ADC_CMD_START_MEASURE does NOT need parameters |
| 203 | /* For ADC_CMD_STOP_MEASURE command. */ |
| 204 | // ADC_CMD_STOP_MEASURE does NOT need parameters |
| 205 | /* For ADC_CMD_IMM_MEASURE command. */ |
| 206 | typedef struct |
| 207 | { |
| 208 | DCL_UINT16 u2Channel; // The channel to be measured |
| 209 | DCL_UINT16 u2ADCValue; // Measured ADC value |
| 210 | } ADC_CTRL_IMM_MEASURE_T; |
| 211 | /* For ADC_CMD_SYNC_MEASURE command. */ |
| 212 | typedef struct |
| 213 | { |
| 214 | DCL_UINT16 u2Channel; // The channel to be measured |
| 215 | DCL_UINT16 u2ADCValue; // Measured ADC value |
| 216 | } ADC_CTRL_SYNC_MEASURE_T; |
| 217 | /* For ADC_CMD_TDMA_SYNC_SETUP command. */ |
| 218 | typedef struct |
| 219 | { |
| 220 | DCL_UINT16 u2Event0; // Event 0 |
| 221 | DCL_UINT16 u2Event1; // Event 1 |
| 222 | } ADC_CTRL_TDMA_SYNC_SETUP_T; |
| 223 | /* For ADC_CMD_POWER command. */ |
| 224 | typedef struct |
| 225 | { |
| 226 | DCL_BOOL fgEnable; // TRUE: Power on ADC module, FALSE: Power off ADC module |
| 227 | } ADC_CTRL_POWER_T; |
| 228 | |
| 229 | /* For ADC_CMD_GET_DATA_2_META command. */ |
| 230 | typedef struct |
| 231 | { |
| 232 | DCL_UINT8 u1Channel; //measure physical channel |
| 233 | DCL_UINT16 u2MeaCount; //the counts of measurement |
| 234 | DCL_UINT32 u4ADCData; //return ADC value |
| 235 | } ADC_CTRL_GET_DATA_2_META_T; |
| 236 | |
| 237 | /* For ADC_CMD_GET_DATA command. */ |
| 238 | typedef struct |
| 239 | { |
| 240 | DCL_UINT8 u1Channel; //measure physical channel |
| 241 | DCL_UINT32 u4ADCData; //return ADC value |
| 242 | } ADC_CTRL_GET_DATA_T; |
| 243 | |
| 244 | /* For ADC_CMD_GET_META_DATA command. */ |
| 245 | typedef struct |
| 246 | { |
| 247 | DCL_UINT8 u1Channel; //measure physical channel |
| 248 | DCL_UINT16 u2MeaCount; //the counts of measurement |
| 249 | DCL_UINT32 u4ADCData; //return ADC value |
| 250 | } ADC_CTRL_GET_META_DATA_T; |
| 251 | |
| 252 | /* For ADC_CMD_GET_IMM_DATA_ON_BOOTING command. */ |
| 253 | typedef struct |
| 254 | { |
| 255 | DCL_UINT32 u4Channel; // Measure physical channel |
| 256 | DCL_UINT32 u4MeaCount; // The counts of measurement |
| 257 | DCL_UINT16 *u2ADCData; // Store ADC Value |
| 258 | } ADC_CTRL_GET_IMM_DATA_ON_BOOTING_T; |
| 259 | |
| 260 | /* For ADC_CMD_GET_TEMP command. */ |
| 261 | typedef struct |
| 262 | { |
| 263 | DCL_UINT16 u2Channel; |
| 264 | DCL_INT16 i2Temp; /* Signed integer for temperature show */ |
| 265 | } ADC_CTRL_GET_TEMP_T; |
| 266 | |
| 267 | //ADC_CMD_SET_TIMER_PAGE_ALIGN |
| 268 | typedef struct |
| 269 | { |
| 270 | DCL_BOOL fgPageAlign; // TRUE: set stack timer page alignment |
| 271 | } ADC_CTRL_TIMER_ALIGN_T; |
| 272 | |
| 273 | //ADC_CMD_GET_CHANNEL |
| 274 | typedef enum { |
| 275 | DCL_VBAT_ADC_CHANNEL = 0, |
| 276 | DCL_VISENSE_ADC_CHANNEL, |
| 277 | DCL_VBATTMP_ADC_CHANNEL, |
| 278 | DCL_BATTYPE_ADC_CHANNEL, |
| 279 | DCL_VCHARGER_ADC_CHANNEL, |
| 280 | DCL_PCBTMP_ADC_CHANNEL, |
| 281 | DCL_AUX_ADC_CHANNEL, |
| 282 | DCL_CHR_USB_ADC_CHANNEL, |
| 283 | DCL_OTG_VBUS_ADC_CHANNEL, |
| 284 | DCL_RFTMP_ADC_CHANNEL, |
| 285 | DCL_MDTMP_ADC_CHANNEL, |
| 286 | DCL_PMICTMP_ADC_CHANNEL, |
| 287 | DCL_MAX_ADC_CHANNEL |
| 288 | } DCL_ADC_CHANNEL_TYPE_ENUM; |
| 289 | |
| 290 | typedef struct |
| 291 | { |
| 292 | DCL_UINT8 u1AdcPhyCh; |
| 293 | DCL_UINT16 u2AdcName; |
| 294 | } ADC_CTRL_GET_PHYSICAL_CHANNEL_T; |
| 295 | |
| 296 | //ADC_CMD_TRANSFORM_INTO_VOLT |
| 297 | typedef struct |
| 298 | { |
| 299 | DCL_DOUBLE d8AdcValue; |
| 300 | DCL_UINT32 u4Volt; |
| 301 | DCL_UINT8 u1AdcPhyCh; |
| 302 | } ADC_CTRL_TRANSFORM_INTO_VOLT_T; |
| 303 | |
| 304 | //ADC_CMD_TRANSFORM_INTO_TEMP |
| 305 | typedef struct |
| 306 | { |
| 307 | DCL_UINT32 u4Volt; |
| 308 | DCL_UINT32 u4Temp; |
| 309 | } ADC_CTRL_TRANSFORM_INTO_TEMP_T; |
| 310 | |
| 311 | //ADC_CMD_TRANSFORM_INTO_CURR |
| 312 | typedef struct |
| 313 | { |
| 314 | DCL_UINT32 u4Volt; |
| 315 | DCL_UINT32 u4Curr; |
| 316 | } ADC_CTRL_TRANSFORM_INTO_CURR_T; |
| 317 | |
| 318 | //typedef void (*PFN_DCLSADC_MEASURE_CALLBACK)(DCL_INT32 handle); |
| 319 | //ADC_CMD_REGISTER_MEASURE_CB |
| 320 | typedef struct |
| 321 | { |
| 322 | kal_timer_func_ptr pfMeasure_cb; |
| 323 | } ADC_CTRL_REGISTER_MEASURE_CB_T; |
| 324 | |
| 325 | typedef void (*PFN_DCLSADC_COMPLETE_CALLBACK)(DCL_INT32 handle, DCL_INT32 volt_result, DCL_DOUBLE adc_result); |
| 326 | typedef void (*PFN_DCLSADC_COMPLETE_MULTI_CALLBACK)(DCL_INT32 handle, DCL_INT32 *volt_array_result, DCL_DOUBLE *adc_array_result); |
| 327 | //ADC_CMD_REGISTER_COMPLETE_CB; |
| 328 | typedef struct |
| 329 | { |
| 330 | PFN_DCLSADC_COMPLETE_CALLBACK pfComplete_cb; |
| 331 | } ADC_CTRL_REGISTER_COMPLETE_CB_T; |
| 332 | |
| 333 | typedef struct |
| 334 | { |
| 335 | PFN_DCLSADC_COMPLETE_MULTI_CALLBACK pfComplete_cb; |
| 336 | } ADC_CTRL_REGISTER_COMPLETE_MULTI_CB_T; |
| 337 | |
| 338 | |
| 339 | //ADC_CMD_GET_SCHEDULER_PARAMETER |
| 340 | typedef struct{ |
| 341 | DCL_UINT32 u4Ownerid; |
| 342 | DCL_UINT32 u4Sapid; |
| 343 | DCL_UINT32 u4Period; |
| 344 | DCL_UINT8 u1Adc_phy_id; |
| 345 | DCL_UINT8 u1Adc_logic_id; |
| 346 | DCL_UINT8 u1Evaluate_count; /*how many to average*/ |
| 347 | DCL_BOOL bSend_primitive; |
| 348 | DCL_BOOL bConti_measure; |
| 349 | DCL_UINT32 u4Adc_sche_event_id; |
| 350 | void (*complete)(DCL_INT32 adc_handle, DCL_INT32 volt_result, DCL_DOUBLE adc_result);/*callback for upper layer*/ |
| 351 | }DCL_ADC_SCHEDULER_PARA_T; |
| 352 | typedef struct |
| 353 | { |
| 354 | DCL_UINT32 u4Handle; |
| 355 | DCL_ADC_SCHEDULER_PARA_T pPara; |
| 356 | } ADC_CTRL_GET_SCHEDULER_PARAMETER_T; |
| 357 | |
| 358 | //ADC_CMD_GET_MAX_PHYSICAL_CH |
| 359 | typedef struct |
| 360 | { |
| 361 | DCL_UINT32 u4Adc_max_ch; |
| 362 | } ADC_CTRL_GET_MAX_PHYSICAL_CH_T; |
| 363 | |
| 364 | //ADC_CMD_SET_CALIBRATION_DATA: |
| 365 | typedef struct |
| 366 | { |
| 367 | void *ilm_ptr; |
| 368 | }ADC_CTRL_SET_CALIBRATION_DATA_T; |
| 369 | |
| 370 | //ADC_CMD_READ_CALIBRATION_DATA |
| 371 | typedef struct |
| 372 | { |
| 373 | DCL_INT32 i4ADCSlope[16]; //we do not want to include adc_hw.h here |
| 374 | DCL_INT32 i4ADCOffset[16]; //use 16 instead of ADC_MAX_CHANNEL |
| 375 | }ADC_CTRL_READ_CALIBRATION_DATA_T; |
| 376 | |
| 377 | //ADC_CMD_SCHE_ID_GET_HANDLE |
| 378 | typedef struct{ |
| 379 | DCL_UINT32 u4Handle; |
| 380 | DCL_UINT32 u4Adc_sche_id; |
| 381 | }DCL_CTRL_SCHE_ID_GET_HANDLE_T; |
| 382 | |
| 383 | typedef struct{ |
| 384 | DCL_UINT8 bEnable; |
| 385 | DCL_UINT8 *u4ADC_ch_number; |
| 386 | DCL_UINT8 u4Adc_max_ch_number; |
| 387 | PFN_DCLSADC_COMPLETE_MULTI_CALLBACK complete_multi_cb; |
| 388 | }DCL_MULTI_CHANNEL_PARA_T; |
| 389 | |
| 390 | #define ADC_CTRLS \ |
| 391 | ADC_CTRL_CREATE_OBJECT_T rADCCreateObj; \ |
| 392 | ADC_CTRL_MODIFY_PARAM_T rADCModifyParam; \ |
| 393 | ADC_CTRL_IMM_MEASURE_T rADCImmMeasure; \ |
| 394 | ADC_CTRL_SYNC_MEASURE_T rADCSyncMeasure; \ |
| 395 | ADC_CTRL_TDMA_SYNC_SETUP_T rADCTDMASyncSetup; \ |
| 396 | ADC_CTRL_POWER_T rADCPower; \ |
| 397 | ADC_CTRL_TIMER_ALIGN_T rADCTimerAlign; \ |
| 398 | ADC_CTRL_REGISTER_MEASURE_CB_T rADCRegisterMeasureCB; \ |
| 399 | ADC_CTRL_REGISTER_COMPLETE_CB_T rADCRegisterCompleteCB; \ |
| 400 | ADC_CTRL_GET_PHYSICAL_CHANNEL_T rADCGetPhyChannel; \ |
| 401 | DCL_CTRL_SCHE_ID_GET_HANDLE_T rADCScheIdGetHandle; \ |
| 402 | ADC_CTRL_TRANSFORM_INTO_VOLT_T rADCTransformVolt; \ |
| 403 | ADC_CTRL_TRANSFORM_INTO_TEMP_T rADCTransformTemp; \ |
| 404 | ADC_CTRL_TRANSFORM_INTO_CURR_T rADCTransformCurr; \ |
| 405 | ADC_CTRL_GET_DATA_2_META_T rADCGetData2Meta; \ |
| 406 | ADC_CTRL_GET_DATA_T rADCGetData; \ |
| 407 | ADC_CTRL_GET_META_DATA_T rADCGetMetaData; \ |
| 408 | ADC_CTRL_GET_SCHEDULER_PARAMETER_T rGetSchedulerPara; \ |
| 409 | ADC_CTRL_GET_MAX_PHYSICAL_CH_T rADCGetMaxPhyCh; \ |
| 410 | ADC_CTRL_SET_CALIBRATION_DATA_T rSetCalibrationData; \ |
| 411 | ADC_CTRL_READ_CALIBRATION_DATA_T rReadCalibrationData; \ |
| 412 | ADC_CTRL_GET_IMM_DATA_ON_BOOTING_T rGetImmDataOnBooting; \ |
| 413 | ADC_CTRL_GET_TEMP_T rGetTempData; \ |
| 414 | DCL_MULTI_CHANNEL_PARA_T rMultiChannelPara; |
| 415 | #endif // #ifndef __DCL_ADC_H_STRUCT__ |
| 416 | #endif // #ifdef DCL_DEFINITION_STRUCT |
| 417 | |
| 418 | #ifdef DCL_DEFINITION_PROTOTYPE |
| 419 | #ifndef __DCL_ADC_H_PROTOTYPE__ |
| 420 | #define __DCL_ADC_H_PROTOTYPE__ |
| 421 | |
| 422 | /************************************************************************* |
| 423 | * FUNCTION |
| 424 | * DclSADC_Initialize |
| 425 | * |
| 426 | * DESCRIPTION |
| 427 | * This function is to initialize SW ADC module |
| 428 | * |
| 429 | * PARAMETERS |
| 430 | * None |
| 431 | * |
| 432 | * RETURNS |
| 433 | * STATUS_OK |
| 434 | * |
| 435 | *************************************************************************/ |
| 436 | extern DCL_STATUS DclSADC_Initialize(void); |
| 437 | /************************************************************************* |
| 438 | * FUNCTION |
| 439 | * DclSADC_Open |
| 440 | * |
| 441 | * DESCRIPTION |
| 442 | * This function is to open the SW ADC module and return a handle |
| 443 | * |
| 444 | * PARAMETERS |
| 445 | * dev: only valid for DCL_ADC |
| 446 | * flags: no sepcial flags is needed. Please use FLAGS_NONE |
| 447 | * |
| 448 | * RETURNS |
| 449 | * DCL_HANDLE_INVALID: Open failed |
| 450 | * Other value: A valid handle |
| 451 | * |
| 452 | *************************************************************************/ |
| 453 | extern DCL_HANDLE DclSADC_Open(DCL_DEV dev, DCL_FLAGS flags); |
| 454 | /************************************************************************* |
| 455 | * FUNCTION |
| 456 | * DclSADC_ReadData |
| 457 | * |
| 458 | * DESCRIPTION |
| 459 | * This function is not supported for the ADC module now. |
| 460 | * |
| 461 | * PARAMETERS |
| 462 | * N/A |
| 463 | * |
| 464 | * RETURNS |
| 465 | * STATUS_UNSUPPORTED |
| 466 | * |
| 467 | *************************************************************************/ |
| 468 | extern DCL_STATUS DclSADC_ReadData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN buf_len, DCL_OPTIONS options); |
| 469 | /************************************************************************* |
| 470 | * FUNCTION |
| 471 | * DclSADC_WriteData |
| 472 | * |
| 473 | * DESCRIPTION |
| 474 | * This function is not supported for the ADC module now. |
| 475 | * |
| 476 | * PARAMETERS |
| 477 | * N/A |
| 478 | * |
| 479 | * RETURNS |
| 480 | * STATUS_UNSUPPORTED |
| 481 | * |
| 482 | *************************************************************************/ |
| 483 | extern DCL_STATUS DclSADC_WriteData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN buf_len, DCL_OPTIONS options); |
| 484 | /************************************************************************* |
| 485 | * FUNCTION |
| 486 | * DclSADC_Configure |
| 487 | * |
| 488 | * DESCRIPTION |
| 489 | * This function is not supported for the ADC module now. |
| 490 | * |
| 491 | * PARAMETERS |
| 492 | * N/A |
| 493 | * |
| 494 | * RETURNS |
| 495 | * STATUS_UNSUPPORTED |
| 496 | * |
| 497 | *************************************************************************/ |
| 498 | extern DCL_STATUS DclSADC_Configure(DCL_HANDLE handle, DCL_CONFIGURE_T *configure); |
| 499 | /************************************************************************* |
| 500 | * FUNCTION |
| 501 | * DclSADC_RegisterCallback |
| 502 | * |
| 503 | * DESCRIPTION |
| 504 | * This function is not supported for the ADC module now. |
| 505 | * |
| 506 | * PARAMETERS |
| 507 | * N/A |
| 508 | * |
| 509 | * RETURNS |
| 510 | * STATUS_UNSUPPORTED |
| 511 | * |
| 512 | *************************************************************************/ |
| 513 | extern DCL_STATUS DclSADC_RegisterCallback(DCL_HANDLE handle, DCL_EVENT event, PFN_DCL_CALLBACK callback); |
| 514 | /************************************************************************* |
| 515 | * FUNCTION |
| 516 | * DclSADC_Control |
| 517 | * |
| 518 | * DESCRIPTION |
| 519 | * This function is to send command to control the SW ADC module. |
| 520 | * |
| 521 | * PARAMETERS |
| 522 | * handle: A valid handle return by DclSADC_Open() |
| 523 | * cmd: A control command for ADC module |
| 524 | * 1. ADC_CMD_CREATE_OBJECT: to create measurement object |
| 525 | * 2. ADC_CMD_MODIFY_PARAM: to change measurement parameters |
| 526 | * 3. ADC_CMD_START_MEASURE: to start measurement item |
| 527 | * 4. ADC_CMD_STOP_MEASURE: to stop measurement item |
| 528 | * data: The data of the control command |
| 529 | * 1. ADC_CMD_CREATE_OBJECT: pointer to a ADC_CTRL_CREATE_OBJECT_T structure |
| 530 | * 2. ADC_CMD_MODIFY_PARAM: pointer to a ADC_CTRL_MODIFY_PARAM_T structure |
| 531 | * 3. ADC_CMD_START_MEASURE: a null pointer |
| 532 | * 4. ADC_CMD_STOP_MEASURE: a null pointer |
| 533 | * |
| 534 | * RETURNS |
| 535 | * STATUS_OK: command is executed successfully. |
| 536 | * STATUS_FAIL: command is failed. |
| 537 | * STATUS_INVALID_CMD: It's a invalid command. |
| 538 | * |
| 539 | *************************************************************************/ |
| 540 | extern DCL_STATUS DclSADC_Control(DCL_HANDLE handle, DCL_CTRL_CMD cmd, DCL_CTRL_DATA_T *data); |
| 541 | /************************************************************************* |
| 542 | * FUNCTION |
| 543 | * DclSADC_Close |
| 544 | * |
| 545 | * DESCRIPTION |
| 546 | * This function is to close the SW ADC module. |
| 547 | * |
| 548 | * PARAMETERS |
| 549 | * handle: the returned handle value of DclSADC_Open |
| 550 | * |
| 551 | * RETURNS |
| 552 | * STATUS_OK |
| 553 | * |
| 554 | *************************************************************************/ |
| 555 | extern DCL_STATUS DclSADC_Close(DCL_HANDLE handle); |
| 556 | |
| 557 | /************************************************************************* |
| 558 | * FUNCTION |
| 559 | * DclHADC_Initialize |
| 560 | * |
| 561 | * DESCRIPTION |
| 562 | * This function is to initialize Hardware ADC module |
| 563 | * |
| 564 | * PARAMETERS |
| 565 | * None |
| 566 | * |
| 567 | * RETURNS |
| 568 | * STATUS_OK |
| 569 | * |
| 570 | *************************************************************************/ |
| 571 | extern DCL_STATUS DclHADC_Initialize(void); |
| 572 | /************************************************************************* |
| 573 | * FUNCTION |
| 574 | * DclHADC_Open |
| 575 | * |
| 576 | * DESCRIPTION |
| 577 | * This function is to open the Hardware ADC module and return a handle |
| 578 | * |
| 579 | * PARAMETERS |
| 580 | * dev: only valid for Hardware DCL_ADC |
| 581 | * flags: no sepcial flags is needed. Please use FLAGS_NONE |
| 582 | * |
| 583 | * RETURNS |
| 584 | * DCL_HANDLE_INVALID: Open failed |
| 585 | * Other value: A valid handle |
| 586 | * |
| 587 | *************************************************************************/ |
| 588 | extern DCL_HANDLE DclHADC_Open(DCL_DEV dev, DCL_FLAGS flags); |
| 589 | /************************************************************************* |
| 590 | * FUNCTION |
| 591 | * DclHADC_ReadData |
| 592 | * |
| 593 | * DESCRIPTION |
| 594 | * This function is not supported for the ADC module now. |
| 595 | * |
| 596 | * PARAMETERS |
| 597 | * N/A |
| 598 | * |
| 599 | * RETURNS |
| 600 | * STATUS_UNSUPPORTED |
| 601 | * |
| 602 | *************************************************************************/ |
| 603 | extern DCL_STATUS DclHADC_ReadData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN buf_len, DCL_OPTIONS options); |
| 604 | /************************************************************************* |
| 605 | * FUNCTION |
| 606 | * DclHADC_WriteData |
| 607 | * |
| 608 | * DESCRIPTION |
| 609 | * This function is not supported for the ADC module now. |
| 610 | * |
| 611 | * PARAMETERS |
| 612 | * N/A |
| 613 | * |
| 614 | * RETURNS |
| 615 | * STATUS_UNSUPPORTED |
| 616 | * |
| 617 | *************************************************************************/ |
| 618 | extern DCL_STATUS DclHADC_WriteData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN buf_len, DCL_OPTIONS options); |
| 619 | /************************************************************************* |
| 620 | * FUNCTION |
| 621 | * DclHADC_Configure |
| 622 | * |
| 623 | * DESCRIPTION |
| 624 | * This function is not supported for the ADC module now. |
| 625 | * |
| 626 | * PARAMETERS |
| 627 | * N/A |
| 628 | * |
| 629 | * RETURNS |
| 630 | * STATUS_UNSUPPORTED |
| 631 | * |
| 632 | *************************************************************************/ |
| 633 | extern DCL_STATUS DclHADC_Configure(DCL_HANDLE handle, DCL_CONFIGURE_T *configure); |
| 634 | /************************************************************************* |
| 635 | * FUNCTION |
| 636 | * DclHADC_RegisterCallback |
| 637 | * |
| 638 | * DESCRIPTION |
| 639 | * This function is not supported for the ADC module now. |
| 640 | * |
| 641 | * PARAMETERS |
| 642 | * N/A |
| 643 | * |
| 644 | * RETURNS |
| 645 | * STATUS_UNSUPPORTED |
| 646 | * |
| 647 | *************************************************************************/ |
| 648 | extern DCL_STATUS DclHADC_RegisterCallback(DCL_HANDLE handle, DCL_EVENT event, PFN_DCL_CALLBACK callback); |
| 649 | /************************************************************************* |
| 650 | * FUNCTION |
| 651 | * DclHADC_Control |
| 652 | * |
| 653 | * DESCRIPTION |
| 654 | * This function is to send command to control the Hardware ADC module. |
| 655 | * |
| 656 | * PARAMETERS |
| 657 | * handle: A valid handle return by DclHADC_Open() |
| 658 | * cmd: A control command for ADC module |
| 659 | * 1. ADC_CMD_IMM_MEASURE: to perform a immediate mode measurement (Register control only, not include power setting) |
| 660 | * 2. ADC_CMD_SYNC_MEASURE: to perform a sync mode measurement (Register control only, not include power setting) |
| 661 | * 3. ADC_CMD_TDMA_SYNC_SETUP: to setup TDMA sync mode parameters |
| 662 | * 4. ADC_CMD_POWER: to turn on/off ADC module power |
| 663 | * data: The data of the control command |
| 664 | * 1. ADC_CMD_IMM_MEASURE: pointer to a ADC_CTRL_IMM_MEASURE_T structure |
| 665 | * 2. ADC_CMD_SYNC_MEASURE: pointer to a ADC_CTRL_SYNC_MEASURE_T structure |
| 666 | * 3. ADC_CMD_TDMA_SYNC_SETUP: pointer to a ADC_CTRL_TDMA_SYNC_SETUP_T structure |
| 667 | * 4. ADC_CMD_POWER: pointer to a ADC_CTRL_POWER_T structure |
| 668 | * |
| 669 | * RETURNS |
| 670 | * STATUS_OK: command is executed successfully. |
| 671 | * STATUS_FAIL: command is failed. |
| 672 | * STATUS_INVALID_CMD: It's a invalid command. |
| 673 | * |
| 674 | *************************************************************************/ |
| 675 | extern DCL_STATUS DclHADC_Control(DCL_HANDLE handle, DCL_CTRL_CMD cmd, DCL_CTRL_DATA_T *data); |
| 676 | /************************************************************************* |
| 677 | * FUNCTION |
| 678 | * DclHADC_Close |
| 679 | * |
| 680 | * DESCRIPTION |
| 681 | * This function is to close the Hardware ADC module. |
| 682 | * |
| 683 | * PARAMETERS |
| 684 | * handle: the returned handle value of HDclADC_Open |
| 685 | * |
| 686 | * RETURNS |
| 687 | * STATUS_OK |
| 688 | * |
| 689 | *************************************************************************/ |
| 690 | extern DCL_STATUS DclHADC_Close(DCL_HANDLE handle); |
| 691 | |
| 692 | #endif // #ifndef __DCL_ADC_H_PROTOTYPE__ |
| 693 | #endif // #ifdef DCL_DEFINITION_PROTOTYPE |