




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Module 5: OEM Adaptation Layer OverviewOAL Architecture Operating System Boot SequenceDeveloping OALRequired OAL FunctionsOptional OAL FunctionsDebugging an OALBuilding the Windows CE KernelImplementing OAL Registry FunctionsPower ManagementImplementing Certification ModelOAL ArchitectureKernel (Mic
2、rosoft Supplied components)HardwareRTC and timerfunctionsPowermanagementfunctionsInterrupt-relatedfunctionsReal-TimeClockDebug functionsAnd/OrKITLEthernetportParallelportSerialportOAL (OEM Supplied components)Operating System Boot SequenceStartUpKernelStart orKernelInitialize (x86)OEMInitDebugSerial
3、OEMInitOEMGetExtensionDRAMSet up hardware Register interrupt for system tickPerform other task to enhance system capabilities Developing OALRequired OAL FunctionsOptional OAL FunctionsDebugging an OALBuilding the Windows CE KernelRequired OAL FunctionsStartupDebug SerialOEMInitOEMInit : An ExampleSy
4、stem TimerSystem Timer : SC_GetTickCountInterrupt ProcessingKernel Input/OutputExample: Custom Kernel IOCTLKITLStartUpFirst function called when target device bootsPurpose is to initialize CPU to known state and to call the kernel initialization function (KernelInitialize for x86 and KernelStart on
5、all other platforms)ARM exampleLEAF_ENTRY StartUp . . .; Initialize CPU to a known state; Set up OEMAddressTable for KernelStart . . .bl KernelStart . . .; KernelStart should never returnDebug SerialOEMInitDebugSerial()Configures Speed, Parity, Stop bit length OEMReadDebugByte()Retrieves a byte from
6、 the debug monitor port OEMWriteDebugByte()Outputs a byte to the debug monitor port OEMWriteDebugString()Writes a string to the debug monitor port OEMInitRequired task is to set up hardware and register interrupt for the system tickISRs and HookInterruptOptional tasks to enhance system capabilities
7、include: Setting up performance counters Enabling debug IO control System Halt Default thread quantum Zeroing memorySetting Up the Interrupt MapDefine a mapping of Interrupt IDsInterrupt IDs are returned by the ISRs to the kernel and are used to link an ing IRQ with a software IST OEMInit : An Examp
8、le Void OEMInit() SetUpInterruptMap(); PCIInitBusInfo(); InitDebugEther(); OEMParallelPortInit() InitPICs(); InitClock(); if (MainMemoryEndAddress = CEPC_EXTRA_RAM_START) MainMemoryEndAddress += IsDRAM(MainMemoryEndAddress, CEPC_EXTRA_RAM_SIZE); pKDIoControl = OEMKDIoControl;System TimerMake sure th
9、e system timer interrupt is registered with the ISRProgram the system timer to generate an interrupt every 1ms.In the system timer ISR, update the global system tick counter CurMSec and CurTicks. If doing interrupt timing return SYSINTR_TIMING, else return SYSINTR_RESCHED.DiffMSec is no longer suppo
10、rted in Windows CE .NETSystem Timer : SC_GetTickCountDWORD SC_GetTickCount(void) #if (CE_MAJOR_VER = 0 x0003) return CurMSec;#else DWORD dwInc = 0, dwPartial = dwPartialCurMSec; ULARGE_INTEGER cdummy = 0, 0; CPUGetSysTimerCountElapsed(SYSTEM_TICK_MS, &dwInc, &dwPartial, &cdummy); return CurMSec + dw
11、Inc;#endifInterrupt ProcessingOEMInterruptEnable()Performs hardware operations necessary to allow a device to generate the specified interruptIncludes setting a hardware priority for the device, setting a hardware interrupt enable port, and clearing any pending interrupt conditions from the device O
12、EMInterruptDisable()Disables the specified hardware interrupt OEMInterruptDone()Signals completion of interrupt processing Interrupt Processing (continued)OEMGetInterrupt()Used by the PCI bus enumerator to request an IRQ for a PCI device OEMRequestSysIntr()Used in the OEMIoControl routine to impleme
13、nt IOCTL_HAL_TRANSLATE_IRQ and IOCTL_HAL_REQUEST_SYSINTR OEMTranslateIrq()Used by the main ISR to translate a non-shareable IRQ into a SYSINTR, or the last shared IRQ that is not covered by an installable ISR OEMTranslateSysIntr()Maps a SYSINTR to its corresponding IRQ Kernel Input/OutputBOOL OEMIoC
14、ontrol(. . .) switch (dwIoControlCode) case IOCTL_HAL_SET_DEVICE_INFO : case IOCTL_HAL_REBOOT: . . . default: return FALSE; return TRUE;OEMIoControl is called by the kernel when a device driver or application program calls the KernelIoControl function Extend the Ethernet Debugging InterfaceExample:
15、Custom Kernel IOCTL#define IOCTL_MY_CONTROL1 CTL_CODE(FILE_DEVICE_HAL, 2048, METHOD_NEITHER, FILE_ANY_ACCESS)BOOL OEMIoControl(. . .) switch (dwIoControlCode) case IOCTL_MY_CONTROL1: . . . RetCode = KernelIoControl( IOCTL_MY_CONTROL1 , . . . );KITLDesigned to provide an easy way for you to support a
16、ny debug service Separates the protocol of the communication service from the layer that communicates directly with the communication hardware reducing your involvement in creating a hardware transport layer Including the KITL support in the operating system imageOptional OAL FunctionsReal-time Cloc
17、k and TimerParallel Port I/O CodeEthernet Port DebugOEMGetExtensionDRAM()Real-time Clock and TimerOEMGetRealTime()Called by the kernel to get the time from the real-time clockOEMSetRealTime() Sets the real time clock OEMQueryperformanceCounter()Retrieves the current value of the high-resolution perf
18、ormance counter, if one exists OEMQueryPerformanceFrequency()Retrieves the frequency of the high-resolution performance counter, if one existsOEMSetAlarmTime()Sets the alarm time Parallel Port I/O CodeOEMParallelPortSendByte()Sends a byte of data from the target device to the development workstation
19、 over the parallel port OEMParallelPortGetByte()Receives a byte of data on the target device from the development workstation over the parallel port interface OEMParallelPortGetStatus()Checks the status of the parallel port and returns a byte if the port is readyEthernet Port DebugOEMEthInitInitiali
20、zes the Ethernet debug portOEMEthEnableIntsEnables interrupt on the Ethernet adapterOEMEthDisableIntsDisables interrupt on the Ethernet adapterOEMEthISRRoutine that handles interrupts for the Ethernet adapterOEMEthGetFrameReceives data from the Ethernet debug portOEMEthSendFrameSends data over the E
21、thernet debug portOEMEthQueryClientInfoRetrieves platform-specific informationOEMEthGetSecsReturns the number of seconds elapsed since a fixed time. This function is used for handling timeouts.OEMGetExtensionDRAM()Example 2: Extended 4MB DRAM available at 0 x81800000Example 1: No extension DRAM avai
22、lableBOOL OEMGetExtensionDRAM(LPDWORD lpMemStart, LPDWORD lpMemLen) return FALSE; / no extension DRAMBOOL OEMGetExtensionDRAM(LPDWORD lpMemStart, LPDWORD lpMemLen) *lpMemStart = 0 x81800000; *lpMemLen = 0 x00400000; / 4MB return TRUE;pNKEnumExtensionDRAM AND OEMEnumExtensionDRAMDebugging an OALTest
23、GetTickCount and Sleep functionsvoid OALTest(dwMSec) DWORD absoluteValue = 0; DWORD dwLastTickCount = 0; DWORD dwTickCount = 0; dwLastTickCount = GetTickCount(); Sleep(dwMSec); dwTickCount = GetTickCount(); if (dwTickCount (dwLastTickCount + dwMSec) absoluteValue = dwTickCount - (dwLastTickCount + d
24、wMSec); else absoluteValue = (dwLastTickCount + dwMSec)-dwTickCount; if (absoluteValue 5) / SLEEP TENTH DIFFERENCE RETAILMSG(1, (TEXT(FAIL: exceeded); else RETAILMSG(1, (TEXT(PASS: passed);Building the Windows CE KernelBuilding CE Kernel (no profiling)TARGETTYPE=PROGRAMTARGETNAME=kernkitlTARGETLIBS
25、= $( MONOAKROOT)lib$(_CPUDEPPATH)nk.lib $( MONOAKROOT)lib$(_CPUDEPPATH)kitl.lib $( MONOAKROOT)lib$(_CPUDEPPATH)kitleth.lib $( MONOAKROOT)lib$(_CPUDEPPATH)smc9000.lib $( MONOAKROOT)lib$(_CPUDEPPATH)ne2kdbg.lib $( MONOAKROOT)lib$(_CPUDEPPATH)rne_mdd.lib $( MONOAKROOT)lib$(_CPUDEPPATH)net2890lib.lib $(
26、 MONOAKROOT)lib$(_CPUDEPPATH)eboot.lib $(_TARGETPLATROOT)lib$(_CPUINDPATH)hal.lib $( MONOAKROOT)lib$(_CPUINDPATH)PCIreg.lib $( MONOAKROOT)lib$(_CPUINDPATH)i486oal.lib $( MONOAKROOT)lib$(_CPUDEPPATH)loadauth.lib $( MONOAKROOT)lib$(_CPUINDPATH)fulllibc.libBuilding the Windows CE Kernel (continued)TARG
27、ETTYPE=PROGRAM TARGETNAME=kernkitlprof TARGETLIBS = $( MONOAKROOT)lib$(_CPUDEPPATH)nkprof.lib $( MONOAKROOT)lib$(_CPUDEPPATH)kitl.lib $( MONOAKROOT)lib$(_CPUDEPPATH)kitleth.lib $( MONOAKROOT)lib$(_CPUDEPPATH)ddk_io.lib $( MONOAKROOT)lib$(_CPUDEPPATH)eboot.lib $(_TARGETPLATROOT)lib$(_CPUDEPPATH)hal.l
28、ib $( MONOAKROOT)lib$(_CPUINDPATH)PCIreg.lib $( MONOAKROOT)lib$(_CPUINDPATH)ne2kdbg.lib $( MONOAKROOT)lib$(_CPUINDPATH)smc9000.lib $(_TARGETPLATROOT)lib$(_CPUDEPPATH)profiler.lib $( MONOAKROOT)lib$(_CPUINDPATH)fulllibc.lib $( MONOAKROOT)lib$(_CPUDEPPATH)loadauth.libFor profiler supportFor profiler s
29、upportBuilding CE Kernel (with profiling)Implementing OAL Registry FunctionsWriteRegistryToOEM()Enables writing the registry file to persistent storage defined by the OEMOperating system exposes a global pointer named pWriteRegistryToOEM that is available in the OAL ReadRegistryFromOEM()Reads into R
30、AM a registry file from persistent storage defined by the OEMOperating system exposes a global variable named pReadRegistryFromOEM that is available in the OAL RegFlushKey()Writes all the attributes of the specified open key into the registry Power ManagementPower ManagerTransition Between States: A
31、n ExampleGWES Control of On-to-Suspend Power StateOAL Power Management FunctionsPower ManagerProvides power management for each deviceImproves overall system power efficiencyImplemented via Pm.dllDefine your own System Power States RunAC, RunDC, SuspendDevice Power States (statically pre-defined)Ful
32、l on (D0), Low on (D1), Standby (D2), Sleep (D3), Off (D4) Uses IOCTLs to manipulate the power states of the system Power Manager (continued)Mapping System Power State to Device Power StateEnumerated as values under each power state name key in the registry HKLMSYSTEMCurrentControlSetControlPowerSta
33、teName Flags: REG_DWORD:xxxx (Default): REG_DWORD:Dx DeviceName: REG_DWORD:DxName Defines your system power state nameFlags Defines whether the state pertains to AC, DC, AC and DC, behavioral settings, and so on(Default) Default device power setting for all devices while at system power state NameDx
34、 Device power state. Set to D0, D1, D2, D3, or D4. DeviceName Optional; Specifies devices with specific device power state requirements Transition Between States: An ExampleNo PowerOnCritical OffClear File SystemClear Working RAMIdleSuspendNo threads to runAny interruptActivity timer time-outWake-up
35、 eventCritical low-batteryNew batteryWarmbootColdbootGWES Control of On-to-Suspend Power StateGWES uses the registry to control the On-to-Suspend power stateHKLMSystemCurrentControlSetControlPower “BattPowerOff”=dword:300 “ExtPowerOff”=dword:0 “WakeupPowerOff”=dword:60 “ScreenPowerOff”=dword:0OAL Power Management Functions OAL Power Management FunctionsOEMIdle - Puts the CPU in reduced power modeOEMPowerOff - Puts the CPU in suspend modeDevi
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 幼儿园家长学校评价反馈职责
- 2025年行政人事部岗位职责梳理年终总结及工作计划
- 幼儿园工会职责与家长沟通机制
- 2024-2025学年度第一学期学校安全隐患排查计划
- 学校健康观察室疫情排查职责他
- 解放思想推动养老服务创新的个人心得体会
- 中小企业发展调研报告范文
- 2025年八年级班主任班主任自我提升计划范文
- 消防工程确保医疗机构安全生产的技术组织措施
- 剪纸文化非遗传承计划
- 2025年低压电工证考试试题及答案
- 实践制作“龙骨水车”模型课件-沪科版八年级全一册物理
- 供应链计划员考试题库
- 华南理工大学强基校测面试题
- 2025年湖北省中考语文试卷真题(含标准答案)
- 2024-2025学年湖北省荆州市八县高一上学期期末联考数学试题(解析版)
- 2025年投资学基础知识考试试题及答案
- 2025届江苏省如东县英语八年级第二学期期末统考试题含答案
- 2025新疆新型储能发展概述与展望报告-国网新疆经研院
- 校长在2025暑假前期末教师大会上的讲话:静水深流脚踏实地
- 肿瘤护理专家共识
评论
0/150
提交评论