hif_v2.c 32.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036
//#pragma O0

#include "kal_release.h"
#include "lcd_if.h"
#include "hif_hal.h"
#include "hif_v2_internal.h"
#include "eint.h"
#include "intrCtrl.h"
#include "dma_sw.h"
#include "dma_hw.h"
#include "drv_comm.h"
#include "drv_hisr.h"
#include "init.h"
#if defined(__AST_TL1_TDD__)
#include "ast_hif_hw.h"
#endif
#ifdef MT6260
#include "custom_EMI_release.h"
#endif

#if defined(DRV_HIF_SUPPORT) && defined(DRV_HIF_V2)

#if defined (MT6255) || defined(MT6256)//chip version query type modify for MT6255,MT6256 only
static SW_SECVERSION chip_version;
#endif
static kal_bool hif_eco_support = KAL_FALSE;

// Global variables
static kal_bool hif_power_on[HIF_ENGINE_COUNT] = {KAL_FALSE};
static HIF_INTERNAL_HANDLE_T hif_internal_handle[HIF_ENGINE_COUNT];
static volatile kal_uint8 hif_sysdma_id[HIF_ENGINE_COUNT];
static DMA_INPUT hif_dma_input[HIF_ENGINE_COUNT];
static DMA_HWMENU hif_dma_menu[HIF_ENGINE_COUNT];

#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
//static kal_hisrid hif_hisr_id[HIF_ENGINE_COUNT];
static HIF_CALLBACK hif_cb[HIF_ENGINE_COUNT] = {0};

#ifdef MTK_SLEEP_ENABLE
#ifndef MT6260
static kal_uint8 hif_sleepMode_handle[HIF_ENGINE_COUNT] = {0xFF, 0xFF};
#else
static kal_uint8 hif_sleepMode_handle[HIF_ENGINE_COUNT] = {0xFF};
#endif


extern void L1SM_SleepDisable( kal_uint8 handle );
extern void L1SM_SleepEnable( kal_uint8 handle );
extern kal_uint8 L1SM_GetHandle(void);
#endif
kal_eventgrpid  hif_events;

#if defined(__MTK_TARGET__) && defined(__DCM_WITH_COMPRESSION_MAUI_INIT__)
#pragma push
#pragma arm section code="DYNAMIC_COMP_MAUIINIT_SECTION"
#endif

void hif_init(void)
{
    // Init structure.
    memset(hif_internal_handle, 0, sizeof(hif_internal_handle));
#ifndef MT6575
    // Init HIF interrupr
    IRQ_Register_LISR(IRQ_HIF_CODE, hif0_lisr, "HIF0 ISR");
    IRQSensitivity(IRQ_HIF_CODE, LEVEL_SENSITIVE);
    //hif_hisr_id[0] = kal_create_hisr("HIF0_HISR", 0, 1024, hif0_hisr, KAL_TRUE);
    DRV_Register_HISR(DRV_HIF0_HISR_ID, hif0_hisr);
    IRQUnmask(IRQ_HIF_CODE);
#endif//#ifndef (MT6575)

#ifndef MT6260
    IRQ_Register_LISR(IRQ_HIF_1_CODE, hif1_lisr, "HIF1 ISR");
    IRQSensitivity(IRQ_HIF_1_CODE, LEVEL_SENSITIVE);
    //hif_hisr_id[1] = kal_create_hisr("HIF1_HISR", 0, 1024, hif1_hisr, KAL_TRUE);
    DRV_Register_HISR(DRV_HIF1_HISR_ID, hif1_hisr);
    IRQUnmask(IRQ_HIF_1_CODE);
#endif
    /* DMA initialization */

    hif_sysdma_id[0] = DMA_GetChannel(DMA_HIF0);
#ifndef MT6260
    hif_sysdma_id[1] = DMA_GetChannel(DMA_HIF1);
#endif
    hif_dma_menu[0].TMOD.burst_mode = 0;
    hif_dma_menu[0].master = DMA_HIF0;
    hif_dma_menu[0].addr = NULL;
#ifndef MT6260
    hif_dma_menu[1].TMOD.burst_mode = 0;
    hif_dma_menu[1].master = DMA_HIF1;
    hif_dma_menu[1].addr = NULL;
#endif

    // Configure DMA
    //hif_dma_input.size = DMA_SHORT;
    hif_dma_input[0].count = 0;
    hif_dma_input[0].callback = NULL;
#ifndef MT6260
    hif_dma_input[1].count = 0;
    hif_dma_input[1].callback = NULL;
#endif

    //hif_dma_input.menu = (void*) &hif_dma_menu;

    //define ECO solution for MT6256E4,MT6575E2, MT6255E2 or MTK later chips
    
    #if defined(MT6255) || defined(MT6256)//MT6255 and MT6256 support query chip version
        chip_version = INT_SW_SecVersion(); //Query chip version
    #endif
         
    #if defined(__AST_TL1_TDD__)  //HIF ECO only support for TDD project
      #if defined(MT6575_S01) || defined(MT6250)
          hif_eco_support = KAL_TRUE;
      #elif defined(MT6255) //MT6255E2 support HIF ECO
          if(SW_SEC_0 != chip_version)
          {
    	      hif_eco_support = KAL_TRUE;
          }
      #elif defined(MT6256) //MT6256E4,MT6256E5 support HIF ECO
          if(SW_SEC_1 == chip_version) //SW_SEC_0: MT6256E2,E3,E4, SW_SEC_1: MT6256E5
          {
    	      hif_eco_support = KAL_TRUE;
          }
    	#endif
    #endif
    
    hif_events = kal_create_event_group("HIFDrv");
}
#if defined(__MTK_TARGET__) && defined(__DCM_WITH_COMPRESSION_MAUI_INIT__)
#pragma arm section code
#pragma pop
#endif

