form_WiFiMCR.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:83k
源码类别:

MTK

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <stdio.h>
  4. #pragma hdrstop
  5. // form
  6. #ifndef _FORM_MAIN_H_
  7. #include "form_main.h"
  8. #endif
  9. #ifndef _FORM_WIFIMCR_H_
  10. #include "form_WiFiMCR.h"
  11. #endif
  12. #ifndef  _MISC_WIFI_H_
  13. #include "misc_wifi.h"
  14. #endif
  15. #define  DRAW_MCR_COMMON          0x01
  16. #define  DRAW_MCR_HIF             0x02
  17. //---------------------------------------------------------------------------
  18. #pragma package(smart_init)
  19. #pragma resource "*.dfm"
  20. TfrmWiFiMCR *frmWiFiMCR;
  21. //===========================================================================
  22. static void  ConfirmCallback_ReadReg( void )
  23. {   frmWiFiMCR->ConfirmCallback_ReadReg();
  24. }
  25. //---------------------------------------------------------------------------
  26. static void  ConfirmCallback_ReadHIF( void )
  27. {   frmWiFiMCR->ConfirmCallback_ReadHIF();
  28. }
  29. //---------------------------------------------------------------------------
  30. static void  ConfirmCallback_WriteReg( void )
  31. {   frmWiFiMCR->ConfirmCallback_WriteReg();
  32. }
  33. //---------------------------------------------------------------------------
  34. static void  ConfirmCallback_WriteHIF( void )
  35. {   frmWiFiMCR->ConfirmCallback_WriteHIF();
  36. }
  37. //---------------------------------------------------------------------------
  38. __fastcall TfrmWiFiMCR::TfrmWiFiMCR(TComponent* Owner)
  39.         : TForm(Owner)
  40. {
  41.     int i, j;
  42.     // System Control
  43.     lblSC[0] = lblSC0;   edtSC[0] = edtSC0;   cbSC[0] = cbSC0;
  44.     lblSC[1] = lblSC1;   edtSC[1] = edtSC1;   cbSC[1] = cbSC1;
  45.     lblSC[2] = lblSC2;   edtSC[2] = edtSC2;   cbSC[2] = cbSC2;
  46.     lblSC[3] = lblSC3;   edtSC[3] = edtSC3;   cbSC[3] = cbSC3;
  47.     // Miscellaneous and Debug Port
  48.     lblMDP[0]  = lblMDP00;    edtMDP[0]   = edtMDP00;    cbMDP[0]   = cbMDP00;
  49.     lblMDP[1]  = lblMDP01;    edtMDP[1]   = edtMDP01;    cbMDP[1]   = cbMDP01;
  50.     lblMDP[2]  = lblMDP02;    edtMDP[2]   = edtMDP02;    cbMDP[2]   = cbMDP02;
  51.     lblMDP[3]  = lblMDP03;    edtMDP[3]   = edtMDP03;    cbMDP[3]   = cbMDP03;
  52.     lblMDP[4]  = lblMDP04;    edtMDP[4]   = edtMDP04;    cbMDP[4]   = cbMDP04;
  53.     lblMDP[5]  = lblMDP05;    edtMDP[5]   = edtMDP05;    cbMDP[5]   = cbMDP05;
  54.     lblMDP[6]  = lblMDP06;    edtMDP[6]   = edtMDP06;    cbMDP[6]   = cbMDP06;
  55.     lblMDP[7]  = lblMDP07;    edtMDP[7]   = edtMDP07;    cbMDP[7]   = cbMDP07;
  56.     lblMDP[8]  = lblMDP08;    edtMDP[8]   = edtMDP08;    cbMDP[8]   = cbMDP08;
  57.     lblMDP[9]  = lblMDP09;    edtMDP[9]   = edtMDP09;    cbMDP[9]   = cbMDP09;
  58.     lblMDP[10] = lblMDP10;    edtMDP[10]  = edtMDP10;    cbMDP[10]  = cbMDP10;
  59.     lblMDP[11] = lblMDP11;    edtMDP[11]  = edtMDP11;    cbMDP[11]  = cbMDP11;
  60.     lblMDP[12] = lblMDP12;    edtMDP[12]  = edtMDP12;    cbMDP[12]  = cbMDP12;
  61.     lblMDP[13] = lblMDP13;    edtMDP[13]  = edtMDP13;    cbMDP[13]  = cbMDP13;
  62.     lblMDP[14] = lblMDP14;    edtMDP[14]  = edtMDP14;    cbMDP[14]  = cbMDP14;
  63.     lblMDP[15] = lblMDP15;    edtMDP[15]  = edtMDP15;    cbMDP[15]  = cbMDP15;
  64.     lblMDP[16] = lblMDP16;    edtMDP[16]  = edtMDP16;    cbMDP[16]  = cbMDP16;
  65.     lblMDP[17] = lblMDP17;    edtMDP[17]  = edtMDP17;    cbMDP[17]  = cbMDP17;
  66.     // Phyical Layer Control Interface
  67.     lblPLCI[0]  = lblPLCI00;  edtPLCI[0]  = edtPLCI00;   cbPLCI[0]  = cbPLCI00;
  68.     lblPLCI[1]  = lblPLCI01;  edtPLCI[1]  = edtPLCI01;   cbPLCI[1]  = cbPLCI01;
  69.     lblPLCI[2]  = lblPLCI02;  edtPLCI[2]  = edtPLCI02;   cbPLCI[2]  = cbPLCI02;
  70.     lblPLCI[3]  = lblPLCI03;  edtPLCI[3]  = edtPLCI03;   cbPLCI[3]  = cbPLCI03;
  71.     lblPLCI[4]  = lblPLCI04;  edtPLCI[4]  = edtPLCI04;   cbPLCI[4]  = cbPLCI04;
  72.     lblPLCI[5]  = lblPLCI05;  edtPLCI[5]  = edtPLCI05;   cbPLCI[5]  = cbPLCI05;
  73.     lblPLCI[6]  = lblPLCI06;  edtPLCI[6]  = edtPLCI06;   cbPLCI[6]  = cbPLCI06;
  74.     lblPLCI[7]  = lblPLCI07;  edtPLCI[7]  = edtPLCI07;   cbPLCI[7]  = cbPLCI07;
  75.     lblPLCI[8]  = lblPLCI08;  edtPLCI[8]  = edtPLCI08;   cbPLCI[8]  = cbPLCI08;
  76.     lblPLCI[9]  = lblPLCI09;  edtPLCI[9]  = edtPLCI09;   cbPLCI[9]  = cbPLCI09;
  77.     lblPLCI[10] = lblPLCI10;  edtPLCI[10] = edtPLCI10;   cbPLCI[10] = cbPLCI10;
  78.     lblPLCI[11] = lblPLCI11;  edtPLCI[11] = edtPLCI11;   cbPLCI[11] = cbPLCI11;
  79.     // MAC Protocol Timing Control
  80.     lblMPTC[0]  = lblMPTC00;  edtMPTC[0]  = edtMPTC00;   cbMPTC[0]  = cbMPTC00;
  81.     lblMPTC[1]  = lblMPTC01;  edtMPTC[1]  = edtMPTC01;   cbMPTC[1]  = cbMPTC01;
  82.     lblMPTC[2]  = lblMPTC02;  edtMPTC[2]  = edtMPTC02;   cbMPTC[2]  = cbMPTC02;
  83.     lblMPTC[3]  = lblMPTC03;  edtMPTC[3]  = edtMPTC03;   cbMPTC[3]  = cbMPTC03;
  84.     lblMPTC[4]  = lblMPTC04;  edtMPTC[4]  = edtMPTC04;   cbMPTC[4]  = cbMPTC04;
  85.     lblMPTC[5]  = lblMPTC05;  edtMPTC[5]  = edtMPTC05;   cbMPTC[5]  = cbMPTC05;
  86.     lblMPTC[6]  = lblMPTC06;  edtMPTC[6]  = edtMPTC06;   cbMPTC[6]  = cbMPTC06;
  87.     lblMPTC[7]  = lblMPTC07;  edtMPTC[7]  = edtMPTC07;   cbMPTC[7]  = cbMPTC07;
  88.     lblMPTC[8]  = lblMPTC08;  edtMPTC[8]  = edtMPTC08;   cbMPTC[8]  = cbMPTC08;
  89.     lblMPTC[9]  = lblMPTC09;  edtMPTC[9]  = edtMPTC09;   cbMPTC[9]  = cbMPTC09;
  90.     lblMPTC[10] = lblMPTC10;  edtMPTC[10] = edtMPTC10;   cbMPTC[10] = cbMPTC10;
  91.     lblMPTC[11] = lblMPTC11;  edtMPTC[11] = edtMPTC11;   cbMPTC[11] = cbMPTC11;
  92.     lblMPTC[12] = lblMPTC12;  edtMPTC[12] = edtMPTC12;   cbMPTC[12] = cbMPTC12;
  93.     lblMPTC[13] = lblMPTC13;  edtMPTC[13] = edtMPTC13;   cbMPTC[13] = cbMPTC13;
  94.     lblMPTC[14] = lblMPTC14;  edtMPTC[14] = edtMPTC14;   cbMPTC[14] = cbMPTC14;
  95.     lblMPTC[15] = lblMPTC15;  edtMPTC[15] = edtMPTC15;   cbMPTC[15] = cbMPTC15;
  96.     lblMPTC[16] = lblMPTC16;  edtMPTC[16] = edtMPTC16;   cbMPTC[16] = cbMPTC16;
  97.     lblMPTC[17] = lblMPTC17;  edtMPTC[17] = edtMPTC17;   cbMPTC[17] = cbMPTC17;
  98.     // NVA Control
  99.     lblNC[0] = lblNC0;    edtNC[0] = edtNC0;    cbNC[0] = cbNC0;
  100.     lblNC[1] = lblNC1;    edtNC[1] = edtNC1;    cbNC[1] = cbNC1;
  101.     lblNC[2] = lblNC2;    edtNC[2] = edtNC2;    cbNC[2] = cbNC2;
  102.     lblNC[3] = lblNC3;    edtNC[3] = edtNC3;    cbNC[3] = cbNC3;
  103.     // Beacon Generation
  104.     lblBG[0] = lblBG0;    edtBG[0] = edtBG0;    cbBG[0] = cbBG0;
  105.     lblBG[1] = lblBG1;    edtBG[1] = edtBG1;    cbBG[1] = cbBG1;
  106.     lblBG[2] = lblBG2;    edtBG[2] = edtBG2;    cbBG[2] = cbBG2;
  107.     lblBG[3] = lblBG3;    edtBG[3] = edtBG3;    cbBG[3] = cbBG3;
  108.     lblBG[4] = lblBG4;    edtBG[4] = edtBG4;    cbBG[4] = cbBG4;
  109.     lblBG[5] = lblBG5;    edtBG[5] = edtBG5;    cbBG[5] = cbBG5;
  110.     lblBG[6] = lblBG6;    edtBG[6] = edtBG6;    cbBG[6] = cbBG6;
  111.     lblBG[7] = lblBG7;    edtBG[7] = edtBG7;    cbBG[7] = cbBG7;
  112.     // Security Engine
  113.     lblSE[0]  = lblSE00;   edtSE[0]  = edtSE00;   cbSE[0]  = cbSE00;
  114.     lblSE[1]  = lblSE01;   edtSE[1]  = edtSE01;   cbSE[1]  = cbSE01;
  115.     lblSE[2]  = lblSE02;   edtSE[2]  = edtSE02;   cbSE[2]  = cbSE02;
  116.     lblSE[3]  = lblSE03;   edtSE[3]  = edtSE03;   cbSE[3]  = cbSE03;
  117.     lblSE[4]  = lblSE05;   edtSE[4]  = edtSE04;   cbSE[4]  = cbSE04;
  118.     lblSE[5]  = lblSE05;   edtSE[5]  = edtSE05;   cbSE[5]  = cbSE05;
  119.     lblSE[6]  = lblSE06;   edtSE[6]  = edtSE06;   cbSE[6]  = cbSE06;
  120.     lblSE[7]  = lblSE07;   edtSE[7]  = edtSE07;   cbSE[7]  = cbSE07;
  121.     lblSE[8]  = lblSE08;   edtSE[8]  = edtSE08;   cbSE[8]  = cbSE08;
  122.     lblSE[9]  = lblSE09;   edtSE[9]  = edtSE09;   cbSE[9]  = cbSE09;
  123.     lblSE[10] = lblSE10;   edtSE[10] = edtSE10;   cbSE[10] = cbSE10;
  124.     // Transmitter Control
  125.     lblTC[0]  = lblTC00;   edtTC[0]  = edtTC00;   cbTC[0]  = cbTC00;
  126.     lblTC[1]  = lblTC01;   edtTC[1]  = edtTC01;   cbTC[1]  = cbTC01;
  127.     lblTC[2]  = lblTC02;   edtTC[2]  = edtTC02;   cbTC[2]  = cbTC02;
  128.     lblTC[3]  = lblTC03;   edtTC[3]  = edtTC03;   cbTC[3]  = cbTC03;
  129.     lblTC[4]  = lblTC04;   edtTC[4]  = edtTC04;   cbTC[4]  = cbTC04;
  130.     lblTC[5]  = lblTC05;   edtTC[5]  = edtTC05;   cbTC[5]  = cbTC05;
  131.     lblTC[6]  = lblTC06;   edtTC[6]  = edtTC06;   cbTC[6]  = cbTC06;
  132.     lblTC[7]  = lblTC07;   edtTC[7]  = edtTC07;   cbTC[7]  = cbTC07;
  133.     lblTC[8]  = lblTC08;   edtTC[8]  = edtTC08;   cbTC[8]  = cbTC08;
  134.     lblTC[9]  = lblTC09;   edtTC[9]  = edtTC09;   cbTC[9]  = cbTC09;
  135.     lblTC[10] = lblTC10;   edtTC[10] = edtTC10;   cbTC[10] = cbTC10;
  136.     lblTC[11] = lblTC11;   edtTC[11]  = edtTC11;  cbTC[11] = cbTC11;
  137.     // Receiver Control
  138.     lblRC[0]  = lblRC00;   edtRC[0]  = edtRC00;   cbRC[0]  = cbRC00;
  139.     lblRC[1]  = lblRC01;   edtRC[1]  = edtRC01;   cbRC[1]  = cbRC01;
  140.     lblRC[2]  = lblRC02;   edtRC[2]  = edtRC02;   cbRC[2]  = cbRC02;
  141.     lblRC[3]  = lblRC03;   edtRC[3]  = edtRC03;   cbRC[3]  = cbRC03;
  142.     lblRC[4]  = lblRC04;   edtRC[4]  = edtRC04;   cbRC[4]  = cbRC04;
  143.     lblRC[5]  = lblRC05;   edtRC[5]  = edtRC05;   cbRC[5]  = cbRC05;
  144.     lblRC[6]  = lblRC06;   edtRC[6]  = edtRC06;   cbRC[6]  = cbRC06;
  145.     lblRC[7]  = lblRC07;   edtRC[7]  = edtRC07;   cbRC[7]  = cbRC07;
  146.     lblRC[8]  = lblRC08;   edtRC[8]  = edtRC08;   cbRC[8]  = cbRC08;
  147.     lblRC[9]  = lblRC09;   edtRC[9]  = edtRC09;   cbRC[9]  = cbRC09;
  148.     lblRC[10] = lblRC10;   edtRC[10] = edtRC10;   cbRC[10] = cbRC10;
  149.     lblRC[11] = lblRC11;   edtRC[11] = edtRC11;   cbRC[11] = cbRC11;
  150.     lblRC[12] = lblRC12;   edtRC[12] = edtRC12;   cbRC[12] = cbRC12;
  151.     lblRC[13] = lblRC13;   edtRC[13] = edtRC13;   cbRC[13] = cbRC13;
  152.     lblRC[14] = lblRC14;   edtRC[14] = edtRC14;   cbRC[14] = cbRC14;
  153.     // HIF
  154.     lblHIF[0] = lblHIF0;   edtHIF[0] = edtHIF0;   cbHIF[0] = cbHIF0;
  155.     lblHIF[1] = lblHIF1;   edtHIF[1] = edtHIF1;   cbHIF[1] = cbHIF1;
  156.     lblHIF[2] = lblHIF2;   edtHIF[2] = edtHIF2;   cbHIF[2] = cbHIF2;
  157.     lblHIF[3] = lblHIF3;   edtHIF[3] = edtHIF3;   cbHIF[3] = cbHIF3;
  158.     lblHIF[4] = lblHIF4;   edtHIF[4] = edtHIF4;   cbHIF[4] = cbHIF4;
  159.     lblHIF[5] = lblHIF5;   edtHIF[5] = edtHIF5;   cbHIF[5] = cbHIF5;
  160.     lblHIF[6] = lblHIF6;   edtHIF[6] = edtHIF6;   cbHIF[6] = cbHIF6;
  161.     lblHIF[7] = lblHIF7;   edtHIF[7] = edtHIF7;   cbHIF[7] = cbHIF7;
  162.     // Set MCR name
  163.     // System Control
  164.     m_sMCR_Setting[WIFI_MCR_SC][0].name = "SCR";
  165.     m_sMCR_Setting[WIFI_MCR_SC][1].name = "MRBS";
  166.     m_sMCR_Setting[WIFI_MCR_SC][2].name = "DEVID";
  167.     m_sMCR_Setting[WIFI_MCR_SC][3].name = "GPIOCR";
  168.     // Miscellaneous and Debug Port
  169.     m_sMCR_Setting[WIFI_MCR_MDP][0].name = "PRBCR";
  170.     m_sMCR_Setting[WIFI_MCR_MDP][1].name = "PRBSR";
  171.     m_sMCR_Setting[WIFI_MCR_MDP][2].name = "PFWDR";
  172.     m_sMCR_Setting[WIFI_MCR_MDP][3].name = "PRBDR";
  173.     m_sMCR_Setting[WIFI_MCR_MDP][4].name = "CTPR1";
  174.     m_sMCR_Setting[WIFI_MCR_MDP][5].name = "QCR";
  175.     m_sMCR_Setting[WIFI_MCR_MDP][6].name = "ISAR";
  176.     m_sMCR_Setting[WIFI_MCR_MDP][7].name = "IER";
  177.     m_sMCR_Setting[WIFI_MCR_MDP][8].name = "DRNGR";
  178.     m_sMCR_Setting[WIFI_MCR_MDP][9].name = "AIFSR";
  179.     m_sMCR_Setting[WIFI_MCR_MDP][10].name = "TQCWR";
  180.     m_sMCR_Setting[WIFI_MCR_MDP][11].name = "AC0CWR";
  181.     m_sMCR_Setting[WIFI_MCR_MDP][12].name = "AC1CWR";
  182.     m_sMCR_Setting[WIFI_MCR_MDP][13].name = "AC2CWR";
  183.     m_sMCR_Setting[WIFI_MCR_MDP][14].name = "AC3CWR";
  184.     m_sMCR_Setting[WIFI_MCR_MDP][15].name = "LNUIR0";
  185.     m_sMCR_Setting[WIFI_MCR_MDP][16].name = "LNUIR1";
  186.     m_sMCR_Setting[WIFI_MCR_MDP][17].name = "LNUIR2";
  187.     // Phyical Layer Control Interface
  188.     m_sMCR_Setting[WIFI_MCR_PLCI][0].name = "PCICR";
  189.     m_sMCR_Setting[WIFI_MCR_PLCI][1].name = "PBAR";
  190.     m_sMCR_Setting[WIFI_MCR_PLCI][2].name = "PPORCR0";
  191.     m_sMCR_Setting[WIFI_MCR_PLCI][3].name = "PPORCR1";
  192.     m_sMCR_Setting[WIFI_MCR_PLCI][4].name = "PPDRCR0";
  193.     m_sMCR_Setting[WIFI_MCR_PLCI][5].name = "PPDRCR1";
  194.     m_sMCR_Setting[WIFI_MCR_PLCI][6].name = "PPDRCR2";
  195.     m_sMCR_Setting[WIFI_MCR_PLCI][7].name = "PPMCR";
  196.     m_sMCR_Setting[WIFI_MCR_PLCI][8].name = "PSCR";
  197.     m_sMCR_Setting[WIFI_MCR_PLCI][9].name = "PSPR";
  198.     m_sMCR_Setting[WIFI_MCR_PLCI][10].name = "LCR";
  199.     m_sMCR_Setting[WIFI_MCR_PLCI][11].name = "ACR";
  200.     // MAC Protocol Timing Control
  201.     m_sMCR_Setting[WIFI_MCR_MPTC][0].name = "CWBR";
  202.     m_sMCR_Setting[WIFI_MCR_MPTC][1].name = "MPTR";
  203.     m_sMCR_Setting[WIFI_MCR_MPTC][2].name = "MPDR";
  204.     m_sMCR_Setting[WIFI_MCR_MPTC][3].name = "TNTDR";
  205.     m_sMCR_Setting[WIFI_MCR_MPTC][4].name = "STDR";
  206.     m_sMCR_Setting[WIFI_MCR_MPTC][5].name = "EPDDR";
  207.     m_sMCR_Setting[WIFI_MCR_MPTC][6].name = "CRFCR0";
  208.     m_sMCR_Setting[WIFI_MCR_MPTC][7].name = "CRFCR1";
  209.     m_sMCR_Setting[WIFI_MCR_MPTC][8].name = "DTR";
  210.     m_sMCR_Setting[WIFI_MCR_MPTC][9].name = "BCWR";
  211.     m_sMCR_Setting[WIFI_MCR_MPTC][10].name = "RFTPCR";
  212.     m_sMCR_Setting[WIFI_MCR_MPTC][11].name = "LTTR0";
  213.     m_sMCR_Setting[WIFI_MCR_MPTC][12].name = "LTTR1";
  214.     m_sMCR_Setting[WIFI_MCR_MPTC][13].name = "TTAR0";
  215.     m_sMCR_Setting[WIFI_MCR_MPTC][14].name = "TTAR1";
  216.     m_sMCR_Setting[WIFI_MCR_MPTC][15].name = "TTAR2";
  217.     m_sMCR_Setting[WIFI_MCR_MPTC][16].name = "TTSCS";
  218.     m_sMCR_Setting[WIFI_MCR_MPTC][17].name = "TTTC";
  219.     // NVA Control
  220.     m_sMCR_Setting[WIFI_MCR_NC][0].name = "LNR";
  221.     m_sMCR_Setting[WIFI_MCR_NC][1].name = "NRTR";
  222.     m_sMCR_Setting[WIFI_MCR_NC][2].name = "NSUR";
  223.     m_sMCR_Setting[WIFI_MCR_NC][3].name = "TTIC";
  224.     // Beacon Generation
  225.     m_sMCR_Setting[WIFI_MCR_BG][0].name = "BGCR0";
  226.     m_sMCR_Setting[WIFI_MCR_BG][1].name = "BGCR1";
  227.     m_sMCR_Setting[WIFI_MCR_BG][2].name = "SWBCCR";
  228.     m_sMCR_Setting[WIFI_MCR_BG][3].name = "SWBCDR";
  229.     m_sMCR_Setting[WIFI_MCR_BG][4].name = "ARRCR";
  230.     m_sMCR_Setting[WIFI_MCR_BG][5].name = "AFRCR";
  231.     m_sMCR_Setting[WIFI_MCR_BG][6].name = "ATFCR";
  232.     m_sMCR_Setting[WIFI_MCR_BG][7].name = "ATBCR";
  233.     // Security Engine
  234.     m_sMCR_Setting[WIFI_MCR_SE][0].name = "SKACR";
  235.     m_sMCR_Setting[WIFI_MCR_SE][1].name = "SKADR0";
  236.     m_sMCR_Setting[WIFI_MCR_SE][2].name = "SKADR1";
  237.     m_sMCR_Setting[WIFI_MCR_SE][3].name = "SKADR2";
  238.     m_sMCR_Setting[WIFI_MCR_SE][4].name = "SKADR3";
  239.     m_sMCR_Setting[WIFI_MCR_SE][5].name = "SKADR4";
  240.     m_sMCR_Setting[WIFI_MCR_SE][6].name = "SKADR5";
  241.     m_sMCR_Setting[WIFI_MCR_SE][7].name = "SCPR0";
  242.     m_sMCR_Setting[WIFI_MCR_SE][8].name = "SCPR1";
  243.     m_sMCR_Setting[WIFI_MCR_SE][9].name = "SKADR6";
  244.     m_sMCR_Setting[WIFI_MCR_SE][10].name = "SKADR7";
  245.     // Transmitter Control
  246.     m_sMCR_Setting[WIFI_MCR_TC][0].name = "ACWLR";
  247.     m_sMCR_Setting[WIFI_MCR_TC][1].name = "MPTCR";
  248.     m_sMCR_Setting[WIFI_MCR_TC][2].name = "NPTCR";
  249.     m_sMCR_Setting[WIFI_MCR_TC][3].name = "NTTCR";
  250.     m_sMCR_Setting[WIFI_MCR_TC][4].name = "TXOPGBNTCR";
  251.     m_sMCR_Setting[WIFI_MCR_TC][5].name = "NDTCR";
  252.     m_sMCR_Setting[WIFI_MCR_TC][6].name = "NCSTCR";
  253.     m_sMCR_Setting[WIFI_MCR_TC][7].name = "ACTXOPR0";
  254.     m_sMCR_Setting[WIFI_MCR_TC][8].name = "ACTXOPR1";
  255.     m_sMCR_Setting[WIFI_MCR_TC][9].name = "TSTGPCR";
  256.     m_sMCR_Setting[WIFI_MCR_TC][10].name = "TSTNTCR0";
  257.     m_sMCR_Setting[WIFI_MCR_TC][11].name = "TSTNTCR1";
  258.     // Receiver Control
  259.     m_sMCR_Setting[WIFI_MCR_RC][0].name = "DRCR";
  260.     m_sMCR_Setting[WIFI_MCR_RC][1].name = "RFECR";
  261.     m_sMCR_Setting[WIFI_MCR_RC][2].name = "RFFCR";
  262.     m_sMCR_Setting[WIFI_MCR_RC][3].name = "RPCR";
  263.     m_sMCR_Setting[WIFI_MCR_RC][4].name = "CICR";
  264.     m_sMCR_Setting[WIFI_MCR_RC][5].name = "CACR";
  265.     m_sMCR_Setting[WIFI_MCR_RC][6].name = "CATR";
  266.     m_sMCR_Setting[WIFI_MCR_RC][7].name = "CSACR";
  267.     m_sMCR_Setting[WIFI_MCR_RC][8].name = "RFBCR";
  268.     m_sMCR_Setting[WIFI_MCR_RC][9].name = "OMAR0";
  269.     m_sMCR_Setting[WIFI_MCR_RC][10].name = "OMAR1";
  270.     m_sMCR_Setting[WIFI_MCR_RC][11].name = "CBR0";
  271.     m_sMCR_Setting[WIFI_MCR_RC][12].name = "CBR1";
  272.     m_sMCR_Setting[WIFI_MCR_RC][13].name = "AMAR0";
  273.     m_sMCR_Setting[WIFI_MCR_RC][14].name = "AMAR1";
  274.     // HIF_HPI
  275.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][0].name = "HPI_CHIPID";
  276.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][1].name = "HPI_MAC_STS";
  277.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][2].name = "HPI_CTRL";
  278.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][3].name = "HPI_POWER_CTRL";
  279.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][4].name = "TX_DATA_PORT";
  280.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][5].name = "TX_STATUS_PORT";
  281.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][6].name = "RX_STATUS_PORT";
  282.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][7].name = "RX_DATA_PORT";
  283.     // Set read only property
  284.     for( i=0; i<WIFI_MCR_TYPE_NUM; i++ )
  285.     {
  286.         for( j=0; j<WIFI_MCR_MAX_NUM; j++ )
  287.         {    m_sMCR_Setting[i][j].RO = false;
  288.         }
  289.     }
  290.     m_sMCR_Setting[WIFI_MCR_SC][2].RO = true; // DEVID
  291.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][0].RO = true; // HPI_CHIPID
  292.     // Set read/clear property
  293.     for( i=0; i<WIFI_MCR_TYPE_NUM; i++ )
  294.     {
  295.         for( j=0; j<WIFI_MCR_MAX_NUM; j++ )
  296.         {    m_sMCR_Setting[i][j].RC = false;
  297.         }
  298.     }
  299.     for( i=0; i<4; i++ )
  300.     {
  301.         m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][i].RC = false;
  302.     }
  303.     for( i=4; i<8; i++ )
  304.     {
  305.         m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][i].RC = true;
  306.     }
  307.     // Set address
  308.     // System Control
  309.     m_sMCR_Setting[WIFI_MCR_SC][0].addr = 0x0000; // "SCR";
  310.     m_sMCR_Setting[WIFI_MCR_SC][1].addr = 0x0018; // "MRBS";
  311.     m_sMCR_Setting[WIFI_MCR_SC][2].addr = 0x0020; // "DEVID";
  312.     m_sMCR_Setting[WIFI_MCR_SC][3].addr = 0x0050; // "GPIOCR";
  313.     // Miscellaneous and Debug Port
  314.     m_sMCR_Setting[WIFI_MCR_MDP][0].addr = 0x0080; // "PRBCR";
  315.     m_sMCR_Setting[WIFI_MCR_MDP][1].addr = 0x0084; // "PRBSR";
  316.     m_sMCR_Setting[WIFI_MCR_MDP][2].addr = 0x0088; // "PFWDR";
  317.     m_sMCR_Setting[WIFI_MCR_MDP][3].addr = 0x008C; // "PRBDR";
  318.     m_sMCR_Setting[WIFI_MCR_MDP][4].addr = 0x0094; // "CTPR1";
  319.     m_sMCR_Setting[WIFI_MCR_MDP][5].addr = 0x0100; // "QCR";
  320.     m_sMCR_Setting[WIFI_MCR_MDP][6].addr = 0x0104; // "ISAR";
  321.     m_sMCR_Setting[WIFI_MCR_MDP][7].addr = 0x0108; // "IER";
  322.     m_sMCR_Setting[WIFI_MCR_MDP][8].addr = 0x0188; // "DRNGR";
  323.     m_sMCR_Setting[WIFI_MCR_MDP][9].addr = 0x018C; // "AIFSR";
  324.     m_sMCR_Setting[WIFI_MCR_MDP][10].addr = 0x0190; // "TQCWR";
  325.     m_sMCR_Setting[WIFI_MCR_MDP][11].addr = 0x0194; // "AC0CWR";
  326.     m_sMCR_Setting[WIFI_MCR_MDP][12].addr = 0x0198; // "AC1CWR";
  327.     m_sMCR_Setting[WIFI_MCR_MDP][13].addr = 0x019C; // "AC2CWR";
  328.     m_sMCR_Setting[WIFI_MCR_MDP][14].addr = 0x01A0; // "AC3CWR";
  329.     m_sMCR_Setting[WIFI_MCR_MDP][15].addr = 0x0500; // "LNUIR0";
  330.     m_sMCR_Setting[WIFI_MCR_MDP][16].addr = 0x0504; // "LNUIR1";
  331.     m_sMCR_Setting[WIFI_MCR_MDP][17].addr = 0x0508; // "LNUIR2";
  332.     // Phyical Layer Control Interface
  333.     m_sMCR_Setting[WIFI_MCR_PLCI][0].addr = 0x0240; // "PCICR";
  334.     m_sMCR_Setting[WIFI_MCR_PLCI][1].addr = 0x0248; // "PBAR";
  335.     m_sMCR_Setting[WIFI_MCR_PLCI][2].addr = 0x0280; // "PPORCR0";
  336.     m_sMCR_Setting[WIFI_MCR_PLCI][3].addr = 0x0284; // "PPORCR1";
  337.     m_sMCR_Setting[WIFI_MCR_PLCI][4].addr = 0x0288; // "PPDRCR0";
  338.     m_sMCR_Setting[WIFI_MCR_PLCI][5].addr = 0x028C; // "PPDRCR1";
  339.     m_sMCR_Setting[WIFI_MCR_PLCI][6].addr = 0x0290; // "PPDRCR2";
  340.     m_sMCR_Setting[WIFI_MCR_PLCI][7].addr = 0x0294; // "PPMCR";
  341.     m_sMCR_Setting[WIFI_MCR_PLCI][8].addr = 0x02A0; // "PSCR";
  342.     m_sMCR_Setting[WIFI_MCR_PLCI][9].addr = 0x02A4; // "PSPR";
  343.     m_sMCR_Setting[WIFI_MCR_PLCI][10].addr = 0x02A8; // "LCR";
  344.     m_sMCR_Setting[WIFI_MCR_PLCI][11].addr = 0x02AC; // "ACR";
  345.     // MAC Protocol Timing Control
  346.     m_sMCR_Setting[WIFI_MCR_MPTC][0].addr = 0x03F8; // "CWBR";
  347.     m_sMCR_Setting[WIFI_MCR_MPTC][1].addr = 0x03FC; // "MPTR";
  348.     m_sMCR_Setting[WIFI_MCR_MPTC][2].addr = 0x0400; // "MPDR";
  349.     m_sMCR_Setting[WIFI_MCR_MPTC][3].addr = 0x0404; // "TNTDR";
  350.     m_sMCR_Setting[WIFI_MCR_MPTC][4].addr = 0x0408; // "STDR";
  351.     m_sMCR_Setting[WIFI_MCR_MPTC][5].addr = 0x040C; // "EPDDR";
  352.     m_sMCR_Setting[WIFI_MCR_MPTC][6].addr = 0x0410; // "CRFCR0";
  353.     m_sMCR_Setting[WIFI_MCR_MPTC][7].addr = 0x0414; // "CRFCR1";
  354.     m_sMCR_Setting[WIFI_MCR_MPTC][8].addr = 0x0418; // "DTR";
  355.     m_sMCR_Setting[WIFI_MCR_MPTC][9].addr = 0x041C; // "BCWR";
  356.     m_sMCR_Setting[WIFI_MCR_MPTC][10].addr = 0x0420; // "RFTPCR";
  357.     m_sMCR_Setting[WIFI_MCR_MPTC][11].addr = 0x0440; // "LTTR0";
  358.     m_sMCR_Setting[WIFI_MCR_MPTC][12].addr = 0x0444; // "LTTR1";
  359.     m_sMCR_Setting[WIFI_MCR_MPTC][13].addr = 0x0448; // "TTAR0";
  360.     m_sMCR_Setting[WIFI_MCR_MPTC][14].addr = 0x044C; // "TTAR1";
  361.     m_sMCR_Setting[WIFI_MCR_MPTC][15].addr = 0x0450; // "TTAR2";
  362.     m_sMCR_Setting[WIFI_MCR_MPTC][16].addr = 0x0454; // "TTSCS";
  363.     m_sMCR_Setting[WIFI_MCR_MPTC][17].addr = 0x0458; // "TTTC";
  364.     // NVA Control
  365.     m_sMCR_Setting[WIFI_MCR_NC][0].addr = 0x0470; // "LNR";
  366.     m_sMCR_Setting[WIFI_MCR_NC][1].addr = 0x0474; // "NRTR";
  367.     m_sMCR_Setting[WIFI_MCR_NC][2].addr = 0x0478; // "NSUR";
  368.     m_sMCR_Setting[WIFI_MCR_NC][3].addr = 0x047C; // "TTIC";
  369.     // Beacon Generation
  370.     m_sMCR_Setting[WIFI_MCR_BG][0].addr = 0x0480; // "BGCR0";
  371.     m_sMCR_Setting[WIFI_MCR_BG][1].addr = 0x0484; // "BGCR1";
  372.     m_sMCR_Setting[WIFI_MCR_BG][2].addr = 0x0488; // "SWBCCR";
  373.     m_sMCR_Setting[WIFI_MCR_BG][3].addr = 0x048C; // "SWBCDR";
  374.     m_sMCR_Setting[WIFI_MCR_BG][4].addr = 0x0490; // "ARRCR";
  375.     m_sMCR_Setting[WIFI_MCR_BG][5].addr = 0x0494; // "AFRCR";
  376.     m_sMCR_Setting[WIFI_MCR_BG][6].addr = 0x0498; // "ATFCR";
  377.     m_sMCR_Setting[WIFI_MCR_BG][7].addr = 0x049C; // "ATBCR";
  378.     // Security Engine
  379.     m_sMCR_Setting[WIFI_MCR_SE][0].addr = 0x0200; // "SKACR";
  380.     m_sMCR_Setting[WIFI_MCR_SE][1].addr = 0x0204; // "SKADR0";
  381.     m_sMCR_Setting[WIFI_MCR_SE][2].addr = 0x0208; // "SKADR1";
  382.     m_sMCR_Setting[WIFI_MCR_SE][3].addr = 0x020C; // "SKADR2";
  383.     m_sMCR_Setting[WIFI_MCR_SE][4].addr = 0x0210; // "SKADR3";
  384.     m_sMCR_Setting[WIFI_MCR_SE][5].addr = 0x0214; // "SKADR4";
  385.     m_sMCR_Setting[WIFI_MCR_SE][6].addr = 0x0218; // "SKADR5";
  386.     m_sMCR_Setting[WIFI_MCR_SE][7].addr = 0x021C; // "SCPR0";
  387.     m_sMCR_Setting[WIFI_MCR_SE][8].addr = 0x0220; // "SCPR1";
  388.     m_sMCR_Setting[WIFI_MCR_SE][9].addr = 0x0224; // "SKADR6";
  389.     m_sMCR_Setting[WIFI_MCR_SE][10].addr = 0x0228; // "SKADR7";
  390.     // Transmitter Control
  391.     m_sMCR_Setting[WIFI_MCR_TC][0].addr = 0x0300; // "ACWLR";
  392.     m_sMCR_Setting[WIFI_MCR_TC][1].addr = 0x0304; // "MPTCR";
  393.     m_sMCR_Setting[WIFI_MCR_TC][2].addr = 0x0308; // "NPTCR";
  394.     m_sMCR_Setting[WIFI_MCR_TC][3].addr = 0x030C; // "NTTCR";
  395.     m_sMCR_Setting[WIFI_MCR_TC][4].addr = 0x0310; // "TXOPGBNTCR";
  396.     m_sMCR_Setting[WIFI_MCR_TC][5].addr = 0x0314; // "NDTCR";
  397.     m_sMCR_Setting[WIFI_MCR_TC][6].addr = 0x0318; // "NCSTCR";
  398.     m_sMCR_Setting[WIFI_MCR_TC][7].addr = 0x031C; // "ACTXOPR0";
  399.     m_sMCR_Setting[WIFI_MCR_TC][8].addr = 0x0320; // "ACTXOPR1";
  400.     m_sMCR_Setting[WIFI_MCR_TC][9].addr = 0x0324; // "TSTGPCR";
  401.     m_sMCR_Setting[WIFI_MCR_TC][10].addr = 0x0328; // "TSTNTCR0";
  402.     m_sMCR_Setting[WIFI_MCR_TC][11].addr = 0x032C; // "TSTNTCR1";
  403.     // Receiver Control
  404.     m_sMCR_Setting[WIFI_MCR_RC][0].addr = 0x0360; // "DRCR";
  405.     m_sMCR_Setting[WIFI_MCR_RC][1].addr = 0x0364; // "RFECR";
  406.     m_sMCR_Setting[WIFI_MCR_RC][2].addr = 0x0368; // "RFFCR";
  407.     m_sMCR_Setting[WIFI_MCR_RC][3].addr = 0x036C; // "RPCR";
  408.     m_sMCR_Setting[WIFI_MCR_RC][4].addr = 0x0370; // "CICR";
  409.     m_sMCR_Setting[WIFI_MCR_RC][5].addr = 0x0374; // "CACR";
  410.     m_sMCR_Setting[WIFI_MCR_RC][6].addr = 0x0378; // "CATR";
  411.     m_sMCR_Setting[WIFI_MCR_RC][7].addr = 0x037C; // "CSACR";
  412.     m_sMCR_Setting[WIFI_MCR_RC][8].addr = 0x0380; // "RFBCR";
  413.     m_sMCR_Setting[WIFI_MCR_RC][9].addr = 0x03A0; // "OMAR0";
  414.     m_sMCR_Setting[WIFI_MCR_RC][10].addr = 0x03A4; // "OMAR1";
  415.     m_sMCR_Setting[WIFI_MCR_RC][11].addr = 0x03A8; // "CBR0";
  416.     m_sMCR_Setting[WIFI_MCR_RC][12].addr = 0x03AC; // "CBR1";
  417.     m_sMCR_Setting[WIFI_MCR_RC][13].addr = 0x03B0; // "AMAR0";
  418.     m_sMCR_Setting[WIFI_MCR_RC][14].addr = 0x03B4; // "AMAR1";
  419.     // HIF_HPI
  420.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][0].addr = 0x780; // "HPI_CHIPID";
  421.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][1].addr = 0x78C; // "HPI_MAC_STS";
  422.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][2].addr = 0x7FC; // "HPI_CTRL";
  423.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][3].addr = 0x7FE; // "HPI_POWER_CTRL";
  424.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][4].addr = 0x600; // "TX_DATA_PORT";
  425.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][5].addr = 0x640; // "TX_STATUS_PORT";
  426.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][6].addr = 0x680; // "RX_STATUS_PORT";
  427.     m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][7].addr = 0x6c0; // "RX_DATA_PORT";
  428.     // Set value
  429.     for( i=0; i<WIFI_MCR_TYPE_NUM; i++ )
  430.     {
  431.         for( j=0; j<WIFI_MCR_MAX_NUM; j++ )
  432.         {    m_sMCR_Setting[i][j].value = 0;
  433.         }
  434.     }
  435.     // Set checked property
  436.     for( i=0; i<WIFI_MCR_TYPE_NUM; i++ )
  437.     {
  438.         for( j=0; j<WIFI_MCR_MAX_NUM; j++ )
  439.         {    m_sMCR_Setting[i][j].checked = false;
  440.         }
  441.     }
  442.     Init();
  443. }
  444. //---------------------------------------------------------------------------
  445. void TfrmWiFiMCR::Init( void )
  446. {
  447.      m_bInit          = true;
  448. }
  449. //---------------------------------------------------------------------------
  450. void TfrmWiFiMCR::ReDrawFields( int idx )
  451. {
  452.     int i;
  453.     char  str[256];
  454.     if( idx & DRAW_MCR_COMMON )
  455.     {
  456.         // system control register
  457.         if( 0 == btnSYSMACMCRData->Tag ) // Dec
  458.         {
  459.             btnSYSMACMCRData->Caption = "MCR Data (Dec)";
  460.             // System Control
  461.             for( i=0; i<WIFI_SC_NUM; i++ )
  462.             {   edtSC[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_SC][i].value );
  463.             }
  464.             // Miscellaneous and Debug Port
  465.             for( i=0; i<WIFI_MDP_NUM; i++ )
  466.             {   edtMDP[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_MDP][i].value );
  467.             }
  468.             // Phyical Layer Control Interface
  469.             for( i=0; i<WIFI_PLCI_NUM; i++ )
  470.             {   edtPLCI[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_PLCI][i].value );
  471.             }
  472.             // MAC Protocol Timing Control
  473.             for( i=0; i<WIFI_MPTC_NUM; i++ )
  474.             {   edtMPTC[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_MPTC][i].value );
  475.             }
  476.             // NVA Control
  477.             for( i=0; i<WIFI_NC_NUM; i++ )
  478.             {   edtNC[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_NC][i].value );
  479.             }
  480.             // Beacon Generation
  481.             for( i=0; i<WIFI_BG_NUM; i++ )
  482.             {   edtBG[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_BG][i].value );
  483.             }
  484.         }
  485.         else
  486.         {
  487.             btnSYSMACMCRData->Caption = "MCR Data (Hex)";
  488.             // System Control
  489.             for( i=0; i<WIFI_SC_NUM; i++ )
  490.             {
  491.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_SC][i].value );
  492.                 edtSC[i]->Text = str;
  493.             }
  494.             // Miscellaneous and Debug Port
  495.             for( i=0; i<WIFI_MDP_NUM; i++ )
  496.             {
  497.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_MDP][i].value );
  498.                 edtMDP[i]->Text = str;
  499.             }
  500.             // Phyical Layer Control Interface
  501.             for( i=0; i<WIFI_PLCI_NUM; i++ )
  502.             {
  503.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_PLCI][i].value );
  504.                 edtPLCI[i]->Text = str;
  505.             }
  506.             // MAC Protocol Timing Control
  507.             for( i=0; i<WIFI_MPTC_NUM; i++ )
  508.             {
  509.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_MPTC][i].value );
  510.                 edtMPTC[i]->Text = str;
  511.             }
  512.             // NVA Control
  513.             for( i=0; i<WIFI_NC_NUM; i++ )
  514.             {
  515.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_NC][i].value );
  516.                 edtNC[i]->Text = str;
  517.             }
  518.             // Beacon Generation
  519.             for( i=0; i<WIFI_BG_NUM; i++ )
  520.             {
  521.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_BG][i].value );
  522.                 edtBG[i]->Text = str;
  523.             }
  524.         }
  525.     }
  526.     // TX/RX Releated register
  527.     if( 0 == btnTRXMACMCRData->Tag ) // Dec
  528.     {
  529.         btnTRXMACMCRData->Caption = "MCR Data (Dec)";
  530.         if( idx & DRAW_MCR_COMMON )
  531.         {
  532.             // Security Engine
  533.             for( i=0; i<WIFI_SE_NUM; i++ )
  534.             {   edtSE[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_SE][i].value );
  535.             }
  536.             // Transmitter Control
  537.             for( i=0; i<WIFI_TC_NUM; i++ )
  538.             {   edtTC[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_TC][i].value );
  539.             }
  540.             // Receiver Control
  541.             for( i=0; i<WIFI_RC_NUM; i++ )
  542.             {   edtRC[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_RC][i].value );
  543.             }
  544.         }
  545.         if( idx & DRAW_MCR_HIF )
  546.         {
  547.             // HIF
  548.             switch( m_sWiFiCap.host_interface )
  549.             {
  550.                 case WNDRV_HOST_INTERFACE_SDIO:
  551.                 {
  552.                     for( i=0; i<WIFI_HIF_SDIO_NUM; i++ )
  553.                     {   edtHIF[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_HIF_SDIO][i].value );
  554.                     }
  555.                 }
  556.                 break;
  557.                 case WNDRV_HOST_INTERFACE_HPI:
  558.                 {
  559.                     for( i=0; i<WIFI_HIF_HPI_NUM; i++ )
  560.                     {   edtHIF[i]->Text = IntToStr( m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][i].value );
  561.                     }
  562.                 }
  563.                 break;
  564.                 case WNDRV_HOST_INTERFACE_SPI:
  565.                 {
  566.                     for( i=0; i<WIFI_HIF_SPI_NUM; i++ )
  567.                     {   edtHIF[i]->Text = IntToStr( m_sMCR_Setting[WIFI_MCR_HIF_SPI][i].value );
  568.                     }
  569.                 }
  570.                 break;
  571.             }
  572.         }
  573.     }
  574.     else
  575.     {
  576.         btnTRXMACMCRData->Caption = "MCR Data (Hex)";
  577.         if( idx & DRAW_MCR_COMMON )
  578.         {
  579.             // Security Engine
  580.             for( i=0; i<WIFI_SE_NUM; i++ )
  581.             {
  582.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_SE][i].value );
  583.                 edtSE[i]->Text = str;
  584.             }
  585.             // Transmitter Control
  586.             for( i=0; i<WIFI_TC_NUM; i++ )
  587.             {
  588.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_TC][i].value );
  589.                 edtTC[i]->Text = str;
  590.             }
  591.             // Receiver Control
  592.             for( i=0; i<WIFI_RC_NUM; i++ )
  593.             {
  594.                 sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_RC][i].value );
  595.                 edtRC[i]->Text = str;
  596.             }
  597.         }
  598.         if( idx & DRAW_MCR_HIF )
  599.         {
  600.             // HIF
  601.             switch( m_sWiFiCap.host_interface )
  602.             {
  603.                 case WNDRV_HOST_INTERFACE_SDIO:
  604.                 {
  605.                     for( i=0; i<WIFI_HIF_SDIO_NUM; i++ )
  606.                     {
  607.                         sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_HIF_SDIO][i].value );
  608.                         edtHIF[i]->Text = str;
  609.                     }
  610.                 }
  611.                 break;
  612.                 case WNDRV_HOST_INTERFACE_HPI:
  613.                 {
  614.                     for( i=0; i<WIFI_HIF_HPI_NUM; i++ )
  615.                     {
  616.                         sprintf( str, "%X", m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][i].value );
  617.                         edtHIF[i]->Text = str;
  618.                     }
  619.                 }
  620.                 break;
  621.                 case WNDRV_HOST_INTERFACE_SPI:
  622.                 {
  623.                     for( i=0; i<WIFI_HIF_SPI_NUM; i++ )
  624.                     {
  625.                         sprintf( str, "%X", m_sMCR_Setting[WIFI_MCR_HIF_SPI][i].value );
  626.                         edtHIF[i]->Text = str;
  627.                     }
  628.                 }
  629.                 break;
  630.             }
  631.         }
  632.     }
  633. }
  634. //---------------------------------------------------------------------------
  635. bool TfrmWiFiMCR::CheckFields( void )
  636. {
  637.     int i;
  638.     unsigned int         uidata[WIFI_MCR_MAX_NUM];
  639.     AnsiString text;
  640.     
  641.     // system control register
  642.     if( 0 == btnSYSMACMCRData->Tag ) // Dec
  643.     {
  644.         // System Control
  645.         for( i=0; i<WIFI_SC_NUM; i++ )
  646.         {   text = edtSC[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtSC[i]);   return false;   }
  647.         }
  648.         // Miscellaneous and Debug Port
  649.         for( i=0; i<WIFI_MDP_NUM; i++ )
  650.         {   text = edtMDP[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtMDPCheck(edtMDP[i]);   return false;   }
  651.         }
  652.         // Phyical Layer Control Interface
  653.         for( i=0; i<WIFI_PLCI_NUM; i++ )
  654.         {   text = edtPLCI[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtPLCICheck(edtPLCI[i]);   return false;   }
  655.         }
  656.         // MAC Protocol Timing Control
  657.         for( i=0; i<WIFI_MPTC_NUM; i++ )
  658.         {   text = edtMPTC[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtMPTCCheck(edtMPTC[i]);   return false;   }
  659.         }
  660.         // NVA Control
  661.         for( i=0; i<WIFI_NC_NUM; i++ )
  662.         {   text = edtNC[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtMPTCCheck(edtNC[i]);   return false;   }
  663.         }
  664.         // Beacon Generation
  665.         for( i=0; i<WIFI_BG_NUM; i++ )
  666.         {   text = edtBG[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtMPTCCheck(edtBG[i]);   return false;   }
  667.         }
  668.     }
  669.     else // Hex
  670.     {
  671.         // System Control
  672.         for( i=0; i<WIFI_SC_NUM; i++ )
  673.         {   text = edtSC[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtSC[i]);   return false;   }
  674.         }
  675.         // Miscellaneous and Debug Port
  676.         for( i=0; i<WIFI_MDP_NUM; i++ )
  677.         {   text = edtMDP[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtMDPCheck(edtMDP[i]);   return false;   }
  678.         }
  679.         // Phyical Layer Control Interface
  680.         for( i=0; i<WIFI_PLCI_NUM; i++ )
  681.         {   text = edtPLCI[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtPLCICheck(edtPLCI[i]);   return false;   }
  682.         }
  683.         // MAC Protocol Timing Control
  684.         for( i=0; i<WIFI_MPTC_NUM; i++ )
  685.         {   text = edtMPTC[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtMPTCCheck(edtMPTC[i]);   return false;   }
  686.         }
  687.         // NVA Control
  688.         for( i=0; i<WIFI_NC_NUM; i++ )
  689.         {   text = edtNC[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtMPTCCheck(edtNC[i]);   return false;   }
  690.         }
  691.         // Beacon Generation
  692.         for( i=0; i<WIFI_BG_NUM; i++ )
  693.         {   text = edtBG[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtMPTCCheck(edtBG[i]);   return false;   }
  694.         }
  695.     }
  696.     // TX/RX related register
  697.     if( 0 == btnTRXMACMCRData->Tag ) // Dec
  698.     {
  699.         // Security Engine
  700.         for( i=0; i<WIFI_SE_NUM; i++ )
  701.         {   text = edtSE[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtSE[i]);   return false;   }
  702.         }
  703.         // Transmitter Control
  704.         for( i=0; i<WIFI_TC_NUM; i++ )
  705.         {   text = edtTC[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtTC[i]);   return false;   }
  706.         }
  707.         // Receiver Control
  708.         for( i=0; i<WIFI_RC_NUM; i++ )
  709.         {   text = edtRC[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtRC[i]);   return false;   }
  710.         }
  711.         // HIF_HPI
  712.         for( i=0; i<WIFI_HIF_HPI_NUM; i++ )
  713.         {   text = edtHIF[i]->Text;  if( !IsValidDecWiFiMacRegValue( text, uidata[i] ) )         {  edtHIFCheck(edtHIF[i]);   return false;   }
  714.         }
  715.     }
  716.     else
  717.     {
  718.         // Security Engine
  719.         for( i=0; i<WIFI_SE_NUM; i++ )
  720.         {   text = edtSE[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtSE[i]);   return false;   }
  721.         }
  722.         // Transmitter Control
  723.         for( i=0; i<WIFI_TC_NUM; i++ )
  724.         {   text = edtTC[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtTC[i]);   return false;   }
  725.         }
  726.         // Receiver Control
  727.         for( i=0; i<WIFI_RC_NUM; i++ )
  728.         {   text = edtRC[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtSCCheck(edtRC[i]);   return false;   }
  729.         }
  730.         // HIF_HPI
  731.         for( i=0; i<WIFI_HIF_HPI_NUM; i++ )
  732.         {   text = edtHIF[i]->Text;  if( !IsValidHexWiFiMacRegValue( text, uidata[i] ) )         {  edtHIFCheck(edtHIF[i]);   return false;   }
  733.         }
  734.     }
  735.     return true;
  736. }
  737. //---------------------------------------------------------------------------
  738. void  TfrmWiFiMCR::CurrentPageLock( void )
  739. {
  740. }
  741. //---------------------------------------------------------------------------
  742. void  TfrmWiFiMCR::CurrentPageReset( void )
  743. {
  744. }
  745. //---------------------------------------------------------------------------
  746. void  TfrmWiFiMCR::ShowHintLabel( TControl *sender, char* hint )
  747. {
  748.    TPoint pt0 = this->ClientOrigin;
  749.    TPoint pt1 = sender->ClientOrigin;
  750.    lblHint->Left = (pt1.x-pt0.x);
  751.    lblHint->Top  = (pt1.y-pt0.y)+sender->Height+3;
  752.    lblHint->Caption = hint;
  753.    lblHint->Visible = true;
  754.    HintTimer->Enabled = true;
  755. }
  756. //---------------------------------------------------------------------------
  757. void __fastcall TfrmWiFiMCR::edtSCCheck(TObject *Sender)
  758. {
  759.     AnsiString  text;
  760.     unsigned int  uidata;
  761.     int  band;
  762.     TEdit *edit = (TEdit*)Sender;
  763.     char  hint[] = " character is not valid ";
  764.     text = edit->Text;
  765.     if( 0 == btnSYSMACMCRData->Tag )  // Dec
  766.     {
  767.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  768.         {
  769.             ShowHintLabel( edit, hint );
  770.             edit->SetFocus();
  771.             return;
  772.         }
  773.     }
  774.     else  // Hex
  775.     {
  776.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  777.         {
  778.             ShowHintLabel( edit, hint );
  779.             edit->SetFocus();
  780.             return;
  781.         }
  782.     }
  783.     m_sMCR_Setting[WIFI_MCR_SC][edit->Tag].value = uidata;
  784. }
  785. //---------------------------------------------------------------------------
  786. void __fastcall TfrmWiFiMCR::edtMDPCheck(TObject *Sender)
  787. {
  788.     AnsiString  text;
  789.     unsigned int  uidata;
  790.     int  band;
  791.     TEdit *edit = (TEdit*)Sender;
  792.     char  hint[] = " character is not valid ";
  793.     text = edit->Text;
  794.     if( 0 == btnSYSMACMCRData->Tag )  // Dec
  795.     {
  796.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  797.         {
  798.             ShowHintLabel( edit, hint );
  799.             edit->SetFocus();
  800.             return;
  801.         }
  802.     }
  803.     else  // Hex
  804.     {
  805.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  806.         {
  807.             ShowHintLabel( edit, hint );
  808.             edit->SetFocus();
  809.             return;
  810.         }
  811.     }
  812.     m_sMCR_Setting[WIFI_MCR_MDP][edit->Tag].value = uidata;
  813. }
  814. //---------------------------------------------------------------------------
  815. void __fastcall TfrmWiFiMCR::edtPLCICheck(TObject *Sender)
  816. {
  817.     AnsiString  text;
  818.     unsigned int  uidata;
  819.     int  band;
  820.     TEdit *edit = (TEdit*)Sender;
  821.     char  hint[] = " character is not valid ";
  822.     text = edit->Text;
  823.     if( 0 == btnSYSMACMCRData->Tag )  // Dec
  824.     {
  825.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  826.         {
  827.             ShowHintLabel( edit, hint );
  828.             edit->SetFocus();
  829.             return;
  830.         }
  831.     }
  832.     else  // Hex
  833.     {
  834.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  835.         {
  836.             ShowHintLabel( edit, hint );
  837.             edit->SetFocus();
  838.             return;
  839.         }
  840.     }
  841.     m_sMCR_Setting[WIFI_MCR_PLCI][edit->Tag].value = uidata;
  842. }
  843. //---------------------------------------------------------------------------
  844. void __fastcall TfrmWiFiMCR::edtMPTCCheck(TObject *Sender)
  845. {
  846.     AnsiString  text;
  847.     unsigned int  uidata;
  848.     int  band;
  849.     TEdit *edit = (TEdit*)Sender;
  850.     char  hint[] = " character is not valid ";
  851.     text = edit->Text;
  852.     if( 0 == btnSYSMACMCRData->Tag )  // Dec
  853.     {
  854.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  855.         {
  856.             ShowHintLabel( edit, hint );
  857.             edit->SetFocus();
  858.             return;
  859.         }
  860.     }
  861.     else  // Hex
  862.     {
  863.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  864.         {
  865.             ShowHintLabel( edit, hint );
  866.             edit->SetFocus();
  867.             return;
  868.         }
  869.     }
  870.     m_sMCR_Setting[WIFI_MCR_MPTC][edit->Tag].value = uidata;
  871. }
  872. //---------------------------------------------------------------------------
  873. void __fastcall TfrmWiFiMCR::edtNCCheck(TObject *Sender)
  874. {
  875.     AnsiString  text;
  876.     unsigned int  uidata;
  877.     int  band;
  878.     TEdit *edit = (TEdit*)Sender;
  879.     char  hint[] = " character is not valid ";
  880.     text = edit->Text;
  881.     if( 0 == btnSYSMACMCRData->Tag )  // Dec
  882.     {
  883.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  884.         {
  885.             ShowHintLabel( edit, hint );
  886.             edit->SetFocus();
  887.             return;
  888.         }
  889.     }
  890.     else  // Hex
  891.     {
  892.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  893.         {
  894.             ShowHintLabel( edit, hint );
  895.             edit->SetFocus();
  896.             return;
  897.         }
  898.     }
  899.     m_sMCR_Setting[WIFI_MCR_NC][edit->Tag].value = uidata;
  900. }
  901. //---------------------------------------------------------------------------
  902. void __fastcall TfrmWiFiMCR::edtBGCheck(TObject *Sender)
  903. {
  904.     AnsiString  text;
  905.     unsigned int  uidata;
  906.     int  band;
  907.     TEdit *edit = (TEdit*)Sender;
  908.     char  hint[] = " character is not valid ";
  909.     text = edit->Text;
  910.     if( 0 == btnSYSMACMCRData->Tag )  // Dec
  911.     {
  912.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  913.         {
  914.             ShowHintLabel( edit, hint );
  915.             edit->SetFocus();
  916.             return;
  917.         }
  918.     }
  919.     else  // Hex
  920.     {
  921.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  922.         {
  923.             ShowHintLabel( edit, hint );
  924.             edit->SetFocus();
  925.             return;
  926.         }
  927.     }
  928.     m_sMCR_Setting[WIFI_MCR_BG][edit->Tag].value = uidata;
  929. }
  930. //---------------------------------------------------------------------------
  931. void __fastcall TfrmWiFiMCR::edtSECheck(TObject *Sender)
  932. {
  933.     AnsiString  text;
  934.     unsigned int  uidata;
  935.     int  band;
  936.     TEdit *edit = (TEdit*)Sender;
  937.     char  hint[] = " character is not valid ";
  938.     text = edit->Text;
  939.     if( 0 == btnTRXMACMCRData->Tag )  // Dec
  940.     {
  941.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  942.         {
  943.             ShowHintLabel( edit, hint );
  944.             edit->SetFocus();
  945.             return;
  946.         }
  947.     }
  948.     else  // Hex
  949.     {
  950.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  951.         {
  952.             ShowHintLabel( edit, hint );
  953.             edit->SetFocus();
  954.             return;
  955.         }
  956.     }
  957.     m_sMCR_Setting[WIFI_MCR_SE][edit->Tag].value = uidata;
  958. }
  959. //---------------------------------------------------------------------------
  960. void __fastcall TfrmWiFiMCR::edtTCCheck(TObject *Sender)
  961. {
  962.     AnsiString  text;
  963.     unsigned int  uidata;
  964.     int  band;
  965.     TEdit *edit = (TEdit*)Sender;
  966.     char  hint[] = " character is not valid ";
  967.     text = edit->Text;
  968.     if( 0 == btnTRXMACMCRData->Tag )  // Dec
  969.     {
  970.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  971.         {
  972.             ShowHintLabel( edit, hint );
  973.             edit->SetFocus();
  974.             return;
  975.         }
  976.     }
  977.     else  // Hex
  978.     {
  979.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  980.         {
  981.             ShowHintLabel( edit, hint );
  982.             edit->SetFocus();
  983.             return;
  984.         }
  985.     }
  986.     m_sMCR_Setting[WIFI_MCR_TC][edit->Tag].value = uidata;
  987. }
  988. //---------------------------------------------------------------------------
  989. void __fastcall TfrmWiFiMCR::edtRCCheck(TObject *Sender)
  990. {
  991.     AnsiString  text;
  992.     unsigned int  uidata;
  993.     int  band;
  994.     TEdit *edit = (TEdit*)Sender;
  995.     char  hint[] = " character is not valid ";
  996.     text = edit->Text;
  997.     if( 0 == btnTRXMACMCRData->Tag )  // Dec
  998.     {
  999.         if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  1000.         {
  1001.             ShowHintLabel( edit, hint );
  1002.             edit->SetFocus();
  1003.             return;
  1004.         }
  1005.     }
  1006.     else  // Hex
  1007.     {
  1008.         if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  1009.         {
  1010.             ShowHintLabel( edit, hint );
  1011.             edit->SetFocus();
  1012.             return;
  1013.         }
  1014.     }
  1015.     m_sMCR_Setting[WIFI_MCR_RC][edit->Tag].value = uidata;
  1016. }
  1017. //---------------------------------------------------------------------------
  1018. void __fastcall TfrmWiFiMCR::edtHIFCheck(TObject *Sender)
  1019. {
  1020.     AnsiString  text;
  1021.     int  band;
  1022.     TEdit *edit = (TEdit*)Sender;
  1023.     char  hint[] = " character is not valid ";
  1024.     text = edit->Text;
  1025.     if( WNDRV_HOST_INTERFACE_HPI == m_sWiFiCap.host_interface )
  1026.     {
  1027.         unsigned short  usdata;
  1028.         if( 0 == btnTRXMACMCRData->Tag )  // Dec
  1029.         {
  1030.             if( !IsValidDecWiFiMacReg16Value( text, usdata ) )
  1031.             {
  1032.                 ShowHintLabel( edit, hint );
  1033.                 edit->SetFocus();
  1034.                 return;
  1035.             }
  1036.         }
  1037.         else  // Hex
  1038.         {
  1039.             if( !IsValidHexWiFiMacReg16Value( text, usdata ) )
  1040.             {
  1041.                 ShowHintLabel( edit, hint );
  1042.                 edit->SetFocus();
  1043.                 return;
  1044.             }
  1045.         }
  1046.         m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][edit->Tag].value = usdata;
  1047.     }
  1048.     else
  1049.     {
  1050.         unsigned int  uidata;
  1051.         if( 0 == btnTRXMACMCRData->Tag )  // Dec
  1052.         {
  1053.             if( !IsValidDecWiFiMacRegValue( text, uidata ) )
  1054.             {
  1055.                 ShowHintLabel( edit, hint );
  1056.                 edit->SetFocus();
  1057.                 return;
  1058.             }
  1059.         }
  1060.         else  // Hex
  1061.         {
  1062.             if( !IsValidHexWiFiMacRegValue( text, uidata ) )
  1063.             {
  1064.                 ShowHintLabel( edit, hint );
  1065.                 edit->SetFocus();
  1066.                 return;
  1067.             }
  1068.         }
  1069.         if( WNDRV_HOST_INTERFACE_SDIO == m_sWiFiCap.host_interface )
  1070.         {
  1071.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][edit->Tag].value = uidata;
  1072.         }
  1073.         else // SPI
  1074.         {
  1075.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][edit->Tag].value = uidata;
  1076.         }
  1077.     }
  1078. }
  1079. //---------------------------------------------------------------------------
  1080. void __fastcall TfrmWiFiMCR::HintTimerTimer(TObject *Sender)
  1081. {
  1082.     HintTimer->Enabled = false;
  1083.     lblHint->Visible = false;    
  1084. }
  1085. //---------------------------------------------------------------------------
  1086. void __fastcall TfrmWiFiMCR::btnSaveToFileClick(TObject *Sender)
  1087. {
  1088.     char str[512];
  1089.     bool ok;
  1090.     ok = CheckFields();
  1091.     if(!ok)
  1092.     {
  1093.         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Save MAC control register setting to file fail";
  1094.         Application->MessageBox( "Execution Failure : Save MAC control register setting to file", "FAILURE", MB_OK );
  1095.         return;
  1096.     }
  1097.     ok = SaveDialog->Execute();
  1098.     if( !ok )
  1099.     {
  1100.         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Save MAC control register setting to file fail";
  1101.         Application->MessageBox( "Execution Failure : Save MAC control register setting to file", "FAILURE", MB_OK );
  1102.         return;
  1103.     }
  1104.     strcpy( str, SaveDialog->FileName.c_str() );
  1105.     for(int i=0; i<WIFI_MCR_TYPE_NUM; i++ )
  1106.     {
  1107.         for(int j=0; j<WIFI_MCR_MAX_NUM; j++ )
  1108.         {
  1109.             m_WIFI_MAC_Obj.Set_MCR_Setting( i, j, m_sMCR_Setting[i][j] );
  1110.         }
  1111.     }
  1112.     for(int i=0; i<WIFI_MCR16_TYPE_NUM; i++ )
  1113.     {
  1114.         for(int j=0; j<WIFI_MCR16_MAX_NUM; j++ )
  1115.         {
  1116.             m_WIFI_MAC_Obj.Set_MCR16_Setting( i, j, m_sMCR16_Setting[i][j] );
  1117.         }
  1118.     }
  1119.     ok = m_WIFI_MAC_Obj.REQ_Write_To_File( str, m_sWiFiCap.host_interface );
  1120.     if( !ok )
  1121.     {
  1122.         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Save MAC control register setting to file fail";
  1123.         Application->MessageBox( "Execution Failure : Save MAC control register setting to file", "FAILURE", MB_OK );
  1124.         return;
  1125.     }
  1126.     sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Save MAC control register setting to file successfully";
  1127. }
  1128. //---------------------------------------------------------------------------
  1129. void __fastcall TfrmWiFiMCR::cbSCHeaderClick(TObject *Sender)
  1130. {
  1131.     for( int i=0; i<WIFI_SC_NUM; i++ )
  1132.     {
  1133.         cbSC[i]->Checked = cbSCHeader->Checked;
  1134.         m_sMCR_Setting[WIFI_MCR_SC][i].checked = cbSCHeader->Checked;
  1135.     }
  1136. }
  1137. //---------------------------------------------------------------------------
  1138. void __fastcall TfrmWiFiMCR::cbMDPHeaderClick(TObject *Sender)
  1139. {
  1140.     for( int i=0; i<WIFI_MDP_NUM; i++ )
  1141.     {
  1142.         cbMDP[i]->Checked = cbMDPHeader->Checked;
  1143.         m_sMCR_Setting[WIFI_MCR_MDP][i].checked = cbMDPHeader->Checked;
  1144.     }
  1145. }
  1146. //---------------------------------------------------------------------------
  1147. void __fastcall TfrmWiFiMCR::cbPLCIHeaderClick(TObject *Sender)
  1148. {
  1149.     for( int i=0; i<WIFI_PLCI_NUM; i++ )
  1150.     {
  1151.         cbPLCI[i]->Checked = cbPLCIHeader->Checked;
  1152.         m_sMCR_Setting[WIFI_MCR_PLCI][i].checked = cbPLCIHeader->Checked;
  1153.     }
  1154. }
  1155. //---------------------------------------------------------------------------
  1156. void __fastcall TfrmWiFiMCR::cbMPTCHeaderClick(TObject *Sender)
  1157. {
  1158.     for( int i=0; i<WIFI_MPTC_NUM; i++ )
  1159.     {
  1160.         cbMPTC[i]->Checked = cbMPTCHeader->Checked;
  1161.         m_sMCR_Setting[WIFI_MCR_MPTC][i].checked = cbMPTCHeader->Checked;
  1162.     }
  1163. }
  1164. //---------------------------------------------------------------------------
  1165. void __fastcall TfrmWiFiMCR::cbNCHeaderClick(TObject *Sender)
  1166. {
  1167.     for( int i=0; i<WIFI_NC_NUM; i++ )
  1168.     {
  1169.         cbNC[i]->Checked = cbNCHeader->Checked;
  1170.         m_sMCR_Setting[WIFI_MCR_NC][i].checked = cbNCHeader->Checked;
  1171.     }
  1172. }
  1173. //---------------------------------------------------------------------------
  1174. void __fastcall TfrmWiFiMCR::cbBGHeaderClick(TObject *Sender)
  1175. {
  1176.     for( int i=0; i<WIFI_BG_NUM; i++ )
  1177.     {
  1178.         cbBG[i]->Checked = cbBGHeader->Checked;
  1179.         m_sMCR_Setting[WIFI_MCR_BG][i].checked = cbBGHeader->Checked;
  1180.     }
  1181. }
  1182. //---------------------------------------------------------------------------
  1183. void __fastcall TfrmWiFiMCR::cbSEHeaderClick(TObject *Sender)
  1184. {
  1185.     for( int i=0; i<WIFI_SE_NUM; i++ )
  1186.     {
  1187.         cbSE[i]->Checked = cbSEHeader->Checked;
  1188.         m_sMCR_Setting[WIFI_MCR_SE][i].checked = cbSEHeader->Checked;
  1189.     }
  1190. }
  1191. //---------------------------------------------------------------------------
  1192. void __fastcall TfrmWiFiMCR::cbTCHeaderClick(TObject *Sender)
  1193. {
  1194.     for( int i=0; i<WIFI_TC_NUM; i++ )
  1195.     {
  1196.         cbTC[i]->Checked = cbTCHeader->Checked;
  1197.         m_sMCR_Setting[WIFI_MCR_TC][i].checked = cbTCHeader->Checked;
  1198.     }
  1199. }
  1200. //---------------------------------------------------------------------------
  1201. void __fastcall TfrmWiFiMCR::cbRCHeaderClick(TObject *Sender)
  1202. {
  1203.     for( int i=0; i<WIFI_RC_NUM; i++ )
  1204.     {
  1205.         cbRC[i]->Checked = cbRCHeader->Checked;
  1206.         m_sMCR_Setting[WIFI_MCR_RC][i].checked = cbRCHeader->Checked;
  1207.     }
  1208. }
  1209. //---------------------------------------------------------------------------
  1210. void __fastcall TfrmWiFiMCR::cbHIFHeaderClick(TObject *Sender)
  1211. {
  1212.     for( int i=0; i<WIFI_HIF_HPI_NUM; i++ )
  1213.     {
  1214.         cbHIF[i]->Checked = cbHIFHeader->Checked;
  1215.         m_sMCR_Setting[WIFI_MCR16_HIF_HPI][i].checked = cbHIFHeader->Checked;
  1216.     }
  1217. }
  1218. //---------------------------------------------------------------------------
  1219. void __fastcall TfrmWiFiMCR::btnSYSMACMCRDataClick(TObject *Sender)
  1220. {
  1221.     if( 0 == btnSYSMACMCRData->Tag )  // Dec-->Hex
  1222.     {    btnSYSMACMCRData->Tag = 1;
  1223.     }
  1224.     else  //Hex-->Dec
  1225.     {    btnSYSMACMCRData->Tag = 0;
  1226.     }
  1227.     ReDrawFields( DRAW_MCR_COMMON | DRAW_MCR_HIF );
  1228. }
  1229. //---------------------------------------------------------------------------
  1230. void __fastcall TfrmWiFiMCR::btnTRXMACMCRDataClick(TObject *Sender)
  1231. {
  1232.     if( 0 == btnTRXMACMCRData->Tag )  // Dec-->Hex
  1233.     {    btnTRXMACMCRData->Tag = 1;
  1234.     }
  1235.     else  //Hex-->Dec
  1236.     {    btnTRXMACMCRData->Tag = 0;
  1237.     }
  1238.     ReDrawFields( DRAW_MCR_COMMON | DRAW_MCR_HIF );
  1239. }
  1240. //---------------------------------------------------------------------------
  1241. void __fastcall TfrmWiFiMCR::btnLoadFromFileClick(TObject *Sender)
  1242. {
  1243.     char str[512];
  1244.     bool ok;
  1245.     ok = OpenDialog->Execute();
  1246.     if( !ok )
  1247.     {
  1248.         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Load MAC control register setting from file fail";
  1249.         Application->MessageBox( "Execution Failure : Load MAC control register setting from file", "FAILURE", MB_OK );
  1250.         return;
  1251.     }
  1252.     strcpy( str, OpenDialog->FileName.c_str() );
  1253.     ok = m_WIFI_MAC_Obj.REQ_Read_From_File( str, m_sWiFiCap.host_interface );
  1254.     if( !ok )
  1255.     {
  1256.         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Load MAC control register setting from file fail";
  1257.         Application->MessageBox( "Execution Failure : Load MAC control register setting from file", "FAILURE", MB_OK );
  1258.         return;
  1259.     }
  1260.     for(int i=0; i<WIFI_MCR_TYPE_NUM; i++ )
  1261.     {
  1262.         for(int j=0; j<WIFI_MCR_MAX_NUM; j++ )
  1263.         {
  1264.             m_sMCR_Setting[i][j].value = m_WIFI_MAC_Obj.Get_MCR_Setting_Value( i, j );
  1265.         }
  1266.     }
  1267.     if( WNDRV_HOST_INTERFACE_HPI == m_sWiFiCap.host_interface )
  1268.     {
  1269.         for(int i=0; i<WIFI_MCR16_TYPE_NUM; i++ )
  1270.         {
  1271.             for(int j=0; j<WIFI_MCR16_MAX_NUM; j++ )
  1272.             {
  1273.                 m_sMCR16_Setting[i][j].value = m_WIFI_MAC_Obj.Get_MCR16_Setting_Value( i, j );
  1274.             }
  1275.         }
  1276.     }
  1277.     
  1278.     ReDrawFields( DRAW_MCR_COMMON | DRAW_MCR_HIF );
  1279.     sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Load MAC control register setting from file successfully";
  1280. }
  1281. //---------------------------------------------------------------------------
  1282. void __fastcall TfrmWiFiMCR::btnWriteToRegisterClick(TObject *Sender)
  1283. {
  1284.     if( ! CheckFields() )
  1285.     {
  1286.         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString) "  Write MAC register fail";
  1287.         Application->MessageBox( "Execution Failure : Write MAC register", "FAILURE", MB_OK );
  1288.         return;
  1289.     }
  1290.     Compose_MCR_Parameter();
  1291.     Compose_MCR_Data();
  1292.     CurrentPageLock();
  1293.     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteReg;
  1294.     m_WIFI_MAC_Obj.REQ_Write_MCR_Setting_To_Reg_Start( m_sMCR );
  1295.     sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register progressing";
  1296. }
  1297. //---------------------------------------------------------------------------
  1298. void TfrmWiFiMCR::ConfirmCallback_WriteReg( void )
  1299. {
  1300.     int state = m_WIFI_MAC_Obj.Get_ConfirmState();
  1301.     switch( state )
  1302.     {
  1303.         case STATE_MAC_OK:
  1304.         {
  1305.             m_iCount = 0;
  1306.             switch( m_sWiFiCap.host_interface )
  1307.             {
  1308.                 case WNDRV_HOST_INTERFACE_SDIO:
  1309.                 {
  1310.                     Compose_SDIO_Parameter( WIFI_HIF_SDIO_SPECIFIC );
  1311.                     Compose_SDIO_Data( WIFI_HIF_SDIO_SPECIFIC );
  1312.                     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1313.                     m_WIFI_MAC_Obj.REQ_Write_MCR_Setting_To_Reg_Start( m_sMCR );
  1314.                 }
  1315.                 break;
  1316.         case WNDRV_HOST_INTERFACE_HPI:
  1317.                 {
  1318.                     Compose_HPI_Parameter( WIFI_HIF_HPI_SPECIFIC );
  1319.                     Compose_HPI_Data( WIFI_HIF_HPI_SPECIFIC );
  1320.                     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1321.                     m_WIFI_MAC_Obj.REQ_Write_MCR16_Setting_To_Reg_Start( m_sMCR16 );
  1322.                 }
  1323.                 break;
  1324.         case WNDRV_HOST_INTERFACE_SPI:
  1325.                 {
  1326.                     Compose_SPI_Parameter( WIFI_HIF_SPI_SPECIFIC );
  1327.                     Compose_SPI_Data( WIFI_HIF_SPI_SPECIFIC );
  1328.                     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1329.                     m_WIFI_MAC_Obj.REQ_Write_MCR_Setting_To_Reg_Start( m_sMCR );
  1330.                 }
  1331.                 break;
  1332.                 default:
  1333.                     sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register successfully";
  1334.                 break;
  1335.             }
  1336.         }
  1337.         break;
  1338.         case STATE_MAC_FAIL:
  1339.         {
  1340.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register fail";
  1341.             Application->MessageBox( "Execution Timeout : Write MAC register", "FAIL", MB_OK );
  1342.             CurrentPageReset();
  1343.         }
  1344.         break;
  1345.         case STATE_MAC_TIMEOUT:
  1346.         {
  1347.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register timeout";
  1348.             Application->MessageBox( "Execution Timeout : Write MAC register", "TIMEOUT", MB_OK );
  1349.             CurrentPageReset();
  1350.         }
  1351.         break;
  1352.         case STATE_MAC_STOP:
  1353.         {
  1354.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register stop";
  1355.             CurrentPageReset();
  1356.         }
  1357.         break;
  1358.     }
  1359. }
  1360. //---------------------------------------------------------------------------
  1361. void TfrmWiFiMCR::ConfirmCallback_WriteHIF( void )
  1362. {
  1363.     int state = m_WIFI_MAC_Obj.Get_ConfirmState();
  1364.     switch( state )
  1365.     {
  1366.         case STATE_MAC_OK:
  1367.         {
  1368.             m_iCount++;
  1369.             switch( m_sWiFiCap.host_interface )
  1370.             {
  1371.                 case WNDRV_HOST_INTERFACE_SDIO:
  1372.                 {
  1373.                     if( WIFI_HIF_SDIO_PORT4 >= m_iCount )
  1374.                     {
  1375.                         Compose_SDIO_Parameter( (E_WIFI_HIF_SDIO) m_iCount );
  1376.                         Compose_SDIO_Data( (E_WIFI_HIF_SDIO) m_iCount );
  1377.                         m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1378.                         m_WIFI_MAC_Obj.REQ_Write_MCR_Setting_To_Reg_Start( m_sMCR );
  1379.                     }
  1380.                     else
  1381.                     {
  1382.                         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register successfully";
  1383.                     }
  1384.                 }
  1385.                 break;
  1386.                 case WNDRV_HOST_INTERFACE_HPI:
  1387.                 {
  1388.                     if( WIFI_HIF_HPI_PORT == m_iCount )
  1389.                     {
  1390.                         Compose_HPI_Parameter( WIFI_HIF_HPI_PORT );
  1391.                         Compose_HPI_Data( WIFI_HIF_HPI_PORT );
  1392.                         m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1393.                         m_WIFI_MAC_Obj.REQ_Write_MCR16_Setting_To_Reg_Start( m_sMCR16 );
  1394.                      }
  1395.                      else
  1396.                      {
  1397.                          sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register successfully";
  1398.                          CurrentPageReset();
  1399.                      }
  1400.                 }
  1401.                 break;
  1402.                 case WNDRV_HOST_INTERFACE_SPI:
  1403.                 {
  1404.                     if( WIFI_HIF_SPI_PORT3 >= m_iCount )
  1405.                     {
  1406.                         Compose_SPI_Parameter( (E_WIFI_HIF_SPI) m_iCount );
  1407.                         Compose_SPI_Data( (E_WIFI_HIF_SPI) m_iCount );
  1408.                         m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1409.                         m_WIFI_MAC_Obj.REQ_Write_MCR_Setting_To_Reg_Start( m_sMCR );
  1410.                     }
  1411.                     else
  1412.                     {
  1413.                         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register successfully";
  1414.                     }
  1415.                 }
  1416.                 break;
  1417.             }
  1418.         }
  1419.         break;
  1420.         case STATE_MAC_FAIL:
  1421.         {
  1422.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register fail";
  1423.             Application->MessageBox( "Execution Timeout : Write MAC register", "FAIL", MB_OK );
  1424.             CurrentPageReset();
  1425.         }
  1426.         break;
  1427.         case STATE_MAC_TIMEOUT:
  1428.         {
  1429.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register timeout";
  1430.             Application->MessageBox( "Execution Timeout : Write MAC register", "TIMEOUT", MB_OK );
  1431.             CurrentPageReset();
  1432.         }
  1433.         break;
  1434.         case STATE_MAC_STOP:
  1435.         {
  1436.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Write MAC register stop";
  1437.             CurrentPageReset();
  1438.         }
  1439.         break;
  1440.     }
  1441. }
  1442. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1443. void __fastcall TfrmWiFiMCR::btnReadFromRegisterClick(TObject *Sender)
  1444. {
  1445.     CurrentPageLock();
  1446.     Compose_MCR_Parameter();
  1447.     Compose_MCR_Data();
  1448.     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_ReadReg;
  1449.     m_WIFI_MAC_Obj.REQ_Read_MCR_Setting_From_Reg_Start( m_sMCR );
  1450.     sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register successfully";
  1451. }
  1452. //---------------------------------------------------------------------------
  1453. void TfrmWiFiMCR::ConfirmCallback_ReadReg( void )
  1454. {
  1455.     int state = m_WIFI_MAC_Obj.Get_ConfirmState();
  1456.     switch( state )
  1457.     {
  1458.         case STATE_MAC_OK:
  1459.         {
  1460.             m_sMCR = m_WIFI_MAC_Obj.Get_MCR();
  1461.             DeCompose_MCR_Data();
  1462.             ReDrawFields( DRAW_MCR_COMMON );
  1463.             switch( m_sWiFiCap.host_interface )
  1464.             {
  1465.                 case WNDRV_HOST_INTERFACE_SDIO:
  1466.                 {
  1467.                     Compose_SDIO_Parameter( WIFI_HIF_SDIO_SPECIFIC );
  1468.                     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_ReadHIF;
  1469.                     m_WIFI_MAC_Obj.REQ_Read_MCR_Setting_From_Reg_Start( m_sMCR );
  1470.                 }
  1471.                 break;
  1472.         case WNDRV_HOST_INTERFACE_HPI:
  1473.                 {
  1474.                     Compose_HPI_Parameter( WIFI_HIF_HPI_SPECIFIC );
  1475.                     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_ReadHIF;
  1476.                     m_WIFI_MAC_Obj.REQ_Read_MCR16_Setting_From_Reg_Start( m_sMCR16 );
  1477.                 }
  1478.                 break;
  1479.         case WNDRV_HOST_INTERFACE_SPI:
  1480.                 {
  1481.                     Compose_SPI_Parameter( WIFI_HIF_SPI_SPECIFIC );
  1482.                     m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_ReadHIF;
  1483.                     m_WIFI_MAC_Obj.REQ_Read_MCR_Setting_From_Reg_Start( m_sMCR );
  1484.                 }
  1485.                 break;
  1486.                 default:
  1487.                     sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register successfully";
  1488.                 break;
  1489.             }
  1490.         }
  1491.         break;
  1492.         case STATE_MAC_FAIL:
  1493.         {
  1494.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register fail";
  1495.             Application->MessageBox( "Execution Timeout : Read MAC register", "FAIL", MB_OK );
  1496.         }
  1497.         break;
  1498.         case STATE_MAC_TIMEOUT:
  1499.         {
  1500.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register timeout";
  1501.             Application->MessageBox( "Execution Timeout : Read MAC register", "TIMEOUT", MB_OK );
  1502.         }
  1503.         break;
  1504.         case STATE_MAC_STOP:
  1505.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register stop";
  1506.         break;
  1507.     }
  1508.     CurrentPageReset();
  1509. }
  1510. //---------------------------------------------------------------------------
  1511. void TfrmWiFiMCR::ConfirmCallback_ReadHIF( void )
  1512. {
  1513.     int state = m_WIFI_MAC_Obj.Get_ConfirmState();
  1514.     switch( state )
  1515.     {
  1516.         case STATE_MAC_OK:
  1517.         {
  1518.             m_iCount++;
  1519.             switch( m_sWiFiCap.host_interface )
  1520.             {
  1521.                 case WNDRV_HOST_INTERFACE_SDIO:
  1522.                 {
  1523.                     if( WIFI_HIF_SDIO_PORT4 >= m_iCount )
  1524.                     {
  1525.                         Compose_SDIO_Parameter( (E_WIFI_HIF_SDIO) m_iCount );
  1526.                         m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1527.                         m_WIFI_MAC_Obj.REQ_Write_MCR_Setting_To_Reg_Start( m_sMCR );
  1528.                     }
  1529.                     else
  1530.                     {
  1531.                         ReDrawFields( DRAW_MCR_HIF );
  1532.                         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register successfully";
  1533.                         CurrentPageReset();
  1534.                     }
  1535.                 }
  1536.                 break;
  1537.                 case WNDRV_HOST_INTERFACE_HPI:
  1538.                 {
  1539.                     if( WIFI_HIF_HPI_PORT == m_iCount )
  1540.                     {
  1541.                         Compose_HPI_Parameter( WIFI_HIF_HPI_PORT );
  1542.                         Compose_HPI_Data( WIFI_HIF_HPI_PORT );
  1543.                         m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1544.                         m_WIFI_MAC_Obj.REQ_Write_MCR16_Setting_To_Reg_Start( m_sMCR16 );
  1545.                      }
  1546.                      else
  1547.                      {
  1548.                          ReDrawFields( DRAW_MCR_HIF );
  1549.                          sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register successfully";
  1550.                          CurrentPageReset();
  1551.                      }
  1552.                 }
  1553.                 break;
  1554.                 case WNDRV_HOST_INTERFACE_SPI:
  1555.                 {
  1556.                     if( WIFI_HIF_SPI_PORT3 >= m_iCount )
  1557.                     {
  1558.                         Compose_SPI_Parameter( (E_WIFI_HIF_SPI) m_iCount );
  1559.                         Compose_SPI_Data( (E_WIFI_HIF_SPI) m_iCount );
  1560.                         m_WIFI_MAC_Obj.ConfirmCallback  = ::ConfirmCallback_WriteHIF;
  1561.                         m_WIFI_MAC_Obj.REQ_Write_MCR_Setting_To_Reg_Start( m_sMCR );
  1562.                     }
  1563.                     else
  1564.                     {
  1565.                         ReDrawFields( DRAW_MCR_HIF );
  1566.                         sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register successfully";
  1567.                         CurrentPageReset();
  1568.                     }
  1569.                 }
  1570.                 break;
  1571.             }
  1572.         }
  1573.         break;
  1574.         case STATE_MAC_FAIL:
  1575.         {
  1576.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register fail";
  1577.             Application->MessageBox( "Execution Timeout : Read MAC register", "FAIL", MB_OK );
  1578.             CurrentPageReset();
  1579.         }
  1580.         break;
  1581.         case STATE_MAC_TIMEOUT:
  1582.         {
  1583.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register timeout";
  1584.             Application->MessageBox( "Execution Timeout : Read MAC register", "TIMEOUT", MB_OK );
  1585.             CurrentPageReset();
  1586.         }
  1587.         break;
  1588.         case STATE_MAC_STOP:
  1589.         {
  1590.             sbWiFiMCR->Panels->Items[0]->Text = (AnsiString)"  Read MAC register stop";
  1591.             CurrentPageReset();
  1592.         }
  1593.         break;
  1594.     }
  1595. }
  1596. //----------------------------------------------------------------------------
  1597. void __fastcall TfrmWiFiMCR::FormShow(TObject *Sender)
  1598. {
  1599.     if( m_bInit )
  1600.     {
  1601.         m_bInit = false;
  1602.         m_sWiFiCap = frmMainSel->Get_FinalWiFiCap();
  1603.         DisplayHIF();
  1604.     }
  1605. }
  1606. //---------------------------------------------------------------------------
  1607. void TfrmWiFiMCR::DisplayHIF( void )
  1608. {
  1609.     int i;
  1610.     switch( m_sWiFiCap.host_interface )
  1611.     {
  1612.         case WNDRV_HOST_INTERFACE_SDIO:
  1613.         {
  1614.             pnlHIFHeader->Caption = "HIF_SDIO";
  1615.             for( i=0; i<WIFI_HIF_SDIO_NUM; i++ )
  1616.             {
  1617.                 cbHIF[i]->Visible = true;
  1618.                 lblHIF[i]->Visible = true;
  1619.                 edtHIF[i]->Visible = true;
  1620.             }
  1621.             for( i; i<WIFI_HIF_MAX_NUM; i++ )
  1622.             {
  1623.                 cbHIF[i]->Visible = false;
  1624.                 lblHIF[i]->Visible = false;
  1625.                 edtHIF[i]->Visible = false;
  1626.             }
  1627.             lblHIF[0]->Caption = "SSTS";
  1628.             lblHIF[1]->Caption = "PSCTL";
  1629.             lblHIF[2]->Caption = "SDRDR";
  1630.             lblHIF[3]->Caption = "TX_DATA_PORT";
  1631.             lblHIF[4]->Caption = "TX_STATUS_PORT";
  1632.             lblHIF[5]->Caption = "RX_STATUS_PORT";
  1633.             lblHIF[6]->Caption = "RX_DATA_PORT";
  1634.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][0].name = "SSTS";
  1635.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][1].name = "PSCTL";
  1636.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][2].name = "SDRDR";
  1637.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][3].name = "TX_DATA_PORT";
  1638.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][4].name = "TX_STATUS_PORT";
  1639.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][5].name = "RX_STATUS_PORT";
  1640.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][6].name = "RX_DATA_PORT";
  1641.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][7].name = "";
  1642.             for( i=0; i<WIFI_HIF_SDIO_NUM; i++ )
  1643.             {
  1644.                 lblHIF[i]->Font->Color = clBlack;
  1645.                 lblHIF[i]->Font->Style = TFontStyles();
  1646.                 edtHIF[i]->ReadOnly = false;
  1647.                 m_sMCR_Setting[WIFI_MCR_HIF_SDIO][i].RO = false;
  1648.                 m_sMCR_Setting[WIFI_MCR_HIF_SDIO][i].RC = false;
  1649.             }
  1650.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][0].addr = 0x010C;
  1651.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][1].addr = 0x012C;
  1652.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][2].addr = 0x0110;
  1653.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][3].addr = 0x3000;
  1654.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][4].addr = 0x4000;
  1655.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][5].addr = 0x5000;
  1656.             m_sMCR_Setting[WIFI_MCR_HIF_SDIO][6].addr = 0x6000;
  1657.         }
  1658.         break;
  1659.         case WNDRV_HOST_INTERFACE_HPI:
  1660.         {
  1661.             pnlHIFHeader->Caption = "HIF_HPI";
  1662.             for( i=0; i<WIFI_HIF_HPI_NUM; i++ )
  1663.             {
  1664.                 cbHIF[i]->Visible = true;
  1665.                 lblHIF[i]->Visible = true;
  1666.                 edtHIF[i]->Visible = true;
  1667.             }
  1668.             lblHIF[0]->Caption = "HPI_CHIPID";
  1669.             lblHIF[1]->Caption = "HPI_MAC_STS";
  1670.             lblHIF[2]->Caption = "HPI_CTRL";
  1671.             lblHIF[3]->Caption = "HPI_POWER_CTRL";
  1672.             lblHIF[4]->Caption = "TX_DATA_PORT";
  1673.             lblHIF[5]->Caption = "TX_STATUS_PORT";
  1674.             lblHIF[6]->Caption = "RX_STATUS_PORT";
  1675.             lblHIF[7]->Caption = "RX_DATA_PORT";
  1676.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][0].name = "HPI_CHIPID";
  1677.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][1].name = "HPI_MAC_STS";
  1678.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][2].name = "HPI_CTRL";
  1679.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][3].name = "HPI_POWER_CTRL";
  1680.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][4].name = "TX_DATA_PORT";
  1681.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][5].name = "TX_STATUS_PORT";
  1682.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][6].name = "RX_STATUS_PORT";
  1683.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][7].name = "RX_DATA_PORT";
  1684.             // font style
  1685.             for( i=0; i<WIFI_HIF_HPI_NUM; i++ )
  1686.             {
  1687.                 lblHIF[i]->Font->Style = TFontStyles() << fsUnderline;
  1688.             }
  1689.             // font color
  1690.             lblHIF[0]->Font->Color = clMaroon;
  1691.             for( i=1; i<4; i++ )
  1692.             {   lblHIF[i]->Font->Color = clWindowText;
  1693.             }
  1694.             for( i=4; i<WIFI_HIF_HPI_NUM; i++ )
  1695.             {   lblHIF[i]->Font->Color = clGreen;
  1696.             }
  1697.             // read only
  1698.             edtHIF[0]->ReadOnly = true;
  1699.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][0].RO = true;
  1700.             for( i=1; i<WIFI_HIF_HPI_NUM; i++ )
  1701.             {
  1702.                 edtHIF[i]->ReadOnly = false;
  1703.                 m_sMCR_Setting[WIFI_MCR16_HIF_HPI][i].RO = false;
  1704.             }
  1705.             // read/clear
  1706.             for( i=0; i<4; i++ )
  1707.             {   m_sMCR_Setting[WIFI_MCR16_HIF_HPI][i].RC = false;
  1708.             }
  1709.             for( i=4; i<WIFI_HIF_HPI_NUM; i++ )
  1710.             {   m_sMCR_Setting[WIFI_MCR16_HIF_HPI][i].RC = true;
  1711.             }
  1712.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][0].addr = 0x0780;
  1713.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][1].addr = 0x078C;
  1714.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][2].addr = 0x07FC;
  1715.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][3].addr = 0x07FE;
  1716.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][4].addr = 0x0600;
  1717.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][5].addr = 0x0640;
  1718.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][6].addr = 0x0680;
  1719.             m_sMCR_Setting[WIFI_MCR16_HIF_HPI][7].addr = 0x06c0;
  1720.         }
  1721.         break;
  1722.         case WNDRV_HOST_INTERFACE_SPI:
  1723.         {
  1724.             pnlHIFHeader->Caption = "HIF_SPI";
  1725.             for( i=0; i<WIFI_HIF_SPI_NUM; i++ )
  1726.             {
  1727.                 cbHIF[i]->Visible = true;
  1728.                 lblHIF[i]->Visible = true;
  1729.                 edtHIF[i]->Visible = true;
  1730.             }
  1731.             for( i; i<WIFI_HIF_MAX_NUM; i++ )
  1732.             {
  1733.                 cbHIF[i]->Visible = false;
  1734.                 lblHIF[i]->Visible = false;
  1735.                 edtHIF[i]->Visible = false;
  1736.             }
  1737.             lblHIF[0]->Caption = "SSTS";
  1738.             lblHIF[1]->Caption = "PSCTL";
  1739.             lblHIF[2]->Caption = "TX_DATA_PORT";
  1740.             lblHIF[3]->Caption = "TX_STATUS_PORT";
  1741.             lblHIF[4]->Caption = "RX_STATUS_PORT";
  1742.             lblHIF[5]->Caption = "RX_DATA_PORT";
  1743.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][0].name = "SSTS";
  1744.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][1].name = "PSCTL";
  1745.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][2].name = "TX_DATA_PORT";
  1746.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][3].name = "TX_STATUS_PORT";
  1747.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][4].name = "RX_STATUS_PORT";
  1748.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][5].name = "RX_DATA_PORT";
  1749.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][6].name = "";
  1750.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][7].name = "";
  1751.             for( i=0; i<WIFI_HIF_SPI_NUM; i++ )
  1752.             {
  1753.                 lblHIF[i]->Font->Color = clBlack;
  1754.                 lblHIF[i]->Font->Style = TFontStyles();
  1755.                 edtHIF[i]->ReadOnly = false;
  1756.                 m_sMCR_Setting[WIFI_MCR_HIF_SPI][i].RO = false;
  1757.                 m_sMCR_Setting[WIFI_MCR_HIF_SPI][i].RC = false;
  1758.             }
  1759.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][0].addr = 0x010C;
  1760.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][1].addr = 0x012C;
  1761.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][2].addr = 0x3000;
  1762.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][3].addr = 0x4000;
  1763.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][4].addr = 0x5000;
  1764.             m_sMCR_Setting[WIFI_MCR_HIF_SPI][5].addr = 0x6000;
  1765.         }
  1766.         break;
  1767.     }
  1768. }
  1769. //=========================================================================
  1770. //---------------------------------------------------------------------------
  1771. void TfrmWiFiMCR::Compose_MCR_Parameter( void )
  1772. {
  1773.    // int i, j;
  1774.    // m_sMCR.number = m_sMCR_Setting[WIFI_MCR_RC][WIFI_RC_NUM-1].addr/sizeof(m_sMCR.mcr_data[0])+1;
  1775.    // m_sMCR.mcr_addr = m_sMCR_Setting[WIFI_MCR_SC][0].addr; // 0x0000
  1776.    // for( i=0; i<m_sMCR.number; i++ )
  1777.    //     m_sMCR.flag[i] = false;
  1778.     m_sMCR.count=0;
  1779.     for(int i=0; i<=WIFI_MCR_RC; i++ )
  1780.     {
  1781.         for(int j=0; j<WIFI_MCR_MAX_NUM; j++ )
  1782.         {
  1783.             if( m_sMCR_Setting[i][j].checked )
  1784.             {
  1785.                 m_sMCR.mac_reg32[m_sMCR.count].index = m_sMCR_Setting[i][j].addr;
  1786.                 m_sMCR.count++;
  1787.             }
  1788.         }
  1789.     }
  1790. }
  1791. //---------------------------------------------------------------------------
  1792. void TfrmWiFiMCR::Compose_MCR_Data( void )
  1793. {
  1794.     int count=0;
  1795.     for(int i=0; i<=WIFI_MCR_RC; i++ )
  1796.     {
  1797.         for(int j=0; j<WIFI_MCR_MAX_NUM; j++ )
  1798.         {
  1799.             if( m_sMCR_Setting[i][j].checked )
  1800.             {
  1801.                 m_sMCR.mac_reg32[count].mcr_data32 = m_sMCR_Setting[i][j].value;
  1802.                 count++;
  1803.             }
  1804.         }
  1805.     }
  1806. }
  1807. //---------------------------------------------------------------------------
  1808. void TfrmWiFiMCR::DeCompose_MCR_Data( void )
  1809. {
  1810.     int count=0;
  1811.     for(int i=0; i<=WIFI_MCR_RC; i++ )
  1812.     {
  1813.         for(int j=0; j<WIFI_MCR_MAX_NUM; j++ )
  1814.         {
  1815.             if( m_sMCR_Setting[i][j].checked )
  1816.             {
  1817.                 m_sMCR_Setting[i][j].value = m_sMCR.mac_reg32[count].mcr_data32;
  1818.                 count++;
  1819.             }
  1820.         }
  1821.     }
  1822. }
  1823. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1824. void TfrmWiFiMCR::Compose_SDIO_Parameter( E_WIFI_HIF_SDIO hif_sdio )
  1825. {
  1826.     int i, j;
  1827.     if( WIFI_HIF_SDIO_SPECIFIC == hif_sdio )
  1828.     {
  1829.        // m_sMCR.number = (m_sMCR_Setting[WIFI_MCR_HIF_SDIO][WIFI_HIF_SDIO_SPECIFIC_NUM-1].addr-m_sMCR_Setting[WIFI_MCR_HIF_SDIO][0].addr)/sizeof(m_sMCR.mcr_data[0])+1;
  1830.        // m_sMCR.mcr_addr = m_sMCR_Setting[WIFI_MCR_HIF_SDIO][0].addr; // 0x10C
  1831.        // for( i=0; i<m_sMCR.number; i++ )
  1832.        //     m_sMCR.flag[i] = false;
  1833.         m_sMCR.count=0;
  1834.         for( j=0; j<WIFI_HIF_SDIO_SPECIFIC_NUM; j++ )
  1835.         {
  1836.             if( m_sMCR_Setting[WIFI_MCR_HIF_SDIO][j].checked )
  1837.             {
  1838.                 m_sMCR.mac_reg32[m_sMCR.count].index = m_sMCR_Setting[WIFI_MCR_HIF_SDIO][j].addr;
  1839.                 m_sMCR.count++;
  1840.             }
  1841.         }
  1842.     }
  1843.     else // SDIO port
  1844.     {
  1845.         m_sMCR.count   = 1;
  1846.         m_sMCR.mac_reg32[0].index = m_sMCR_Setting[WIFI_MCR_HIF_SDIO][WIFI_HIF_SDIO_SPECIFIC_NUM+hif_sdio-1].addr; // 0x600
  1847.     }
  1848. }
  1849. //---------------------------------------------------------------------------
  1850. void TfrmWiFiMCR::Compose_SDIO_Data( E_WIFI_HIF_SDIO hif_sdio )
  1851. {
  1852.     int count=0;
  1853.     if( WIFI_HIF_SDIO_SPECIFIC == hif_sdio )
  1854.     {
  1855.         for( int j=0; j<WIFI_HIF_SDIO_SPECIFIC_NUM; j++ )
  1856.         {
  1857.             if( m_sMCR_Setting[WIFI_MCR_HIF_SDIO][j].checked )
  1858.             {
  1859.                 m_sMCR.mac_reg32[count].mcr_data32 = m_sMCR_Setting[WIFI_MCR_HIF_SDIO][j].value;
  1860.                 count++;
  1861.             }
  1862.         }
  1863.     }
  1864.     else // SDIO port
  1865.     {
  1866.         m_sMCR.mac_reg32[0].mcr_data32 = m_sMCR_Setting[WIFI_MCR_HIF_SDIO][WIFI_HIF_SDIO_SPECIFIC_NUM+hif_sdio-1].value;
  1867.     }
  1868. }
  1869. //---------------------------------------------------------------------------
  1870. void TfrmWiFiMCR::DeCompose_SDIO_Data( E_WIFI_HIF_SDIO hif_sdio )
  1871. {
  1872.     int count=0;
  1873.     if( WIFI_HIF_SDIO_SPECIFIC == hif_sdio )
  1874.     {
  1875.         for( int j=0; j<WIFI_HIF_SDIO_SPECIFIC_NUM; j++ )
  1876.         {
  1877.             if( m_sMCR_Setting[WIFI_MCR_HIF_SDIO][j].checked )
  1878.             {
  1879.                 m_sMCR_Setting[WIFI_MCR_HIF_SDIO][j].value = m_sMCR.mac_reg32[count].mcr_data32;
  1880.                 count++;
  1881.             }
  1882.         }
  1883.     }
  1884.     else // SDIO port
  1885.     {
  1886.         m_sMCR_Setting[WIFI_MCR_HIF_SDIO][WIFI_HIF_SDIO_SPECIFIC_NUM+hif_sdio-1].value = m_sMCR.mac_reg32[0].mcr_data32;
  1887.     }
  1888. }
  1889. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1890. void TfrmWiFiMCR::Compose_HPI_Parameter( E_WIFI_HIF_HPI hif_hpi )
  1891. {
  1892.     int i, j;
  1893.     if( WIFI_HIF_HPI_SPECIFIC == hif_hpi )
  1894.     {
  1895. //        m_sMCR16.number = (m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][3].addr-m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][0].addr)/sizeof(m_sMCR16.mcr_data[0])+1;
  1896. //        m_sMCR16.mcr_addr = m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][0].addr; // 0x780
  1897. //        for( i=0; i<m_sMCR16.number; i++ )
  1898. //            m_sMCR16.flag[i] = false;
  1899.         m_sMCR16.count=0;
  1900.         for( j=0; j<WIFI_HIF_HPI_SPECIFIC_NUM; j++ )
  1901.         {
  1902.             if( m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].checked )
  1903.             {
  1904.                 m_sMCR16.mac_reg16[m_sMCR16.count].index = m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].addr;
  1905.                 m_sMCR16.count++;
  1906.             }
  1907.         }
  1908.     }
  1909.     else // HPI port
  1910.     {
  1911.        // m_sMCR16.number = (m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][WIFI_HIF_HPI_NUM-1].addr-m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][WIFI_HIF_HPI_SPECIFIC_NUM].addr)/sizeof(m_sMCR16.mcr_data[0])+1;
  1912.        // m_sMCR16.mcr_addr = m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][WIFI_HIF_HPI_SPECIFIC_NUM].addr; // 0x600
  1913.        // for( i=0; i<m_sMCR16.number; i++ )
  1914.        //     m_sMCR16.flag[i] = false;
  1915.         m_sMCR16.count=0;
  1916.         for( j=WIFI_HIF_HPI_SPECIFIC_NUM; j<WIFI_MCR16_MAX_NUM; j++ )
  1917.         {
  1918.             if( m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].checked )
  1919.             {
  1920.                 m_sMCR16.mac_reg16[m_sMCR16.count].index = m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].addr;
  1921.                 m_sMCR16.count++;
  1922.             }
  1923.         }
  1924.     }
  1925. }
  1926. //---------------------------------------------------------------------------
  1927. void TfrmWiFiMCR::Compose_HPI_Data( E_WIFI_HIF_HPI hif_hpi )
  1928. {
  1929.     int j;
  1930.     int count=0;
  1931.     if( WIFI_HIF_HPI_SPECIFIC == hif_hpi )
  1932.     {
  1933.         for( j=0; j<WIFI_HIF_HPI_SPECIFIC_NUM; j++ )
  1934.         {
  1935.             if( m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].checked )
  1936.             {
  1937.                 m_sMCR16.mac_reg16[count].mcr_data16 = m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].value;
  1938.                 count++;
  1939.             }
  1940.         }
  1941.     }
  1942.     else // HPI port
  1943.     {
  1944.         for( j=WIFI_HIF_HPI_SPECIFIC_NUM; j<WIFI_HIF_HPI_NUM; j++ )
  1945.         {
  1946.             if( m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].checked )
  1947.             {
  1948.                 m_sMCR16.mac_reg16[count].mcr_data16 = m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].value;
  1949.                 count++;
  1950.             }
  1951.         }
  1952.     }
  1953. }
  1954. //---------------------------------------------------------------------------
  1955. void TfrmWiFiMCR::DeCompose_HPI_Data( E_WIFI_HIF_HPI hif_hpi )
  1956. {
  1957.     int j;
  1958.     int count=0;
  1959.     if( WIFI_HIF_HPI_SPECIFIC == hif_hpi )
  1960.     {
  1961.         for( j=0; j<WIFI_HIF_HPI_SPECIFIC_NUM; j++ )
  1962.         {
  1963.             if( m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].checked )
  1964.             {
  1965.                 m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].value = m_sMCR16.mac_reg16[count].mcr_data16;
  1966.                 count++;
  1967.             }
  1968.         }
  1969.     }
  1970.     else // HIF port
  1971.     {
  1972.         for( j=WIFI_HIF_HPI_SPECIFIC_NUM; j<WIFI_HIF_HPI_NUM; j++ )
  1973.         {
  1974.             if( m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].checked )
  1975.             {
  1976.                 m_sMCR16_Setting[WIFI_MCR16_HIF_HPI][j].value = m_sMCR16.mac_reg16[count].mcr_data16;
  1977.                 count++;
  1978.             }
  1979.         }
  1980.     }
  1981. }
  1982. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1983. void TfrmWiFiMCR::Compose_SPI_Parameter( E_WIFI_HIF_SPI hif_spi )
  1984. {
  1985.     int i, j;
  1986.     if( WIFI_HIF_SPI_SPECIFIC == hif_spi )
  1987.     {
  1988.       //  m_sMCR.number = (m_sMCR_Setting[WIFI_MCR_HIF_SPI][WIFI_HIF_SPI_SPECIFIC_NUM-1].addr-m_sMCR_Setting[WIFI_MCR_HIF_SPI][0].addr)/sizeof(m_sMCR.mcr_data[0])+1;
  1989.       //  m_sMCR.mcr_addr = m_sMCR_Setting[WIFI_MCR_HIF_SPI][0].addr; // 0x10C
  1990.       //  for( i=0; i<m_sMCR.number; i++ )
  1991.       //      m_sMCR.flag[i] = false;
  1992.         m_sMCR.count=0;
  1993.         for( j=0; j<WIFI_HIF_SPI_SPECIFIC_NUM; j++ )
  1994.         {
  1995.             if( m_sMCR_Setting[WIFI_MCR_HIF_SPI][j].checked )
  1996.             {
  1997.                 m_sMCR.mac_reg32[m_sMCR.count].index = m_sMCR_Setting[WIFI_MCR_HIF_SPI][j].addr;
  1998.                 m_sMCR.count++;
  1999.             }
  2000.         }
  2001.     }
  2002.     else // SPI port
  2003.     {
  2004.         m_sMCR.count   = 1;
  2005.         m_sMCR.mac_reg32[0].index = m_sMCR_Setting[WIFI_MCR_HIF_SPI][WIFI_HIF_SPI_SPECIFIC_NUM+hif_spi-1].addr; // 0x600
  2006.     }
  2007. }
  2008. //---------------------------------------------------------------------------
  2009. void TfrmWiFiMCR::Compose_SPI_Data( E_WIFI_HIF_SPI hif_spi )
  2010. {
  2011.     if( WIFI_HIF_SPI_SPECIFIC == hif_spi )
  2012.     {
  2013.         int count = 0;
  2014.         for( int j=0; j<WIFI_HIF_SPI_SPECIFIC_NUM; j++ )
  2015.         {
  2016.             if( m_sMCR_Setting[WIFI_MCR_HIF_SPI][j].checked )
  2017.             {
  2018.                 m_sMCR.mac_reg32[count].mcr_data32 = m_sMCR_Setting[WIFI_MCR_HIF_SPI][j].value;
  2019.                 count++;
  2020.             }
  2021.         }
  2022.     }
  2023.     else // SPI port
  2024.     {
  2025.         m_sMCR.mac_reg32[0].mcr_data32 = m_sMCR_Setting[WIFI_MCR_HIF_SDIO][WIFI_HIF_SPI_SPECIFIC_NUM+hif_spi-1].value;
  2026.     }
  2027. }
  2028. //---------------------------------------------------------------------------
  2029. void TfrmWiFiMCR::DeCompose_SPI_Data( E_WIFI_HIF_SPI hif_spi )
  2030. {
  2031.     if( WIFI_HIF_SPI_SPECIFIC == hif_spi )
  2032.     {
  2033.         int count=0;
  2034.         for( int j=0; j<WIFI_HIF_SPI_SPECIFIC_NUM; j++ )
  2035.         {
  2036.             if( m_sMCR_Setting[WIFI_MCR_HIF_SPI][j].checked )
  2037.             {
  2038.                 m_sMCR_Setting[WIFI_MCR_HIF_SPI][j].value = m_sMCR.mac_reg32[count].mcr_data32;
  2039.                 count++;
  2040.             }
  2041.         }
  2042.     }
  2043.     else // SPI port
  2044.     {
  2045.         m_sMCR_Setting[WIFI_MCR_HIF_SPI][WIFI_HIF_SPI_SPECIFIC_NUM+hif_spi-1].value = m_sMCR.mac_reg32[0].mcr_data32;
  2046.     }
  2047. }