wince5.0 标准三星BSPOAL详细分析

本文介绍了 Windows CE 操作系统中 OEMInit 函数的详细实现过程,该函数负责系统的初始化工作,包括处理器类型设置、内存配置、缓存初始化等。此外,还深入解析了 OEMInterruptHandler 函数,它用于处理不同类型的中断请求,如定时器中断、外部中断等。

首先看如下函数,是OAL的初始化函数,我看后大吃一惊,因为和4.2升级到5.0的BSP相差太大了。

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Function:  OEMInit
  4. //
  5. //  This is Windows CE OAL initialization function. It is called from kernel
  6. //  after basic initialization is made.
  7. //
  8. void OEMInit()
  9. {
  10.     OALMSG(OAL_FUNC, (L"+OEMInit/r/n"));//连串口打印函都变了
  11.     CEProcessorType=PROCESSOR_STRONGARM;
  12.     // Set memory size for DrWatson kernel support
  13.     dwNKDrWatsonSize = 128 * 1024;
  14.     // Initilize cache globals
  15.     OALCacheGlobalsInit();
  16.     OALLogSerial(
  17.         L"DCache: %d sets, %d ways, %d line size, %d size/r/n"
  18.         g_oalCacheInfo.L1DSetsPerWay, g_oalCacheInfo.L1DNumWays,
  19.         g_oalCacheInfo.L1DLineSize, g_oalCacheInfo.L1DSize
  20.     );
  21.     OALLogSerial(
  22.         L"ICache: %d sets, %d ways, %d line size, %d size/r/n"
  23.         g_oalCacheInfo.L1ISetsPerWay, g_oalCacheInfo.L1INumWays,
  24.         g_oalCacheInfo.L1ILineSize, g_oalCacheInfo.L1ISize
  25.     );
  26.     
  27.     // Initialize interrupts
  28.     if (!OALIntrInit()) {
  29.         OALMSG(OAL_ERROR, (
  30.             L"ERROR: OEMInit: failed to initialize interrupts/r/n"
  31.         ));
  32.     }
  33.     // Initialize system clock
  34.     OALTimerInit(1, 17, 0); //S3C2440A_PCLK/245/16/1000=16.992
  35.     ConfigureGPIO();
  36.     InitDisplay();
  37.     // Initialize the KITL connection if required
  38.     OALKitlStart();
  39.     OALMSG(OAL_FUNC, (L"-OEMInit/r/n"));
  40. }