HIF_HANDLE hif_open(kal_uint32 port)
{
    kal_uint32 EngineIndex;
    kal_uint32 dedicated_engine_id=0;
    //ASSERT(port < HIF_MAX_PORT_NUM);
    if (port >= HIF_MAX_PORT_NUM)
        return 0;
//for TDD project
#if defined(__AST_TL1_TDD__)
  if(port==AST_HIF_PORT)
  {
      dedicated_engine_id=1; //for TD,use port 1,this engine have high priority interrupt.
  }
  else
  {
      dedicated_engine_id=0; //for WiFi or other module,use port 0,this engine would not have high priority interrupt.
  }
  hif_internal_handle[dedicated_engine_id].user = 1;
  hif_internal_handle[dedicated_engine_id].engine_id = dedicated_engine_id;
  hif_internal_handle[dedicated_engine_id].port = port;
  hif_internal_handle[dedicated_engine_id].A0H_CPU_BUSY = KAL_FALSE;
  hif_internal_handle[dedicated_engine_id].A0L_CPU_BUSY = KAL_FALSE; 
  #ifdef MTK_SLEEP_ENABLE
  if(0xFF == hif_sleepMode_handle[dedicated_engine_id])  //lock MD
  {
      hif_sleepMode_handle[dedicated_engine_id] = L1SM_GetHandle();
  }  
  #endif
  return (HIF_HANDLE)(&hif_internal_handle[dedicated_engine_id]);
#else
  //save this for NON-TDD project
    for (EngineIndex=0; EngineIndex<HIF_ENGINE_COUNT; EngineIndex++)
    {
        if (hif_internal_handle[EngineIndex].user == 0)
        {
            // Found an available engine.
            hif_internal_handle[EngineIndex].user = 1;
            hif_internal_handle[EngineIndex].engine_id = EngineIndex;
            hif_internal_handle[EngineIndex].port = port;
            hif_internal_handle[EngineIndex].A0H_CPU_BUSY = KAL_FALSE;
            hif_internal_handle[EngineIndex].A0L_CPU_BUSY = KAL_FALSE;
            #ifdef MTK_SLEEP_ENABLE
            if(0xFF == hif_sleepMode_handle[EngineIndex])  //lock MD
            {
                hif_sleepMode_handle[EngineIndex] = L1SM_GetHandle();				
            }  
            #endif  
            return (HIF_HANDLE)(&hif_internal_handle[EngineIndex]);
        }
    }
#endif
    return (HIF_HANDLE)(NULL);
}

HIF_RESULT hif_close(HIF_HANDLE handle)
{
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    //ASSERT(pHandle != NULL);
    if(pHandle == NULL)
        return HIF_RESULT_INVALID_HANDLE;
    //ASSERT(pHandle->user != 0);
    if(pHandle->user == 0)
        return HIF_RESULT_INVALID_HANDLE;
    pHandle->user = 0;
    pHandle->engine_id = 0;
    pHandle->port = 0;
    return HIF_RESULT_OK;
}

HIF_RESULT hif_config(HIF_HANDLE handle, HIF_CONFIG_T* pConfigParam)
{
    kal_uint32 save_irq_mask;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    //ASSERT(pHandle != NULL);
    if(pHandle == NULL)
        return HIF_RESULT_INVALID_HANDLE;
    //ASSERT(pHandle->user != 0);
    if(pHandle->user == 0)
        return HIF_RESULT_INVALID_HANDLE;
    //ASSERT(pConfigParam != NULL);
    if(pConfigParam == NULL)
	    return HIF_RESULT_INVALID_ARGUMENT;
    pHandle->config = *pConfigParam;

    save_irq_mask = SaveAndSetIRQMask();
    NLI_ARB_SET_LPCE_SEL(pHandle->port, pHandle->engine_id);
    RestoreIRQMask(save_irq_mask);

    switch (pHandle->config.hif_base_clk)
    {
    #if defined(MT6276)
    case 122:
        break;
    #elif defined(MT6256)||defined(MT6255)
        case 104:
            break;
    #elif defined(MT6250)
        case 130:
            break;
    #elif defined(MT6575)
        case 99:
            break;
	#elif defined(MT6260)
		#if defined(__EMI_CLK_166MHZ__)
	        case 166:
	        	break;
		#elif defined(__EMI_CLK_130MHZ__)
			case 130:
	            break;
		#elif defined(__EMI_CLK_104MHZ__)
			case 104:
	            break;
		#endif
    #endif
    default:
        //ASSERT(0);
        //return HIF_RESULT_INVALID_ARGUMENT;
        break;
    }
//set HIF register
    switch (pHandle->config.hif_bus_width)
    {
    case 8:
    case 16:
        SET_HIF_BUS_WIDTH(pHandle->engine_id, pHandle->config.hif_bus_width);
        break;
    default:
        //ASSERT(0);
        return HIF_RESULT_INVALID_ARGUMENT;
        break;
    }
	//for V2,set LCD timing,set HIF_TIME0_REG/HIF_TIME1_REG

    SET_HIF_CE2WR_SETUP_TIME (pHandle->engine_id, pHandle->config.hif_time_c2ws);
    SET_HIF_CE2WR_HOLD_TIME  (pHandle->engine_id, pHandle->config.hif_time_c2wh);
    SET_HIF_CE2RD_SETUP_TIME (pHandle->engine_id, pHandle->config.hif_time_c2rs);
    SET_HIF_CE2RD_HOLD_TIME  (pHandle->engine_id, pHandle->config.hif_time_c2rh);
    SET_HIF_WRITE_WAIT_STATE (pHandle->engine_id, pHandle->config.hif_time_wst);
    SET_HIF_READ_LATENCY_TIME(pHandle->engine_id, pHandle->config.hif_time_rlt);
    SET_HIF_CS_HIGH_WIDTH_TIME(pHandle->engine_id, pHandle->config.hif_time_chw);

    return HIF_RESULT_OK;
}

