把FL2440 的调试串口改为普通串口的方法

把FL2440 的调试串口改为普通串口的方法

串口, 调试
昨天,胡sir问我如何把FL2440 的调试串口改为普通串口,我答应他晚上回去看看,晕,昨晚忘记带笔记本电源回去了。所以现在立即补上——我没有在平台上试过,不过我看了一下BSP,我觉得应该是按照如下步骤改的
一、看F:/开发板光盘/FL24402010.01.28/FL2440/Wince/BSP源码包/SMDK2440A_091112/SMDK2440A/Src/Kernel/Oal 下的debug.c文件有:
  1. //------------------------------------------------------------------------------
  2. // Defines
  3. #define DEBUG_SERIAL_UART0                1
  4. //#define DEBUG_SERIAL_UART1        1
  5. #ifdef DEBUG_SERIAL_UART0
  6. #define FEILING_DEBUG                1
  7. #elif DEBUG_SERIAL_UART1
  8. #define FEILING_DEBUG                1
  9. #else
  10. #define FEILING_DEBUG                0
  11. #endif
  12. //------------------------------------------------------------------------------
复制代码
如上说明FL2440 采用了 uart0作为 debug 串口。
再看F:/开发板光盘/FL24402010.01.28/FL2440/Wince/BSP源码包/SMDK2440A_091112/SMDK2440A 下的SMDK2440A.bat文件有
@REM DEBUG SERIAL PORT
@REM You also need to change the macro definition in debug.c
REM set DEBUG_SERIAL=
set DEBUG_SERIAL=SERIAL_UART0
REM set DEBUG_SERIAL=SERIAL_UART1

呵呵,正好和debug.c对应。
再来看F:/开发板光盘/FL24402010.01.28/FL2440/Wince/BSP源码包/SMDK2440A_091112/SMDK2440A/Files 下的platform.reg
  1. ; @CESYSGEN IF CE_MODULES_SERIAL
  2. IF BSP_NOSERIAL !
  3. IF BSP_NOUART0 !
  4. IF BSP_KITL != SERIAL_UART0
  5. IF DEBUG_SERIAL != SERIAL_UART0 ;这个宏定义造成uart0的驱动没有被加载成普通串口,呵呵,若要做普通串口,在SMDK2440A.bat把这个环境变量去掉
  6. ;=============== UART0 (physical COM1 connector P1) (Serial) ===============
  7. [HKEY_LOCAL_MACHINE/Drivers/BuiltIn/Serial]
  8.    "DeviceArrayIndex"=dword:0
  9.    "Irq"=dword:1c
  10.    "MemBase"=dword:50000000
  11.    "MemLen"=dword:2C
  12.    "InterruptBitsShift"=dword:0 ; UART 0 Interrupt Sub Register shift bit.
  13.    "ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
  14.    "Prefix"="COM"
  15.    "Index"=dword:1
  16.    "Dll"="serial_smdk2440.dll"
  17.    "Order"=dword:4
  18.    "Priority"=dword:0
  19.    "Port"="COM1:"
  20.    "DeviceType"=dword:0
  21.    "FriendlyName"=LOC_DISPLAYNAME_COM1
  22.    "Tsp"="unimodem.dll"
  23.    "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
  24.    "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00
  25.    
  26. ENDIF
  27. ENDIF
  28. ENDIF
  29. IF BSP_NOUART1 !
  30. IF BSP_KITL != SERIAL_UART1
  31. IF DEBUG_SERIAL != SERIAL_UART1
  32. ;=============== UART1 (physical COM2 connector P2) (Serial) ===============
  33. [HKEY_LOCAL_MACHINE/Drivers/BuiltIn/Serial1]
  34.    "DeviceArrayIndex"=dword:1
  35.    "Irq"=dword:17
  36.    "MemBase"=dword:50004000
  37.    "MemLen"=dword:2C
  38.    "InterruptBitsShift"=dword:3 ; UART 1 Interrupt Sub Register shift bit.
  39.    "ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
  40.    "Prefix"="COM"
  41.    "Index"=dword:2
  42.    "Dll"="serial_smdk2440.dll"
  43.    "Order"=dword:4
  44.    "Priority"=dword:0
  45.    "Port"="COM2:"
  46.    "DeviceType"=dword:0
  47.    "FriendlyName"=LOC_DISPLAYNAME_COM2
  48.    "Tsp"="unimodem.dll"
  49.    "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
  50.    "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00   
  51. ENDIF
  52. ENDIF
  53. ENDIF
  54. IF BSP_NOUART2 !
  55. IF BSP_KITL != SERIAL_UART2
  56. ;=============== UART2 (physical COM3 connector P2) (Serial) ===============
  57. [HKEY_LOCAL_MACHINE/Drivers/BuiltIn/Serial2]
  58.    "DeviceArrayIndex"=dword:1
  59.    "Irq"=dword:f
  60.    "MemBase"=dword:50008000
  61.    "MemLen"=dword:2C
  62.    "InterruptBitsShift"=dword:6 ; UART 2 Interrupt Sub Register shift bit.
  63.    "ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
  64.    "Prefix"="COM"
  65.    "Index"=dword:3
  66.    "Dll"="serial_smdk2440.dll"
  67.    "Order"=dword:4
  68.    "Priority"=dword:0
  69.    "Port"="COM3:"
  70.    "DeviceType"=dword:0
  71.    "FriendlyName"="Serial Cable on COM3";LOC_DISPLAYNAME_COM3
  72.    "Tsp"="unimodem.dll"
  73.    "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
  74.    "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00   
  75. ENDIF
  76. ENDIF
  77. IF BSP_NOIRDA !
  78. ; S2440 IrDA(UART2)
  79. [HKEY_LOCAL_MACHINE/Drivers/BuiltIn/IRDA2440]
  80.    "DeviceArrayIndex"=dword:2
  81.    "Irq"=dword:f
  82.    "MemBase"=dword:50008000
  83.    "MemLen"=dword:2C
  84.    "InterruptBitsShift"=dword:6 ; UART 2 Interrupt Sub Register shift bit.
  85.    ;"ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
  86.    "Prefix"="COM"
  87.    "Index"=dword:4
  88.    "Dll"="serial_smdk2440.Dll"
  89.    "Order"=dword:4
  90.    "Priority"=dword:0
  91.    "Port"="COM4:"
  92.    "DeviceType"=dword:0  ; IRDA modem, 0 -> null modem
  93.    "FriendlyName"=LOC_DISPLAYNAME_RAWIR
  94.    "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
  95.    "DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00
  96. ENDIF
  97. [HKEY_LOCAL_MACHINE/Comm/Irsir1/Parms]
  98.    "Port"=dword:4
  99.    ; 0 = Use external dongle, 1 = Use internal IR
  100.    "IntIR"=dword:1
  101.    ; 0 - internal transceiver, 1 - Extended Systems JetEye dongle.
  102.    "TransceiverType"=dword:0
  103. ENDIF BSP_NOSERIAL !
  104. ;=========== End of UART(Serial) ===============
  105. ; @CESYSGEN ENDIF CE_MODULES_SERIAL