再看看这个中断转换函数

  1. //------------------------------------------------------------------------------
  2. //
  3. //  Function:  OEMInterruptHandler
  4. //
  5. ULONG OEMInterruptHandler(ULONG ra)
  6. {
  7.     UINT32 sysIntr = SYSINTR_NOP;
  8.     UINT32 irq, irq2, mask;
  9.     // Get pending interrupt(s)
  10.     irq = INREG32(&g_pIntrRegs->INTOFFSET);
  11.     // System timer interrupt?
  12.     if (irq == IRQ_TIMER4) {
  13.         // Clear the interrupt
  14.         OUTREG32(&g_pIntrRegs->SRCPND, 1 << IRQ_TIMER4);
  15.         OUTREG32(&g_pIntrRegs->INTPND, 1 << IRQ_TIMER4);
  16.         // Rest is on timer interrupt handler
  17.         sysIntr = OALTimerIntrHandler();
  18.     }    
  19.     // Profiling timer interrupt?
  20.     else if (irq == IRQ_TIMER2)
  21.     {
  22.         // Mask and Clear the interrupt.
  23.         mask = 1 << irq;
  24.         SETREG32(&g_pIntrRegs->INTMSK, mask);
  25.         OUTREG32(&g_pIntrRegs->SRCPND, mask);
  26.         OUTREG32(&g_pIntrRegs->INTPND, mask);
  27.         // The rest is up to the profiling interrupt handler (if profiling
  28.         // is enabled).
  29.         //
  30.         if (g_pProfilerISR)
  31.         {
  32.             sysIntr = g_pProfilerISR(ra);
  33.         }
  34.     }
  35.     else 
  36.     {
  37. #ifdef OAL_ILTIMING
  38.         if (g_oalILT.active) {
  39.             g_oalILT.isrTime1 = OALTimerCountsSinceSysTick();
  40.             g_oalILT.savedPC = 0;
  41.             g_oalILT.interrupts++;
  42.         }        
  43. #endif
  44.     
  45.         if (irq == IRQ_EINT4_7 || irq == IRQ_EINT8_23) { // 4 or 5
  46.             // Find external interrupt number
  47.             mask = INREG32(&g_pPortRegs->EINTPEND);
  48.             mask &= ~INREG32(&g_pPortRegs->EINTMASK);
  49.             mask = (mask ^ (mask - 1)) >> 5;
  50.             irq2 = IRQ_EINT4;
  51.             while (mask != 0) {
  52.                 mask >>= 1;
  53.                 irq2++;
  54.             }
  55.             // Mask and clear interrupt
  56.             mask = 1 << (irq2 - IRQ_EINT4 + 4);
  57.             SETREG32(&g_pPortRegs->EINTMASK, mask);
  58.             OUTREG32(&g_pPortRegs->EINTPEND, mask);
  59.             // Clear primary interrupt
  60.             mask = 1 << irq;
  61.             OUTREG32(&g_pIntrRegs->SRCPND, mask);
  62.             OUTREG32(&g_pIntrRegs->INTPND, mask);
  63.             // From now we care about this irq
  64.             irq = irq2;
  65.         }  else {
  66.             // Mask and clear interrupt
  67.             mask = 1 << irq;
  68.             SETREG32(&g_pIntrRegs->INTMSK, mask);
  69.             OUTREG32(&g_pIntrRegs->SRCPND, mask);
  70.             OUTREG32(&g_pIntrRegs->INTPND, mask);
  71.         }
  72.         // First find if IRQ is claimed by chain
  73.         sysIntr = NKCallIntChain((UCHAR)irq);
  74.         if (sysIntr == SYSINTR_CHAIN || !NKIsSysIntrValid(sysIntr)) {
  75.             // IRQ wasn't claimed, use static mapping
  76.             sysIntr = OALIntrTranslateIrq(irq);
  77.         }
  78.     }
  79.     g_oalLastSysIntr = sysIntr;
  80.     return sysIntr;
  81. }
  82. //------------------------------------------------------------------------------
已经博主授权,源码转载自 https://pan.quark.cn/s/a4b39357ea24 ### TDS 2014示波器使用手册知识点总结 #### 一、TDS 1000B 和 TDS 2000B 系列数字存储示波器概述 - **产品系列**: TDS 1000B 和 TDS 2000B 是由 Tektronix 公司所研发并推出的数字存储示波器产品线。 - **功能定位**: 主要致力于为电子工程师以及研发人员提供具备高性能与高精度的信号测量设备。 - **应用领域**: 此类设备被普遍应用于教育机构、研发实验室以及工业生产过程中的测试环节。 #### 二、TDS 2014示波器基本操作与使用 - **开机与基本设置**: - 在启动设备时,必须确保仪器已经正确接地。 - 在使用之前,需要根据观察需求设定合适的屏幕亮度、对比度等显示参数。 - **通道选择与配置**: - 可以通过触摸显示屏或设备前面板上的按钮来选定需要进行的测量通道。 - 可依据实际需求来调整垂直灵敏度、水平时间基准等设置项。 - **触发设置**: - 触发模式包括自动、常态、单次等多种选择。 - 触发源与阈值设定涉及确定触发信号的具体来源及其电压阈值水平。 - **测量与分析功能**: - 提供多种自动测量功能选项,涵盖电压峰峰值、频率等参数的测量。 - 支持对波形进行数学运算,例如执行两个波形的相加或相减操作。 #### 三、TDS 2014示波器高级特性 - **波形捕获率**: - 波形捕获率越高,意味着在检测偶发事件方面的能力越强。 - **波形存储与回放**: - 支持将波形数据存储到内部存储单元或外部存储设备中。 - 用户能够随时调取先前保存的波形数据,以进行深入分析。 - *...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值