HIF_RESULT hif_power_ctrl(HIF_HANDLE handle, kal_bool bPowerOn)
{
	//kal_uint32 save_irq_mask;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    //ASSERT(pHandle);
    if(pHandle == NULL)
        return HIF_RESULT_INVALID_HANDLE;
    if (bPowerOn)
    {
        //lcd_power_ctrl__enable(AST_HIF_PWR_HANDLE);
        //DRV_WriteReg32(MMSYS_CG_CLR1, MMSYS_CG_CON1_HIF);       // HIF clock.
        //DRV_WriteReg32(MMSYS_CG_CLR0, MMSYS_CG_CON0_LCD);       // LCD clock.
        //NLI_ARB_POWER_ON;
        HIF_POWER_ON(pHandle->engine_id);
        //save_irq_mask = SaveAndSetIRQMask();
        //NLI_ARB_SET_LPCE_SEL(pHandle->port, pHandle->engine_id);
        //RestoreIRQMask(save_irq_mask);
        hif_power_on[pHandle->engine_id] = KAL_TRUE;
    }
    else
    {
        hif_power_on[pHandle->engine_id] = KAL_FALSE;
        HIF_POWER_OFF(pHandle->engine_id);
        //lcd_power_ctrl__disable(AST_HIF_PWR_HANDLE);
        //DRV_WriteReg32(MMSYS_CG_SET1, MMSYS_CG_CON1_HIF);       // HIF clock.
        //DRV_WriteReg32(MMSYS_CG_SET0, MMSYS_CG_CON0_LCD);       // LCD clock.
    }
    return HIF_RESULT_OK;
}

