一、IRQ、IO Port設定
1、BIOS的IRQ和IO Port需先設定好
2、修改OALIntrInit
找到相關cpu chip的inin.c,
修改OALIntrInit function,使用OALIntrStaticTranslate(UINT32
sysIntr, UINT32 irq)設定。該IRQt與BIOS的IRQ相對應。
如:
OALIntrStaticTranslate(SYSINTR_FIRMWARE +4,
4)
3、修改platform.reg
在COM Port的registry
section設定IRQ、IO Port,SysIntr圍上一步驟
OALIntrStaticTranslate裡的sysIntr+10,IoBase對應到BIOS的IO Port。
如:
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial1]
"SysIntr"=dword:14
"IoBase"=dword:03F8
二、設定COM Port的屬性(BaudRate、Parity…),修改platform.reg
如:
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial1\Unimodem]
"BaudRate"=dword:9600
Note:
The Config key contains commands for configuring various
modem settings. The values under this key override corresponding members of the
DevConfig
structure.
The following
table shows the named values for the
Value : type
|
Description
|
BaudRate : REG_DWORD |
Specifies the default baud rate for the device, usually
19200. |
ByteSize |
Specifies the byte size for the device, usually 8. |
CallSetupFailTimer : REG_DWORD |
Specifies the default number of seconds for connection
establishment, usually 120. |
DialModifier : REG_SZ |
Specifies the modem command string to be issued
immediately before the dial command. This value usually is not specified. |
EnableAutoBaud : REG_DWORD |
Enables or disables auto-baud rate detection for direct
serial connection devices. This value is usually set to 0, which disables
auto-baud rate detection. |
EnableBlindDial : REG_DWORD |
Enables or disables blind dial functionality. This value
is usually set to 0, which disables blind dial. |
EnableFlowHard : REG_DWORD |
Enables or disables hardware flow control. This value is
usually set to 1, which enables hardware flow control. |
EnableFlowSoft : REG_DWORD |
Enable or disable software flow control. This value is
usually set to 0, which disables software flow control. |
EnableToneDial : REG_DWORD |
Enables or disables tone dial functionality. This value
is usually set to 1, which enables tone dial functionality. |
ManualDial : REG_DWORD |
Enables or disables manual dial terminal window. This
value is usually set to 0, which disables the manual dial terminal window. |
Parity : REG_DWORD |
Specifies one of the parity modes that are defined in
Winbase.h in the %_WINCEROOT%\Public\common\sdk\inc directory. This value is
usually set to 0, which means that no parity mode is specified. |
PostDialTerminal : REG_DWORD |
Enables or disables post-dial terminal window. This value
is usually set to 0, which disables the post-dial terminal window. |
PreDialTerminal : REG_DWORD |
Enables or disables pre-dial terminal window. This value
is usually set to 0, which disables the pre-dial terminal window. |
StopBits : REG_DWORD |
Specifies one of the stop bits modes that are defined in
Winbase.h. This value is usually set to 0, which specifies 1 stop bit. |
WaitBong : REG_WORD |
Specifies the seconds to wait for prompt tone. This value
is usually set to 0. |
實作如下:
假設板子有五個COM Port 。
1、BIOS的IRQ、IO Port設定值
COM1
IRQ=4 ; IoBase= 03F8
COM2
IRQ=3 ; IoBase= 02F8
COM3
IRQ=6 ; IoBase= 03E8
COM4
IRQ=13 ; IoBase= 02E8
COM5
IRQ=10 ; IoBase= 04E8
2、修改OALIntrInit
BOOL OALIntrInit (void)
{
OALMSG(OAL_INTR&&OAL_FUNC,
(L"+OALInterruptInit\r\n"));
// Initialize interrupt mapping
OALIntrMapInit();
// The following block of code sets up the system interrupt mapping
table.
// The goal is to follow the interrupt lay out of a legacy PC for
simplicity.
// This may be modified according to hardware requirements.
// IRQ0 is timer0, the scheduler tick
OALIntrStaticTranslate(SYSINTR_RESCHED, INTR_TIMER0);
OALIntrStaticTranslate(SYSINTR_KEYBOARD, 1);
// IRQ2 is the cascade interrupt for the second PIC
// Serial Port Info
//
// The legacy COM port layout defines IRQ4 being shared by COM ports 1
and 3
// and IRQ3 is shared COM ports 2 and 4.
// If the legacy IRQ layout is followed, only 1 COM port per IRQ should
be enabled.
//
COM1 - 0x3F8-0x3FF, IRQ4 ; COM2 - 0x2F8-0x3FF, IRQ3
// COM3 - 0x3E8-0x3EF, IRQ4
; COM4 - 0x2E8-0x2EF, IRQ3
//
COM2 IRQ=3 ; IoBase= 02F8
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 3, 3);
// COM1 IRQ=4 ; IoBase= 03F8
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 4,
4);
// COM3 IRQ=6 ; IoBase= 03E8 ; IRQ6
is normally the floppy controller.
OALIntrStaticTranslate(SYSINTR_FIRMWARE
+ 6, 6);
//
COM4 IRQ=13 ; IoBase= 02E8 ; IRQ13 is normally the coprocessor
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 13, 10);
// COM5 IRQ=10 ; IoBase= 04E8
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 10, 10);
// IRQ5 is legacy LPT2 - this IRQ is potentially available.
//
Currently this interrupt is being used for Audio support on the emulator.
OALIntrStaticTranslate(SYSINTR_FIRMWARE
+ 5, 5);
// IRQ7 is normally LPT1
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 7, 7);
// IRQ8 is the real time clock
OALIntrStaticTranslate(SYSINTR_RTC_ALARM, 8);
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 9, 9);
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 11, 11);
OALIntrStaticTranslate(SYSINTR_TOUCH, 12);
// IRQ14 is normally the hard disk controller
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 14, 14);
OALIntrStaticTranslate(SYSINTR_FIRMWARE + 15, 15);
OALMSG(OAL_INTR&&OAL_FUNC, (L"-OALInterruptInit(rc =
%d)\r\n", TRUE));
return TRUE;
}
3、修改platform.reg
;-- Resource Manager Configuration
---------------------------------------------
; HIVE BOOT SECTION
[HKEY_LOCAL_MACHINE\Drivers\Resources\IRQ]
"Identifier"=dword:1
"Minimum"=dword:1
"Space"=dword:F
"Ranges"="1,3-7,9-0xF"
"Shared"="1,3-7,9-0xF"
[HKEY_LOCAL_MACHINE\Drivers\Resources\IO]
"Identifier"=dword:2
"Minimum"=dword:0
"Space"=dword:10000
"Ranges"="0-0x5F,0x65-0x277,0x284-0x38F,0x392-0x3DF,0x3E2-0xFFFF"
IF BSP_SERIAL1
"Ranges"="0-0x5F,0x65-0x277,0x284-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0xFFFF"
ENDIF BSP_SERIAL1
IF BSP_SERIAL2
"Ranges"="0-0x5F,0x65-0x277,0x284-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0x3E7,0x3F0-0xFFFF"
ENDIF BSP_SERIAL2
IF BSP_SERIAL3
"Ranges"="0-0x5F,0x65-0x277,0x284-0x2EA,0x2F0-0x2F7,0x300-0x38F,0x392-0x3DF,0x3E2-0x3EA,0x3F0-0xFFFF"
ENDIF BSP_SERIAL3
IF BSP_PCH_EG20T
IF BSP_SERIAL1
[HKEY_LOCAL_MACHINE\Drivers\Resources\IO]
;
PCH EG20T COM debug port IO range = 0x3F8-ox3FF
"Ranges"="0-0x5F,0x65-0x277,0x284-0x38F,0x392-0x3DF,0x3E2-0x3F7,0x400-0xFFFF"
ENDIF BSP_SERIAL1
ENDIF BSP_PCH_EG20T
; END HIVE BOOT SECTION
;-------------------------------------------------------------------------------
..........................................................
..........................................................
;-- 16550 UART
-----------------------------------------------------------------
; @CESYSGEN IF CE_MODULES_SERIAL
;IF BSP_NOSERIAL !
; @XIPREGION IF PACKAGE_OEMXIPKERNEL
; @XIPREGION ENDIF PACKAGE_OEMXIPKERNEL
; @XIPREGION IF PACKAGE_OEMDRIVERS
IF BSP_SERIAL1
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial1]
"Flags"=dword:0010
; User Mode: DEVFLAGS_LOAD_AS_USERPROC
"Dll"="Com16550.Dll"
"Prefix"="COM"
"Order"=dword:0
"Index"=dword:1
"SysIntr"=dword:14 ;//IRQ=4
IF BSP_PCH_EG20T
;
PCH EG20T COM debug port IOBase=0x3F8 (per BIOS settings)
"IoBase"=dword:03F8
ELSE
"IoBase"=dword:03F8
ENDIF BSP_PCH_EG20T
"IoLen"=dword:8
"DeviceArrayIndex"=dword:0
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
"UserProcGroup"=dword:$(PROCGROUP_DRIVER_MSFT_DEFAULT)
IF IMGENFORA
;
Turn on installable ISR (isr16550 supporting SOFTWARE FIFO)
"Flags"=dword:0
; Kernel Mode
"Irq"=dword:3
"IsrDll"="isr16550.dll"
"IsrHandler"="ISRHandler"
ENDIF IMGENFORA
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial1\Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
"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
"BaudRate"=dword:9600
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial1\HayesCompat]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:1
ENDIF BSP_SERIAL1
IF BSP_SERIAL2
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2]
"Flags"=dword:0010
; User Mode: DEVFLAGS_LOAD_AS_USERPROC
"Dll"="Com16550.Dll"
"Prefix"="COM"
"Order"=dword:1
"Index"=dword:2
"SysIntr"=dword:13 ; //IRQ=3
"IoBase"=dword:02F8
"IoLen"=dword:8
"DeviceArrayIndex"=dword:1
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
"UserProcGroup"=dword:$(PROCGROUP_DRIVER_MSFT_DEFAULT)
IF IMGENFORA_COM2
;
Turn on installable ISR (isr16550 supporting SOFTWARE FIFO)
"Flags"=dword:0
; Kernel Mode
"Irq"=dword:3
"IsrDll"="isr16550.dll"
"IsrHandler"="ISRHandler"
ENDIF
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2\Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
"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
"BaudRate"=dword:9600
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial2\HayesCompat]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:1
ENDIF BSP_SERIAL2
IF BSP_SERIAL3
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial3]
"Flags"=dword:0010
; User Mode: DEVFLAGS_LOAD_AS_USERPROC
"Dll"="Com16550.Dll"
"Prefix"="COM"
"Order"=dword:2
"Index"=dword:3
"SysIntr"=dword:16 ; //IRQ=6
"IoBase"=dword:03E8
"IoLen"=dword:8
"DeviceArrayIndex"=dword:2
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
"UserProcGroup"=dword:$(PROCGROUP_DRIVER_MSFT_DEFAULT)
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial3\Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
"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
"BaudRate"=dword:9600
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial3\HayesCompat]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:1
ENDIF BSP_SERIAL3
IF BSP_SERIAL4
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial4]
"Flags"=dword:0010
; User Mode: DEVFLAGS_LOAD_AS_USERPROC
"Dll"="Com16550.Dll"
"Prefix"="COM"
"Order"=dword:3
"Index"=dword:4
"SysIntr"=dword:1D
"IoBase"=dword:02E8
"IoLen"=dword:8
"DeviceArrayIndex"=dword:3
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
"UserProcGroup"=dword:$(PROCGROUP_DRIVER_MSFT_DEFAULT)
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial4\Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
"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
"BaudRate"=dword:9600
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial4\HayesCompat]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:1
ENDIF BSP_SERIAL4
IF BSP_SERIAL5
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial5]
"Flags"=dword:0010
; User Mode: DEVFLAGS_LOAD_AS_USERPROC
"Dll"="Com16550.Dll"
"Prefix"="COM"
"Order"=dword:4
"Index"=dword:5
"SysIntr"=dword:1A
"IoBase"=dword:04E8
"IoLen"=dword:8
"DeviceArrayIndex"=dword:4
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
"UserProcGroup"=dword:$(PROCGROUP_DRIVER_MSFT_DEFAULT)
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial5\Unimodem]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:0
"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
"BaudRate"=dword:9600
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial5\HayesCompat]
"Tsp"="Unimodem.dll"
"DeviceType"=dword:1
ENDIF BSP_SERIAL5
; @XIPREGION ENDIF PACKAGE_OEMDRIVERS
;ENDIF BSP_NOSERIAL !
; @CESYSGEN ENDIF CE_MODULES_SERIAL
;-------------------------------------------------------------------------------
沒有留言:
張貼留言