串口的驱动修改说明:
注册中断变量
1、 在platform/smdk2410/inc/Oalintr.h文件中添加
line 30: #define SYSINTR_SERIAL3 (SYSINTR_FIRMWARE+9)
line 47: #define SYSINTR_SERIAL2(SYSINTR_FIRMWARE+19)
注:下面2步不加也可以通过 by constantine
2、 在 platform/smdk2410/inc/Oalintr.inc添加
line 43: SYSINTR_SERIAL2 .equ SYSINTR_FIRMWARE+19
line 41: SYSINTR_SERIAL3 .equ SYSINTR_FIRMWARE+9
3、 在 platform/smdk2410/inc/Oalintra.inc添加
line 39: SYSINTR_SERIAL3 EQU SYSINTR_FIRMWARE+9
line 40:SYSINTR_SERIAL2 EQU SYSINTR_FIRMWARE+19
二、 修改注册表
1、 在platform.reg中添加:
line 235:
[HKEY_LOCAL_MACHINE/Drivers/BuiltIn/SERIAL2]
"DeviceArrayIndex" = dword:1
"Irq"=dword:13
"IoBase" = dword:50004000
"IoLen" = dword:2C
"Prefix"="COM"
"Dll" = "SER24102.Dll"
"Order"=dword:0
"Index"=dword:5
"Priority"=dword:0
"Port"="COM2"
"DeviceType"=dword:0
"FriendlyName"="Serial Cable on COM2:"
"DeviceConfig"=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
[HKEY_LOCAL_MACHINE/Drivers/BuiltIn/SERIAL3]
"DeviceArrayIndex" = dword:2
"Irq"=dword:09
"IoBase" = dword:50008000
"IoLen" = dword:2C
"Prefix"="COM"
"Dll" = "SER24103.Dll"
"Order"=dword:0
"Index"=dword:5
"Priority"=dword:0
"Port"="COM3"
"DeviceType"=dword:0
"FriendlyName"="Serial Cable on COM3:"
"DeviceConfig"=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
2、 在platform.reg中注销
;[HKEY_LOCAL_MACHINE/Drivers/BuiltIn/IRDA2410]
; "DeviceArrayIndex" = dword:1
; "Irq"=dword:09
; "IoBase" = dword:50008000
;"IoLen" = dword:2C
; "Prefix"="COM3"
; "Dll" = "IRDA2410.Dll"
; "Order"=dword:0
; "Priority"=dword:0
;"Port"="COM3:"
;"DeviceType"=dword:0
;"FriendlyName"="S2410 IRDA2410"
;"Index"=dword:2
; "Iclass"="{A32942B7-920C-486b-B0E6-92A702A99B35}"
三、 代码修改:
1、 在cfw.c中添加:
line 393:
case SYSINTR_SERIAL2: // Serial port.
s2410INT->rSUBSRCPND = (INTSUB_RXD1 | INTSUB_TXD1 | INTSUB_ERR1);
s2410INT->rINTSUBMSK &= ~INTSUB_RXD1;
s2410INT->rINTSUBMSK &= ~INTSUB_TXD1;
s2410INT->rINTSUBMSK &= ~INTSUB_ERR1;
s2410INT->rSRCPND = BIT_UART1;
// S3C2410X Developer Notice (page 4) warns against writing a 1 to a 0 bit in the INTPND register.
if (s2410INT->rINTPND & BIT_UART1) s2410INT->rINTPND = BIT_UART1;
s2410INT->rINTMSK &= ~BIT_UART1;
break;
case SYSINTR_SERIAL3: // Serial Port
s2410INT->rSUBSRCPND = (INTSUB_RXD2 | INTSUB_TXD2 | INTSUB_ERR2);
s2410INT->rINTSUBMSK &= ~INTSUB_RXD2;
s2410INT->rINTSUBMSK &= ~INTSUB_TXD2;
s2410INT->rINTSUBMSK &= ~INTSUB_ERR2;
s2410INT->rSRCPND = BIT_UART2;
// S3C2410X Developer Notice (page 4) warns against writing a 1 to a 0 bit in the INTPND register.
if (s2410INT->rINTPND & BIT_UART2) s2410INT->rINTPND = BIT_UART2;
s2410INT->rINTMSK &= ~BIT_UART2;
break;
line 591:
case SYSINTR_SERIAL2:
s2410INT->rINTMSK |= BIT_UART1;
s2410INT->rINTSUBMSK |= INTSUB_RXD1;
s2410INT->rINTSUBMSK |= INTSUB_TXD1;
s2410INT->rINTSUBMSK |= INTSUB_ERR1;
break;
case SYSINTR_SERIAL3:
s2410INT->rINTMSK |= BIT_UART2;
s2410INT->rINTSUBMSK |= INTSUB_RXD2;
s2410INT->rINTSUBMSK |= INTSUB_TXD2;
s2410INT->rINTSUBMSK |= INTSUB_ERR2;
break;
line 724:
case SYSINTR_SERIAL2:
s2410INT->rINTMSK &= ~BIT_UART1;
s2410INT->rINTSUBMSK &= ~INTSUB_RXD1;
break;
case SYSINTR_SERIAL3:
s2410INT->rINTMSK &= ~BIT_UART2;
s2410INT->rINTSUBMSK &= ~INTSUB_RXD2;
break;
四、 ser2410_ser.c中修改:
line 419:
PVOID
SerInitSerial2(
ULONG Identifier, // @parm Device identifier.
PVOID pMddHead, // @parm First argument to mdd callbacks.
PHWOBJ pHWObj // @parm Pointer to our own HW OBJ for this device
)
{
RETAILMSG(DEBUGMODE, (TEXT("SerInitSerial2/r/n")));
return (SerInit(FALSE, Identifier, pMddHead, pHWObj));
}
PVOID
SerInitSerial3(
ULONG Identifier, // @parm Device identifier.
PVOID pMddHead, // @parm First argument to mdd callbacks.
PHWOBJ pHWObj // @parm Pointer to our own HW OBJ for this device
)
{
RETAILMSG(DEBUGMODE, (TEXT("SerInitIR/r/n")));
return (SerInit(FALSE, Identifier, pMddHead, pHWObj));
}
五、 修改2410.CEC
用Edit工具打开smdk2410.CEC, 在其中添加:
line 317:
line 317:
Implementation
(
Name ( "S32410 Serial UART1" )
GUID ( {7C4427A5-286C-4C7A-B687-4E3B364D079B} )
Description ( "Samsung S32410 serial UART controller." )
BSPPlatformDir ( "smdk2410" )
Version ( "4.2.0.0" )
Locale ( 0409 )
Vendor ( "Microsoft" )
Date ( "2003-1-13" )
SizeIsCPUDependent( 1 )
BuildMethods
(
BuildMethod
(
GUID ( {07DA2083-6261-4ED6-B5BB-70CF4D930D68} )
Step ( BSP )
CPU ( "ARMV4" )
CPU ( "ARMV4I" )
Action ( '#BUILD(SOURCES,"$(_WINCEROOT)/PLATFORM/SMDK2410/drivers/serial")')
)
)
)
Implementation
(
Name ( "S32410 Serial UART2" )
GUID ( {7C4427A5-286C-4C7A-B687-4E3B364D079C} )
Description ( "Samsung S32410 serial UART controller." )
BSPPlatformDir ( "smdk2410" )
Version ( "4.2.0.0" )
Locale ( 0409 )
Vendor ( "Microsoft" )
Date ( "2003-1-13" )
SizeIsCPUDependent( 1 )
BuildMethods
(
BuildMethod
(
GUID ( {07DA2083-6261-4ED6-B5BB-70CF4D930D69} )
Step ( BSP )
CPU ( "ARMV4" )
CPU ( "ARMV4I" )
Action ( '#BUILD(SOURCES,"$(_WINCEROOT)/PLATFORM/SMDK2410/drivers/serial")' )
)
)
)
-------------------by kingmonkey
注:我自己是将串口2的驱动独立写成dll的,如果有人跟我一样做的,需要自己在platform.bib加入copy的代码。
注册表也贴出来给大家参考
[HKEY_LOCAL_MACHINE/Drivers/BuiltIn/SER24102]
"DeviceArrayIndex"=dword:0
"Irq"=dword:15 ;中断号用的是21
"Index"=dword:5
"IoBase"=dword:50004000
"IoLen"=dword:2C
"Prefix"="COM"
"Dll"="SER24102.Dll"
"Order"=dword:1
"Priority"=dword:10
"Port"="COM5:"
"DeviceType"=dword:0
"FriendlyName"="Serial Cable on COM5:"
"Tsp"="Unimodem.dll"
"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
[HKEY_LOCAL_MACHINE/Drivers/BuiltIn/SER24102/Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
"FriendlyName"="SER24102 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
[HKEY_LOCAL_MACHINE/ExtModems]
[HKEY_LOCAL_MACHINE/ExtModems/HayesCompat5]
"Port"="COM5:"
"DeviceType"=dword:1
"FriendlyName"=mui_sz:"Hayes Compatible on COM5:"
我只加一个串口。