#if defined(MT6255)
#pragma arm section code = "INTSRAM_ROCODE"
#endif
HIF_RESULT hif_mcu_write_fast(HIF_HANDLE handle, HIF_TYPE type, kal_uint32 addr, kal_uint32 size)
{
    kal_uint32 index = 0;
    kal_uint32 hif_ultra_old; //set HIF ultra high for MCU mode
    HIF_RESULT result = HIF_RESULT_OK;
    kal_uint32 save_irq_mask;
    volatile kal_uint32 index_delay; 
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    //Set A0H_CPU_BUSY or A0L_CPU_BUSY flag
    save_irq_mask = SaveAndSetIRQMask();
    if(type == HIF_TYPE_A0H_CPU)
    {
      ASSERT(!pHandle->A0H_CPU_BUSY);
      pHandle->A0H_CPU_BUSY = KAL_TRUE;
    }
    else
    {
      ASSERT(!pHandle->A0L_CPU_BUSY);
      pHandle->A0L_CPU_BUSY = KAL_TRUE;			
    }
    hif_ultra_old = GET_HIF_ULTRA(pHandle->engine_id);	
    if(hif_ultra_old != 1)
    {	
      SET_HIF_ULTRA(pHandle->engine_id, 0x1);
      GET_HIF_ULTRA(pHandle->engine_id);
    }
    RestoreIRQMask(save_irq_mask);
	  
    if(hif_eco_support)
    {                    
      SET_HIF_MCU_ACS_REQ(pHandle->engine_id);
      while(PIF_BUSY(pHandle->engine_id));
      for(index_delay=0; index_delay<10; index_delay++);	//wait 30 CPU clock
      SET_HIF_MCU_ACS_STA(pHandle->engine_id);
    }
    if ((pHandle->config.hif_bus_width == 8) && (type == HIF_TYPE_A0H_CPU))
    {
      for (index = 0; index < size; index++)
      {
        *(volatile kal_uint8*)(HIF_PORT_MCU_A0_HIGH_ADDR(pHandle->engine_id)) = *(volatile kal_uint8*)(((kal_uint8*)(addr)) + index);
      }	       
    }
    else if ((pHandle->config.hif_bus_width == 8) && (type == HIF_TYPE_A0L_CPU))
    {
      for (index = 0; index < size; index++)
      {
        *(volatile kal_uint8*)(HIF_PORT_MCU_A0_LOW_ADDR(pHandle->engine_id)) = *(volatile kal_uint8*)(((kal_uint8*)(addr)) + index);
      }	       
    }
    else if( (pHandle->config.hif_bus_width == 16) && (type == HIF_TYPE_A0H_CPU))
    {
      for (index = 0; index < size/2; index++)
      {
        *(volatile kal_uint16*)(HIF_PORT_MCU_A0_HIGH_ADDR(pHandle->engine_id)) = *(volatile kal_uint16*)(((kal_uint16*)(addr)) + index);
      }
    }
    else if( (pHandle->config.hif_bus_width == 16) && (type == HIF_TYPE_A0L_CPU))
    {
      for (index = 0; index < size/2; index++)
      {
        *(volatile kal_uint16*)(HIF_PORT_MCU_A0_LOW_ADDR(pHandle->engine_id)) = *(volatile kal_uint16*)(((kal_uint16*)(addr)) + index);
      }
    }	  
    else
    {
      //ASSERT(0);
      result = HIF_RESULT_INVALID_ARGUMENT;
    }    
    if(hif_eco_support)
    {	
      CLEAR_HIF_MCU_ACS_REQ_STA(pHandle->engine_id);
    }

    //Clear A0H_CPU_BUSY or A0L_CPU_BUSY flag
    if(type == HIF_TYPE_A0H_CPU)
    {
      pHandle->A0H_CPU_BUSY = KAL_FALSE;
    }
    else
    {
      pHandle->A0L_CPU_BUSY = KAL_FALSE;
    }	  
	  
    if(hif_ultra_old != 1)
    {
      save_irq_mask = SaveAndSetIRQMask(); //restore hif ultra orignal setting	
      SET_HIF_ULTRA(pHandle->engine_id, hif_ultra_old);
      RestoreIRQMask(save_irq_mask);
    }
    return result;
}	
HIF_RESULT hif_mcu_read_fast(HIF_HANDLE handle, HIF_TYPE type, kal_uint32 addr, kal_uint32 size)
{
    kal_uint32 index = 0;
    kal_uint32 hif_ultra_old; //set HIF ultra high for MCU mode
    HIF_RESULT result = HIF_RESULT_OK;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    kal_uint32 save_irq_mask;
    volatile kal_uint32 index_delay;
    //Set A0H_CPU_BUSY or A0L_CPU_BUSY flag
    save_irq_mask = SaveAndSetIRQMask();
    if(type == HIF_TYPE_A0H_CPU)
    {
      ASSERT(!pHandle->A0H_CPU_BUSY);
      pHandle->A0H_CPU_BUSY = KAL_TRUE;
    }
    else
    {
      ASSERT(!pHandle->A0L_CPU_BUSY);
      pHandle->A0L_CPU_BUSY = KAL_TRUE;			
    }
    hif_ultra_old = GET_HIF_ULTRA(pHandle->engine_id);	
    if(hif_ultra_old != 1)
    {	
      SET_HIF_ULTRA(pHandle->engine_id, 0x1);
      GET_HIF_ULTRA(pHandle->engine_id);
    }
    RestoreIRQMask(save_irq_mask);
	  
    if(hif_eco_support)
    {                    
      SET_HIF_MCU_ACS_REQ(pHandle->engine_id);
      while(PIF_BUSY(pHandle->engine_id));
      for(index_delay=0; index_delay<10; index_delay++);	//wait 30 CPU clock
      SET_HIF_MCU_ACS_STA(pHandle->engine_id);
    }
    if ((pHandle->config.hif_bus_width == 8) && (type == HIF_TYPE_A0H_CPU))
    {
      for (index = 0; index < size; index++)
      {
        *(volatile kal_uint8*)(kal_uint8*)(((kal_uint8*)addr)+index) = *(volatile kal_uint8*)(HIF_PORT_MCU_A0_HIGH_ADDR(pHandle->engine_id));
      }	       
    }
    else if ((pHandle->config.hif_bus_width == 8) && (type == HIF_TYPE_A0L_CPU))
    {
      for (index = 0; index < size; index++)
      {
        *(volatile kal_uint8*)(kal_uint8*)(((kal_uint8*)addr)+index) = *(volatile kal_uint8*)(HIF_PORT_MCU_A0_LOW_ADDR(pHandle->engine_id));
      }	       
    }
    else if( (pHandle->config.hif_bus_width == 16) && (type == HIF_TYPE_A0H_CPU))
    {
      for (index = 0; index < size/2; index++)
      {
        *(volatile kal_uint16*)(kal_uint16*)(((kal_uint16*)addr)+index) = *(volatile kal_uint16*)(HIF_PORT_MCU_A0_HIGH_ADDR(pHandle->engine_id));
      }
    }
    else if( (pHandle->config.hif_bus_width == 16) && (type == HIF_TYPE_A0L_CPU))
    {
      for (index = 0; index < size/2; index++)
      {
        *(volatile kal_uint16*)(kal_uint16*)(((kal_uint16*)addr)+index) = *(volatile kal_uint16*)(HIF_PORT_MCU_A0_LOW_ADDR(pHandle->engine_id));
      }
    }	  
    else
    {
      //ASSERT(0);
      result = HIF_RESULT_INVALID_ARGUMENT;
    }    
    if(hif_eco_support)
    {	
      CLEAR_HIF_MCU_ACS_REQ_STA(pHandle->engine_id);
    }

    //Clear A0H_CPU_BUSY or A0L_CPU_BUSY flag
    if(type == HIF_TYPE_A0H_CPU)
    {
      pHandle->A0H_CPU_BUSY = KAL_FALSE;
    }
    else
    {
      pHandle->A0L_CPU_BUSY = KAL_FALSE;
    }	  
	  
    if(hif_ultra_old != 1)
    {
      save_irq_mask = SaveAndSetIRQMask(); //restore hif ultra orignal setting	
      SET_HIF_ULTRA(pHandle->engine_id, hif_ultra_old);
      RestoreIRQMask(save_irq_mask);
    }
    return result;

}
#if defined(MT6255)
#pragma arm section code
#endif
HIF_RESULT hif_dma_write_internal(HIF_HANDLE handle, HIF_TYPE type, kal_uint32 addr, kal_uint32 size, HIF_CALLBACK fCB)
{
    HIF_RESULT result = HIF_RESULT_OK;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    kal_uint32 retrieved_events;
    ENABLE_HIF_INTR(pHandle->engine_id);
    #ifdef MTK_SLEEP_ENABLE
    L1SM_SleepDisable(hif_sleepMode_handle[pHandle->engine_id]);//unlock MD sleep mode
    #endif
    if (fCB == NULL)
    {
      if(!(kal_if_lisr()||kal_if_hisr()))
      {
        //Clear the evnet for pHandle->engine_id HIF for task level
        kal_set_eg_events(hif_events, ~(1 << pHandle->engine_id), KAL_AND);
      }
      else 
        ASSERT(0); //HIF DMA blocking mode is not allowed in LISR or HISR
    }
    // Setup HIF.
    //SET_HIF_BUS_WIDTH(pHandle->engine_id, pHandle->config.hif_bus_width);
    SET_HIF_WRITE(pHandle->engine_id);
    if(type == HIF_TYPE_A0H_DMA)
    {
      SET_HIF_A0_HIGH(pHandle->engine_id);
    }
    else if(type == HIF_TYPE_A0L_DMA)
    {	
      SET_HIF_A0_LOW(pHandle->engine_id);
    }
    SET_HIF_DAMOUNT(pHandle->engine_id, size);
    // Set DMA address.
/*
    PDMA_SET_BUF_ADDR(pHandle->engine_id, addr);
    PDMA_SET_RW_DIRECTION(pHandle->engine_id, 0); // 1:read; 0: write
    PDMA_SET_BUF_LEN(pHandle->engine_id, size);
    PDMA_SET_BURST_LEN(pHandle->engine_id, 7);

    PDMA_START(pHandle->engine_id); //Start DMA
*/
    if(1 == pHandle->engine_id)
    {
      SLA_CustomLogging("HDM",1);//set for debug
    }
    //dma config
    hif_dma_menu[pHandle->engine_id].addr = addr;
    #if defined(MT6250)||defined(MT6260)
      hif_dma_menu[pHandle->engine_id].TMOD.burst_mode = KAL_TRUE;
      hif_dma_menu[pHandle->engine_id].TMOD.cycle = 4;            
    #endif
    hif_dma_input[pHandle->engine_id].count  = (pHandle->config.hif_bus_width == 16) ? (size >> 1) : size;
    hif_dma_input[pHandle->engine_id].type = DMA_HWTX;
    hif_dma_input[pHandle->engine_id].size = (pHandle->config.hif_bus_width == 16) ? DMA_SHORT : DMA_BYTE;
    hif_dma_input[pHandle->engine_id].callback = NULL;
    hif_dma_input[pHandle->engine_id].menu = (void*) &hif_dma_menu[pHandle->engine_id];
    #if defined(MT6250)||defined(MT6260)
      DMA_Config_B2W(hif_sysdma_id[pHandle->engine_id], &hif_dma_input[pHandle->engine_id], KAL_TRUE,1);
    #else
      DMA_Config(hif_sysdma_id[pHandle->engine_id], &hif_dma_input[pHandle->engine_id], KAL_TRUE);
    #endif

    // Set fCB as HIF interrupt callback.
    hif_cb[pHandle->engine_id] = fCB;
    // Start HIF
    START_HIF(pHandle->engine_id);

    if (fCB == NULL)
    {
      if(!(kal_if_lisr()||kal_if_hisr()))
        {
          kal_retrieve_eg_events(hif_events, (1<<pHandle->engine_id), KAL_OR_CONSUME, &retrieved_events, KAL_SUSPEND);
        }
    else 
      ASSERT(0); //HIF DMA blocking mode is not allowed in LISR or HISR
    }
    return result;
}
HIF_RESULT hif_write(HIF_HANDLE handle, HIF_TYPE type, kal_uint32 addr, kal_uint32 size, HIF_CALLBACK fCB)
{
    //kal_uint32 index = 0;
    HIF_RESULT result = HIF_RESULT_OK;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    //kal_uint32 save_irq_mask, retrieved_events, index_delay; 
    kal_bool cb_en = KAL_FALSE;
       
    #if defined (MT6255)    
      if(SW_SEC_0 == chip_version)
      {
        if ((type == HIF_TYPE_A0H_DMA)||(type == HIF_TYPE_A0L_DMA))
          {
            type --; // change from DMA to CPU
            if(fCB)
              cb_en = KAL_TRUE;
          }
      }
    #endif

    //ASSERT(pHandle != NULL);
    //ASSERT(pHandle->user != 0);
    if((pHandle == NULL)||(pHandle->user == 0))
      return HIF_RESULT_INVALID_HANDLE;
    //ASSERT(size != 0);
    //ASSERT((pHandle->config.hif_bus_width==8)? 1 : (size%2==0));
    if ((size == 0) || (!((pHandle->config.hif_bus_width==8)? 1 : (size%2==0))))
      return HIF_RESULT_INVALID_ARGUMENT;
    //ASSERT(hif_power_on[pHandle->engine_id] == KAL_TRUE);
    if (hif_power_on[pHandle->engine_id] == KAL_FALSE)
      return HIF_RESULT_HIF_NOT_POWER_ON;
    //check if DMA is busy,to avoid re-entry DMA mode.
    if ((HIF_BUSY(pHandle->engine_id)==1)&&(type == HIF_TYPE_A0H_DMA||type == HIF_TYPE_A0L_DMA))
      return HIF_RESULT_DMA_IS_BUSY;
    //On HIF ECO Chip, blocking DMA mode is not allowed 
    if(hif_eco_support)
    {
      if(type == HIF_TYPE_A0H_DMA||type == HIF_TYPE_A0L_DMA)
      ASSERT(fCB);
    }
    if(type == HIF_TYPE_A0H_CPU||type == HIF_TYPE_A0L_CPU)
      result = hif_mcu_write_fast( handle, type, addr, size);
    else if(type == HIF_TYPE_A0H_DMA||type == HIF_TYPE_A0L_DMA)
      result = hif_dma_write_internal(handle, type, addr, size, fCB);

    #if defined (MT6255)
      if(SW_SEC_0 == chip_version)
        {    
          if((result == HIF_RESULT_OK) && (cb_en))
          fCB();
        }
    #endif
//     if((type == HIF_TYPE_A0H_CPU) ||(type == HIF_TYPE_A0L_CPU))
//     	{
//						  
//						    DclGPIO_Control(gpio_handle,GPIO_CMD_WRITE_LOW,0);   
//			}
//    if((type == HIF_TYPE_A0H_CPU) ||(type == HIF_TYPE_A0L_CPU))
//   	SLA_CustomLogging("HWM",00);
    return result;
}

