阅读:1638回复:2
wince4.2 多串口驱动问题 ,请赐教.平台资源: : s3c2440, wince4.2平台,三路串口uart0~ uart3,采用原版bsp包提供uart0给用户使用,uart1为调试输出用,uart2为红外口. 目的: 除uart0外再定制出一路串口供用户使用. 修改方法: oalintr.h #define SYSINTR_UART1 (SYSINTR_FIRMWARE+22) #define SYSINTR_UART0 (SYSINTR_FIRMWARE+3) #define SYSINTR_UART2 (SYSINTR_FIRMWARE+23) ===================================================================armint.c else if(IntPendVal == INTSRC_UART0) // SERIAL (UART0) (physical COM1: P1 connector). { SubIntPendVal = s2440INT->rSUBSRCPND; // Note that we only mask the sub source interrupt - the serial driver will clear the // sub source pending register. if(SubIntPendVal & INTSUB_ERR0) { s2440INT->rINTSUBMSK |= INTSUB_ERR0; } else if(SubIntPendVal & INTSUB_RXD0) { s2440INT->rINTSUBMSK |= INTSUB_RXD0; #if USE_AFC // by 0212. s2440IOP->rGPHDAT |= (0x2); // Deassert nRTS #endif } else if(SubIntPendVal & INTSUB_TXD0) { s2440INT->rINTSUBMSK |= INTSUB_TXD0; } else { return(SYSINTR_NOP); } // NOTE: Don't clear INTSRC:UART0 here - serial driver does that. // s2440INT->rINTMSK |= BIT_UART0; if (s2440INT->rINTPND & BIT_UART0) s2440INT->rINTPND = BIT_UART0; RETAILMSG(1,(TEXT("Armint.c Uart0 Intrrupter Occur"))); return(SYSINTR_UART0); } else if(IntPendVal == INTSRC_UART1) // IrDA (UART1) { SubIntPendVal = s2440INT->rSUBSRCPND; if(SubIntPendVal & INTSUB_ERR1) { s2440INT->rINTSUBMSK |= INTSUB_ERR1; } else if(SubIntPendVal & INTSUB_RXD1) { s2440INT->rINTSUBMSK |= INTSUB_RXD1; } else if(SubIntPendVal & INTSUB_TXD1) { s2440INT->rINTSUBMSK |= INTSUB_TXD1; } else { return(SYSINTR_NOP); } // NOTE: Don't clear INTSRC:UART1 here - serial driver does that. // s2440INT->rINTMSK |= BIT_UART1; if (s2440INT->rINTPND & BIT_UART1) s2440INT->rINTPND = BIT_UART1; RETAILMSG(1,(TEXT("Armint.c Uart1 Intrrupter Occur"))); return(SYSINTR_UART1); } else if(IntPendVal == INTSRC_UART2) // IrDA (UART2) { SubIntPendVal = s2440INT->rSUBSRCPND; if(SubIntPendVal & INTSUB_ERR2) { s2440INT->rINTSUBMSK |= INTSUB_ERR2; } else if(SubIntPendVal & INTSUB_RXD2) { s2440INT->rINTSUBMSK |= INTSUB_RXD2; } else if(SubIntPendVal & INTSUB_TXD2) { s2440INT->rINTSUBMSK |= INTSUB_TXD2; } else { return(SYSINTR_NOP); } // NOTE: Don't clear INTSRC:UART2 here - serial driver does that. // s2440INT->rINTMSK |= BIT_UART2; if (s2440INT->rINTPND & BIT_UART2) s2440INT->rINTPND = BIT_UART2; RETAILMSG(1,(TEXT("Armint.c Uart2 Intrrupter Occur"))); return(SYSINTR_UART2); } =================================================================================cfw.c OEMInterruptDone(DWORD idInt) // @parm Interrupt ID. See <t Interrupt ID's> // for the list of possible values. { case SYSINTR_UART0: s2440INT->rINTMSK &= ~BIT_UART0; s2440INT->rINTSUBMSK &= ~INTSUB_RXD0; RETAILMSG(1,(TEXT("cfw.c InterrupDone Uart0 Intrrupter Occur"))); break; case SYSINTR_UART1: s2440INT->rINTMSK &= ~BIT_UART1; s2440INT->rINTSUBMSK &= ~INTSUB_RXD1; RETAILMSG(1,(TEXT("cfw.c InterrupDone Uart1 Intrrupter Occur"))); break; case SYSINTR_UART2: s2440INT->rINTMSK &= ~BIT_UART2; s2440INT->rINTSUBMSK &= ~INTSUB_RXD2; RETAILMSG(1,(TEXT("cfw.c InterrupDone Uart2 Intrrupter Occur"))); break; } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; UART0 (physical COM1 connector P1) (Serial) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF BSP_NOSERIAL ! [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER2440] "DeviceArrayIndex"=dword:0 "Irq"=dword:03 "IoBase"=dword:50000000 "IoLen"=dword:2C "Prefix"="COM" "Dll"="SER2440.Dll" "Order"=dword:0 "Priority"=dword:0 "Port"="COM1:" "DeviceType"=dword:0 ; null modem "FriendlyName"="S2440 COM1" ; "Index"=dword:2 "IClass"="{A32942B7-920C-486b-B0E6-92A702A99B35}" ENDIF BSP_NOSERIAL ! [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER2440\Unimodem] "Tsp"="Unimodem.dll" "DeviceType"=dword:0 "FriendlyName"="SER2440 UNIMODEM" "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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; UART1 (physical COM2 connector P1) (Serial) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;IF BSP_NOSERIAL ! ;[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER24401] ; "DeviceArrayIndex"=dword:1 ; "Irq"=dword:16 ; "IoBase"=dword:50004000 ; "IoLen"=dword:2C ; "Prefix"="COM" ; "Dll"="SER24402.Dll" ; "Order"=dword:0 ; "Priority"=dword:0 ; "Port"="COM2:" ; "DeviceType"=dword:0 ; "FriendlyName"="S2440 COM2:" ; "IClass"="{A32942B7-920C-486b-B0E6-92A702A99B35}" ;ENDIF BSP_NOSERIAL ! ;[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER24401\Unimodem] ; "Tsp"="Unimodem.dll" ; "DeviceType"=dword:0 ; "FriendlyName"="SER2440 COM2" ; "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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; UART2 (physical COM3 connector P1) (Serial) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IF BSP_NOSERIAL ! [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER24402] "DeviceArrayIndex"=dword:2 "Irq"=dword:17 "IoBase"=dword:50008000 "IoLen"=dword:2C "Prefix"="COM" "Dll"="SER24403.Dll" "Order"=dword:0 "Priority"=dword:0 "Port"="COM3:" "DeviceType"=dword:0 "FriendlyName"="S2440 COM3:" "IClass"="{A32942B7-920C-486b-B0E6-92A702A99B35}" ENDIF BSP_NOSERIAL ! [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\SER24402\Unimodem] "Tsp"="Unimodem.dll" "DeviceType"=dword:0 "FriendlyName"="SER2440 COM3" "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 遇到问题: 1. 关闭调试口uart1,后系统无法启动 2. 保留uart1调试功能,修改uart2后,系统正常启动,注册表中有相关键值,但应用程序打开uart2,无任何反映( 通过调试输出观察, 应该是没有打开该串口), uart0却 一直是可用的. 3. "D:\WINCE420\PLATFORM\SMDK2410\DRIVERS\SERIAL" 该目下无mdd.c,不知道内核如何调用该函数: "PHWOBJ GetSerialObject(DWORD DeviceArrayIndex)" 本人初学者,请高手给点思路// |
|
沙发#
发布于:2007-07-23 07:41
1.把调试口关掉后,OAL层打不出调试信息,系统就无法启动了,所以,用做调试的串口,驱动初始化时不要关掉它.
3.MDD是一个LIB的形式提供的,PDD中链接了它 |
|
|
板凳#
发布于:2007-07-23 09:27
谢谢,已经解决/
做法如下: 1. 保留调试口 2. 屏蔽所有红外相关部分代码,, 增加新的中断资源给uart2,对应uart0增加注册表信息.,这里我定义该口为"com3". 测试结果: ce应用软件可以打开com1,com2使用, 但不是我自己定义的"com3" 理论上调试输出口应该为"com2" .. 不知道这个怎么解释?? |
|