复制代码
从上面可以看出,Fl2440 已经有了三个串口作为普通串口驱动注册表信心,甚至红外也保留了。

现在来看最后一步,看看串口驱动的源码F:/开发板光盘/FL24402010.01.28/FL2440/Wince/BSP源码包/SMDK2440A_091112/SMDK2440A/Src/Drivers/Serial/ser_smdk2440.cpp
  1. CSerialPDD * CreateSerialObject(LPTSTR lpActivePath, PVOID pMdd,PHWOBJ pHwObj, DWORD DeviceArrayIndex)
  2. {
  3.     CSerialPDD * pSerialPDD = NULL;
  4.     switch (DeviceArrayIndex) {
  5.       case 0:
  6.         pSerialPDD = new CPdd2440Serial1(lpActivePath,pMdd, pHwObj);
  7.         break;
  8.       case 1:
  9.         pSerialPDD = new CPdd2440Serial2(lpActivePath,pMdd, pHwObj);
  10.         break;
  11.       case 2:
  12.         pSerialPDD = new CPdd2440Serial3(lpActivePath,pMdd, pHwObj);
  13.         break;
  14.                
  15.     }
  16.     if (pSerialPDD && !pSerialPDD->Init()) {
  17.         delete pSerialPDD;
  18.         pSerialPDD = NULL;
  19.     }   
  20.     return pSerialPDD;
  21. }
复制代码
这个说明FL2440 已经完全具备三串口驱动,所以大家放心,调试串口很容易修改的。下面是修改结论:
一、F:/开发板光盘/FL24402010.01.28/FL2440/Wince/BSP源码包/SMDK2440A_091112/SMDK2440A/Src/Kernel/Oal 下的debug.c
中的#define DEBUG_SERIAL_UART0                1 屏蔽(//#define DEBUG_SERIAL_UART0                1)
二、F:/开发板光盘/FL24402010.01.28/FL2440/Wince/BSP源码包/SMDK2440A_091112/SMDK2440A 下的SMDK2440A.bat文件 的
set DEBUG_SERIAL=SERIAL_UART0 屏蔽(@set DEBUG_SERIAL=SERIAL_UART0) 即可,重新编译整个BSP,打包,我想这样com1 就可以当普通串口用了。呵呵。

你可能感兴趣的:(c,null,delete,dll,hex,2010)