HIF_RESULT hif_dma_read_internal(HIF_HANDLE handle, HIF_TYPE type, kal_uint32 addr, kal_uint32 size, HIF_CALLBACK fCB)
{
    HIF_RESULT result = HIF_RESULT_OK;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    kal_uint32 retrieved_events;
    // Enable HIF interrupt.
    ENABLE_HIF_INTR(pHandle->engine_id);
    #ifdef MTK_SLEEP_ENABLE
      L1SM_SleepDisable(hif_sleepMode_handle[pHandle->engine_id]);//unlock MD sleep mode
    #endif
    
    if (fCB == NULL)
    {
      if(!(kal_if_lisr()||kal_if_hisr()))
        {
          //Clear the evnet for pHandle->engine_id HIF for task level
          kal_set_eg_events(hif_events, ~(1 << pHandle->engine_id), KAL_AND);
        }
      else 
      ASSERT(0); //HIF DMA blocking mode is not allowed in LISR or HISR
    }
    // Setup HIF.
    //SET_HIF_BUS_WIDTH(pHandle->engine_id, pHandle->config.hif_bus_width);
    SET_HIF_READ(pHandle->engine_id);
    if(type == HIF_TYPE_A0H_DMA)
    {
      SET_HIF_A0_HIGH(pHandle->engine_id);
    }
    else if(type == HIF_TYPE_A0L_DMA)
    {	
      SET_HIF_A0_LOW(pHandle->engine_id);
    }
    SET_HIF_DAMOUNT(pHandle->engine_id, size);
/*              // Set DMA address.
    PDMA_SET_BUF_ADDR(pHandle->engine_id, addr);
    PDMA_SET_RW_DIRECTION(pHandle->engine_id, 1); // 1:read; 0: write
    PDMA_SET_BUF_LEN(pHandle->engine_id, size);
    PDMA_SET_BURST_LEN(pHandle->engine_id, 7);

    PDMA_START(pHandle->engine_id); //Start DMA
*/
    if(1 == pHandle->engine_id)
      {
        SLA_CustomLogging("HDM",1);//set for debug
      }
    //dma config
    hif_dma_menu[pHandle->engine_id].addr = addr;
    #if defined(MT6250)||defined(MT6260)
      hif_dma_menu[pHandle->engine_id].TMOD.burst_mode = KAL_TRUE;
      hif_dma_menu[pHandle->engine_id].TMOD.cycle = 4;            
    #endif
    hif_dma_input[pHandle->engine_id].count  = (pHandle->config.hif_bus_width == 16) ? (size >> 1) : size;
    hif_dma_input[pHandle->engine_id].type = DMA_HWRX;
    hif_dma_input[pHandle->engine_id].size = (pHandle->config.hif_bus_width == 16) ? DMA_SHORT : DMA_BYTE;
    hif_dma_input[pHandle->engine_id].callback = NULL;
    hif_dma_input[pHandle->engine_id].menu = (void*) &hif_dma_menu[pHandle->engine_id];
    #if defined(MT6250)||defined(MT6260)
      DMA_Config_B2W(hif_sysdma_id[pHandle->engine_id], &hif_dma_input[pHandle->engine_id], KAL_TRUE,1);
    #else
      DMA_Config(hif_sysdma_id[pHandle->engine_id], &hif_dma_input[pHandle->engine_id], KAL_TRUE);
    #endif    

    // Set fCB as HIF interrupt callback.
    hif_cb[pHandle->engine_id] = fCB;

    // Start HIF
    START_HIF(pHandle->engine_id);
    if (fCB == NULL)
    {
      if(!(kal_if_lisr()||kal_if_hisr()))
      {
        kal_retrieve_eg_events(hif_events, (1<<pHandle->engine_id), KAL_OR_CONSUME, &retrieved_events, KAL_SUSPEND);
      }
      else 
        ASSERT(0); //HIF DMA blocking mode is not allowed in LISR or HISR
    }	
   return result;
}
HIF_RESULT hif_read(HIF_HANDLE handle, HIF_TYPE type, kal_uint32 addr, kal_uint32 size, HIF_CALLBACK fCB)
{
//  kal_uint32 index = 0;
    HIF_RESULT result = HIF_RESULT_OK;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
//  kal_uint32 save_irq_mask, retrieved_events, index_delay;
    kal_bool cb_en = KAL_FALSE;
    
//  if((type == HIF_TYPE_A0H_CPU) ||(type == HIF_TYPE_A0L_CPU))
//  {   
//    DclGPIO_Control(gpio_handle,GPIO_CMD_WRITE_HIGH,0);
//  } 
    #if defined (MT6255)     
      if(SW_SEC_0 == chip_version)
      {
        if ((type == HIF_TYPE_A0H_DMA)||(type == HIF_TYPE_A0L_DMA))
        {
          type --; // change from DMA to CPU
          if(fCB)
            cb_en = KAL_TRUE;
        }
      }
    #endif

   	
//  if((type == HIF_TYPE_A0H_CPU) ||(type == HIF_TYPE_A0L_CPU))
//  SLA_CustomLogging("HRM",1);
    //ASSERT(pHandle != NULL);
    //ASSERT(pHandle->user != 0);
    if((pHandle == NULL)||(pHandle->user == 0))
      return HIF_RESULT_INVALID_HANDLE;
    //ASSERT(size != 0);
    //ASSERT((pHandle->config.hif_bus_width==8)? 1 : (size%2==0));
    if ((size == 0) || (!((pHandle->config.hif_bus_width==8)? 1 : (size%2==0))))
      return HIF_RESULT_INVALID_ARGUMENT;
       
    //ASSERT(hif_power_on[pHandle->engine_id] == KAL_TRUE);
    if (hif_power_on[pHandle->engine_id] == KAL_FALSE)
      return HIF_RESULT_HIF_NOT_POWER_ON;
        
    //check if DMA is busy,to avoid re-entry DMA mode.
    if ((HIF_BUSY(pHandle->engine_id)==1)&&(type == HIF_TYPE_A0H_DMA||type == HIF_TYPE_A0L_DMA))
      return HIF_RESULT_DMA_IS_BUSY;
      
    //On HIF ECO Chip, blocking DMA mode is not allowed 
    if(hif_eco_support)
    {
      if(type == HIF_TYPE_A0H_DMA||type == HIF_TYPE_A0L_DMA)
      ASSERT(fCB);
    }
    if(type == HIF_TYPE_A0H_CPU||type == HIF_TYPE_A0L_CPU)
      result = hif_mcu_read_fast(handle, type, addr, size);
    else if(type == HIF_TYPE_A0H_DMA||type == HIF_TYPE_A0L_DMA)
      result = hif_dma_read_internal( handle, type, addr, size, fCB);

    #if defined (MT6255)
      if(SW_SEC_0 == chip_version)
      {    
        if((result == HIF_RESULT_OK) && (cb_en))
        fCB();
      }
    #endif
    return result;
}

