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



    昨天,胡sir问我如何把FL2440 的调试串口改为普通串口,我答应他晚上回去看看,晕,昨晚忘记带笔记本电源回去了。所以现在立即补上——我没有在平台上试过,不过我看了一下BSP,我觉得应该是按照如下步骤改的
    一、看F:\开发板光盘\FL24402010.01.28\FL2440\Wince\BSP源码包\SMDK2440A_091112\SMDK2440A\Src\Kernel\Oal 下的debug.c文件有:
    //------------------------------------------------------------------------------
    // Defines
    #define DEBUG_SERIAL_UART0                1
    //#define DEBUG_SERIAL_UART1        1

    #ifdef DEBUG_SERIAL_UART0
    #define FEILING_DEBUG                1
    #elif DEBUG_SERIAL_UART1
    #define FEILING_DEBUG                1
    #else
    #define FEILING_DEBUG                0
    #endif
    //------------------------------------------------------------------------------
    复制代码
    如上说明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
    ; @CESYSGEN IF CE_MODULES_SERIAL
    IF BSP_NOSERIAL !
    IF BSP_NOUART0 !
    IF BSP_KITL != SERIAL_UART0
    IF DEBUG_SERIAL != SERIAL_UART0 ;这个宏定义造成uart0的驱动没有被加载成普通串口,呵呵,若要做普通串口,在SMDK2440A.bat把这个环境变量去掉
    ;=============== UART0 (physical COM1 connector P1) (Serial) ===============
    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial]
       "DeviceArrayIndex"=dword:0
       "Irq"=dword:1c
       "MemBase"=dword:50000000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:0 ; UART 0 Interrupt Sub Register shift bit.
       "ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Index"=dword:1
       "Dll"="serial_smdk2440.dll"
       "Order"=dword:4
       "Priority"=dword:0
       "Port"="COM1:"
       "DeviceType"=dword:0
       "FriendlyName"=LOC_DISPLAYNAME_COM1
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "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
       

    ENDIF
    ENDIF
    ENDIF

    IF BSP_NOUART1 !
    IF BSP_KITL != SERIAL_UART1
    IF DEBUG_SERIAL != SERIAL_UART1
    ;=============== UART1 (physical COM2 connector P2) (Serial) ===============
    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial1]
       "DeviceArrayIndex"=dword:1
       "Irq"=dword:17
       "MemBase"=dword:50004000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:3 ; UART 1 Interrupt Sub Register shift bit.
       "ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Index"=dword:2
       "Dll"="serial_smdk2440.dll"
       "Order"=dword:4
       "Priority"=dword:0
       "Port"="COM2:"
       "DeviceType"=dword:0
       "FriendlyName"=LOC_DISPLAYNAME_COM2
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "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   
    ENDIF
    ENDIF
    ENDIF

    IF BSP_NOUART2 !
    IF BSP_KITL != SERIAL_UART2
    ;=============== UART2 (physical COM3 connector P2) (Serial) ===============
    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2]
       "DeviceArrayIndex"=dword:1
       "Irq"=dword:f
       "MemBase"=dword:50008000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:6 ; UART 2 Interrupt Sub Register shift bit.
       "ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Index"=dword:3
       "Dll"="serial_smdk2440.dll"
       "Order"=dword:4
       "Priority"=dword:0
       "Port"="COM3:"
       "DeviceType"=dword:0
       "FriendlyName"="Serial Cable on COM3";LOC_DISPLAYNAME_COM3
       "Tsp"="unimodem.dll"
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "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   
    ENDIF
    ENDIF

    IF BSP_NOIRDA !
    ; S2440 IrDA(UART2)
    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\IRDA2440]
       "DeviceArrayIndex"=dword:2
       "Irq"=dword:f
       "MemBase"=dword:50008000
       "MemLen"=dword:2C
       "InterruptBitsShift"=dword:6 ; UART 2 Interrupt Sub Register shift bit.
       ;"ISTTimeouts"=dword:200        ; every 512 ticks checking Modem status.
       "Prefix"="COM"
       "Index"=dword:4
       "Dll"="serial_smdk2440.Dll"
       "Order"=dword:4
       "Priority"=dword:0
       "Port"="COM4:"
       "DeviceType"=dword:0  ; IRDA modem, 0 -> null modem
       "FriendlyName"=LOC_DISPLAYNAME_RAWIR
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "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
    ENDIF

    [HKEY_LOCAL_MACHINE\Comm\Irsir1\Parms]
       "Port"=dword:4
       ; 0 = Use external dongle, 1 = Use internal IR
       "IntIR"=dword:1
       ; 0 - internal transceiver, 1 - Extended Systems JetEye dongle.
       "TransceiverType"=dword:0

    ENDIF BSP_NOSERIAL !
    ;=========== End of UART(Serial) ===============
    ; @CESYSGEN ENDIF CE_MODULES_SERIAL
    复制代码
    从上面可以看出,Fl2440 已经有了三个串口作为普通串口驱动注册表信心,甚至红外也保留了。

    现在来看最后一步,看看串口驱动的源码F:\开发板光盘\FL24402010.01.28\FL2440\Wince\BSP源码包\SMDK2440A_091112\SMDK2440A\Src\Drivers\Serial\ser_smdk2440.cpp
    CSerialPDD * CreateSerialObject(LPTSTR lpActivePath, PVOID pMdd,PHWOBJ pHwObj, DWORD DeviceArrayIndex)
    {
        CSerialPDD * pSerialPDD = NULL;
        switch (DeviceArrayIndex) {
          case 0:
            pSerialPDD = new CPdd2440Serial1(lpActivePath,pMdd, pHwObj);
            break;
          case 1:
            pSerialPDD = new CPdd2440Serial2(lpActivePath,pMdd, pHwObj);
            break;
          case 2:
            pSerialPDD = new CPdd2440Serial3(lpActivePath,pMdd, pHwObj);
            break;
                   
        }
        if (pSerialPDD && !pSerialPDD->Init()) {
            delete pSerialPDD;
            pSerialPDD = NULL;
        }   
        return pSerialPDD;
    }
    复制代码
    这个说明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 就可以当普通串口用了。呵呵。


    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/gooogleman/archive/2010/06/20/5680858.aspx#1515003

  • 相关阅读:
    (原)学习ORACLE 视图
    (原)学习ORCALE 表和约束
    下班前网上搜集的方法哈哈
    (传)Visual C# WinForm中DataGrid批量删除解决之道。
    (原)学习ORCALE索引
    用于图片切割,图片压缩,缩略图的生成(转到一个好东西)
    NET 2.0 WinForm Control DataGridView 编程36计(转)
    一些常用PLSQL语句 和事务
    温故知新的经典书评《Programming C# 》中文版第4版
    我最恐惧的事情是竞争力的丧失(转)
  • 原文地址:https://www.cnblogs.com/gooogleman/p/1857163.html
Copyright © 2020-2023  润新知