void hif0_lisr(void)
{
    #ifndef MT6575
      IRQMask(IRQ_HIF_CODE);
#endif
    (*(volatile kal_uint32*)HIF_INTSTA_REG(0)) = 0;//hif int status,write clear
    #ifdef MTK_SLEEP_ENABLE
      L1SM_SleepEnable(hif_sleepMode_handle[0]);//lock MD sleep mode
    #endif
    
    if(hif_internal_handle[0].realtime_callback == KAL_TRUE)
    {
      if(hif_cb[0])
      {
        hif_cb[0]();
      }
      #ifndef MT6575
        IRQUnmask(IRQ_HIF_CODE);
        #endif  
    }
    else
      drv_active_hisr((kal_uint8)DRV_HIF0_HISR_ID);
}

void hif0_hisr(void)
{
    if (hif_cb[0])
    {
      hif_cb[0]();
    }
    kal_set_eg_events(hif_events, 1, KAL_OR);
    #ifndef MT6575
      IRQUnmask(IRQ_HIF_CODE);
    #endif
}
#ifndef MT6260
void hif1_lisr(void)
{
    IRQMask(IRQ_HIF_1_CODE);
    (*(volatile kal_uint32*)HIF_INTSTA_REG(1)) = 0;//hif int status,write clear
    #ifdef MTK_SLEEP_ENABLE
      L1SM_SleepEnable(hif_sleepMode_handle[1]);//lock MD sleep mode
    #endif
    SLA_CustomLogging("HDM",0);//set for debug
    if(hif_internal_handle[1].realtime_callback == KAL_TRUE)
    {
      /* set EMI arbitrator to hard mode for GMC before running the hard real-time app */
      #if defined(__DYNAMICALLY_SET_EMI_ARB_SOFT_MODE__) && defined(MT6922)
        EMI_Set_GMCBW_HardMode();
      #endif  /* __DYNAMICALLY_SET_EMI_ARB_SOFT_MODE__ */

      if(hif_cb[1])
      {
        hif_cb[1]();
      }
        
       /* restore EMI arbitrator to soft mode for GMC before running the hard real-time app */
      #if defined(__DYNAMICALLY_SET_EMI_ARB_SOFT_MODE__) && defined(MT6922)
        EMI_Set_GMCBW_SoftMode();
      #endif  /* __DYNAMICALLY_SET_EMI_ARB_SOFT_MODE__ */    
        
      IRQUnmask(IRQ_HIF_1_CODE);
    }
    else
      drv_active_hisr((kal_uint8)DRV_HIF1_HISR_ID);
}

void hif1_hisr(void)
{
    if (hif_cb[1])
    {
      hif_cb[1]();
    }
    kal_set_eg_events(hif_events, 2, KAL_OR);
    IRQUnmask(IRQ_HIF_1_CODE);
}
#endif
void hif_wait_for_idle(kal_uint32 engine_id)
{
    while(HIF_BUSY(engine_id));
}

HIF_RESULT hif_ioctl(HIF_HANDLE handle, HIF_IOCTL_CODE code, void* pParam)
{
    HIF_RESULT result = HIF_RESULT_OK;
    HIF_INTERNAL_HANDLE_T* pHandle = (HIF_INTERNAL_HANDLE_T*) handle;
    //ASSERT(pHandle);
    if(pHandle == NULL)
      return HIF_RESULT_INVALID_HANDLE;
    switch (code)
    {
      case HIF_IOCTL_QUERY_TIMING_SUPPORT:
      {
        HIF_QUERY_TIMING_SUPPORT_T* pTimingSupport = (HIF_QUERY_TIMING_SUPPORT_T*) pParam;
        //ASSERT(pTimingSupport);
        if (pTimingSupport == NULL)
        {
          result = HIF_RESULT_INVALID_ARGUMENT;
          break;
        }
        pTimingSupport->c2ws_support = KAL_TRUE;
        pTimingSupport->c2wh_support = KAL_TRUE;
        pTimingSupport->wst_support = KAL_TRUE;
        pTimingSupport->c2rs_support = KAL_TRUE;
        pTimingSupport->c2rh_support = KAL_TRUE;
        pTimingSupport->rlt_support = KAL_TRUE;
        pTimingSupport->chw_support = KAL_TRUE;
      }
      break;
      case HIF_IOCTL_ULTRA_HIGH_CTRL:
      {
        HIF_ULTRA_HIGH_CTRL_T* pUltraHighCtrl = (HIF_ULTRA_HIGH_CTRL_T*) pParam;
        kal_uint32 save_irq_mask;
            
        //ASSERT(pUltraHighCtrl);
        if (pUltraHighCtrl == NULL)
        {
          result = HIF_RESULT_INVALID_ARGUMENT;
          break;
        }
        if (pUltraHighCtrl->ultra_high_en == KAL_TRUE)  //change TD HIF1 only, workaround for WIFI
        {
          if(pHandle->engine_id == 1)
          {
            save_irq_mask = SaveAndSetIRQMask();
            SET_HIF_ULTRA(pHandle->engine_id, 1);
            RestoreIRQMask(save_irq_mask);
          }
          else
          {
            SET_HIF_ULTRA(pHandle->engine_id, 1);
          }
              
        }
        else
        {
          if(pHandle->engine_id == 1)
          {
            save_irq_mask = SaveAndSetIRQMask();
            SET_HIF_ULTRA(pHandle->engine_id, 0);
            RestoreIRQMask(save_irq_mask);
          }
          else
          {
            SET_HIF_ULTRA(pHandle->engine_id, 0);
          }
        }
      }
      break;
      case HIF_IOCTL_QUERY_CLOCK_SUPPORT:
      {
        HIF_QUERY_CLOCK_SUPPORT_T* pColckSupport = (HIF_QUERY_CLOCK_SUPPORT_T*) pParam;
        //ASSERT(pColckSupport);
        if (pColckSupport == NULL)
        {
          result = HIF_RESULT_INVALID_ARGUMENT;
          break;
        }
        #if defined(MT6276)
          pColckSupport->clock[0] = 122;
        #elif defined(MT6256)||defined(MT6255)
          pColckSupport->clock[0] = 104;
        #elif defined(MT6250)
          pColckSupport->clock[0] = 130;
        #elif defined(MT6575)
          pColckSupport->clock[0] = 99;
		#elif defined(MT6260)
			#if defined(__EMI_CLK_166MHZ__)
				    pColckSupport->clock[0] = 166;
			      
			#elif defined(__EMI_CLK_130MHZ__)
					pColckSupport->clock[0] = 130;
			#elif defined(__EMI_CLK_104MHZ__)
					pColckSupport->clock[0] = 104;
            #endif
        #endif
        pColckSupport->clock[1] = 0;
        pColckSupport->clock[2] = 0;
        pColckSupport->clock[3] = 0;
      }
      break;
      case HIF_IOCTL_GET_PARAM:
      {
        HIF_CONFIG_T* pHIFParam = (HIF_CONFIG_T*) pParam;
        //ASSERT(pHIFParam);
        if (pHIFParam == NULL)
        {
          result = HIF_RESULT_INVALID_ARGUMENT;
          break;
        }
        *pHIFParam = pHandle->config;
            /*
            pHIFParam->hif_time_c2ws = pHandle->config.hif_time_c2ws;
            pHIFParam->hif_time_c2wh = pHandle->config.hif_time_c2wh;
            pHIFParam->hif_time_wst = pHandle->config.hif_time_wst;
            pHIFParam->hif_time_c2rs = pHandle->config.hif_time_c2rs;
            pHIFParam->hif_time_c2rh = pHandle->config.hif_time_c2rh;
            pHIFParam->hif_time_rlt = pHandle->config.hif_time_rlt;
            pHIFParam->hif_base_clk = pHandle->config.hif_base_clk;
            pHIFParam->hif_bus_width = pHandle->config.hif_bus_width;
            */
      }
      break;
      case HIF_IOCTL_QUERY_CAPABILITY:
      {
        HIF_CAPABILITY_T* pCapability = (HIF_CAPABILITY_T*) pParam;
        //ASSERT(pCapability);
        if (pCapability == NULL)
        {
          result = HIF_RESULT_INVALID_ARGUMENT;
          break;
        }
        pCapability->transfer_length_min = 1;
        pCapability->transfer_length_max = 65536;
      }
      break;
      case HIF_IOCTL_QUERY_POWER_STATE:
      {
        HIF_POWER_STATE_T* pPowerState = (HIF_POWER_STATE_T*) pParam;
        if (pPowerState == NULL)
        {
          result = HIF_RESULT_INVALID_ARGUMENT;
          break;
        }
        pPowerState->hif_power_on = hif_power_on[pHandle->engine_id];
      }
      break;
      case HIF_IOCTL_REALTIME_CALLBACK:
      {
        HIF_REALTIME_CALLBACK_T* pRealtimeCallback = (HIF_REALTIME_CALLBACK_T*) pParam;
        //ASSERT(pRealtimeCallback);
        if (pRealtimeCallback == NULL)
        {
          result = HIF_RESULT_INVALID_ARGUMENT;
          break;
        }
        if (pRealtimeCallback->realtime_callback_en == KAL_TRUE)
        {
          pHandle->realtime_callback=KAL_TRUE;
        }
        else
        {
          pHandle->realtime_callback=KAL_FALSE;
        }
      }
      break;
      default:
      //ASSERT(0);
      result = HIF_RESULT_NOT_SUPPORTED;
      break;
    }
    return result;
}

#endif