aiwen

aiwen

0个粉丝

8

问答

0

专栏

0

资料

aiwen  发布于  2012-12-05 11:03:08
采纳率 0%
8个问答
2562

AT91SAM9263下扩展串口的方法wince(转载)

 
EP9315内部串口驱动结构: EP9315内部串口采用分层的驱动结构。对内核层的接口函数,在 E:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SERIAL文件夹中的Mdd.c文件中。他的目的是建立驱动的结构, COM_Init COM_Deinit COM_Open COM_Close COM_Read COM_Write COM_Seek COM_PowerDown COM_PowerUp COM_IOControl 其中还有中断的处理进程。然后一层是最底层的硬件操作层 COM层函数通过一个结构体调用这一层函数。在E:\WINCE500\PLATFORM\Eac0921\Src\Drivers\Serial文件夹中的p1010com.c文件定义。 Const HW_VTBL IoVTbl = { SerInit, SL_PostInit, SerDeinit, SerOpen, SerClose, SL_GetInterruptType, SL_RxIntr, SL_TxIntrEx, SL_ModemIntr, SL_LineIntr, SL_GetRxBufferSize, SerPowerOff, SerPowerOn, SL_ClearDTR, SL_SetDTR, SL_ClearRTS, SL_SetRTS, SerEnableIR, SerDisableIR, SL_ClearBreak, SL_SetBreak, SL_XmitComChar, SL_GetStatus, SL_Reset, SL_GetModemStatus, SerGetCommProperties, SL_PurgeComm, SL_SetDCB, SL_SetCommTimeouts, }; 调用方法如下: PHWOBJ GetSerialObject(DWORD DeviceArrayIndex) { PHWOBJ pSerObj; // Unlike many other serial samples, we do not have a statically allocated // array of HWObjs. Instead, we allocate a new HWObj for each instance // of the driver. The MDD will always call GetSerialObj/HWInit/HWDeinit in // that order, so we can do the alloc here and do any subsequent free in // HWDeInit. // Allocate space for the HWOBJ. pSerObj = (PHWOBJ)LocalAlloc( LMEM_ZEROINITLMEM_FIXED ,sizeof(HWOBJ) ); if ( !pSerObj ) return (NULL); // Fill in the HWObj structure that we just allocated. pSerObj->BindFlags = THREAD_AT_OPEN; // Have MDD create thread when device is first opened. pSerObj->dwIntID = 0; // SysIntr is filled in at init time pSerObj->pFuncTbl = (HW_VTBL *) &IoVTbl; // Return pointer to appropriate functions // Now return this structure to the MDD. return (pSerObj); } 其中的SL开头的函数都是在p1010ser.c文件中定义。 EP9315外扩串口的驱动结构。 EP9315外部串口也采用分层的驱动结构。不同的是EP9315外扩串口将所有的代码都在 E:\WINCE500\PLATFORM\Eac0921\Src\Drivers\Ext_uart文件夹中。其驱动结构如下:对内核层的接口函数,在Mdd.c文件中。 COM_Init COM_Deinit COM_Open COM_Close COM_Read COM_Write COM_Seek COM_PowerDown COM_PowerUp COM_IOControl 其中还有中断的处理进程。然后一层是最底层的硬件操作层 COM层函数通过一个结构体调用这一层函数。在CCSer_pdd.c文件中。 Const HW_VTBL SerIoVTbl= { CCSerInit, SL_PostInit, CCSerDeinit, CCSerOpen, CCSerClose, SL_GetInterruptType, SL_RxIntr, SL_TxIntrEx, SL_ModemIntr, SL_LineIntr, SL_GetRxBufferSize, CCSerPowerOff, CCSerPowerOn, SL_ClearDTR, SL_SetDTR, SL_ClearRTS, SL_SetRTS, CCSerEnableIR, CCSerDisableIR, SL_ClearBreak, SL_SetBreak, SL_XmitComChar, SL_GetStatus, SL_Reset, SL_GetModemStatus, CCSerGetCommProperties, SL_PurgeComm, SL_SetDCB, SL_SetCommTimeouts, SL_Ioctl }; 调用方法如下: //HWOBJ for EXT_UART1 product serial HWOBJ SerObj4 = { THREAD_AT_OPEN, 0, (PHW_VTBL) &SerIoVTbl }; //HWOBJ for EXT_UART2 product serial HWOBJ SerObj5 = { THREAD_AT_OPEN, 0, (PHW_VTBL) &SerIoVTbl }; //HWOBJ for EXT_UART3 product serial HWOBJ SerObj6 = { THREAD_AT_OPEN, 0, (PHW_VTBL) &SerIoVTbl }; //HWOBJ for EXT_UART4 product serial HWOBJ SerObj7 = { THREAD_AT_OPEN, 0, (PHW_VTBL) &SerIoVTbl }; 其中的SL开头的函数都是在Ser16550.c文件中定义。 扩展串口驱动从EP9315移植到AT92SAM9263下: 1、直接将驱动代码文件夹Ext_uart拷贝到AT92SAM9263的driver下。 2、修改Ext_uart文件夹中的sources文件 !if 0 Copyright (c) Microsoft Corporation. All rights reserved. !endif !if 0 Use of this source code is subject to the terms of the Microsoft end-user license agreement (EULA) under which you licensed this SOFTWARE PRODUCT. If you did not accept the terms of the EULA, you are not authorized to use this source code. For a copy of the EULA, please see the LICENSE.RTF on your install media. !endif !IF ("$(BSP_NOEXTSERIAL)" == "1") && ("$(BSP_BIN)" != "1") SKIPBUILD=1 !ENDIF RELEASETYPE=PLATFORM TARGETNAME=at91sam9263ek_extserial TARGETTYPE=DYNLINK TARGETLIBS= \ $(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\coredll.lib \ $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\ceddk.lib \ SOURCELIBS= \ $(_PLATCOMMONLIB)\$(_CPUDEPPATH)\at91sam926x_serial.lib \ SOURCES= \ mdd.c \ ccser_pdd.c \ ser16550.c DLLENTRY=DllMain DEFFILE=at91sam9263ek_extserial.def FILE_VIEW_RESOURCE_FOLDER= \ at91sam9263ek_extserial.def \ at91sam9263ek_serial_extusart.reg \ FILE_VIEW_INCLUDES_FOLDER= \ serial.h \ WINCETARGETFILES= \ $(WINCETARGETFILES) \ CopyFilesToSDK \ SDK_H_FILES= SDK_LIB_FILES= 3、建立一注册表文件,名为at91sam9263ek_serial_extusart.reg 4、修改注册表文件内容。 [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial_4] "SysIntr"=dword:2b ; "Irq"=dword:3 "MemBase"=dword:10000070 "MemLen"=dword:8 "Index"=dword:3 "DeviceArrayIndex"=dword:4 "Prefix"="COM" "Dll"="ext_uart.dll" "Order"=dword:0 ; "Priority256"=dword:fa ; "IsrDll"="isr16550.dll" ; "IsrHandler"="ISRHandler" "FriendlyName"="Serial Cable on COM4:" [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial_5] "SysIntr"=dword:2c ; "Irq"=dword:3 "MemBase"=dword:10000068 "MemLen"=dword:8 "Index"=dword:4 "DeviceArrayIndex"=dword:5 "Prefix"="COM" "Dll"="ext_uart.dll" "Order"=dword:0 ; "Priority256"=dword:fa ; "IsrDll"="isr16550.dll" ; "IsrHandler"="ISRHandler" "FriendlyName"="Serial Cable on COM5:" [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial_6] "SysIntr"=dword:2d ; "Irq"=dword:3 "MemBase"=dword:10000058 "MemLen"=dword:8 "Index"=dword:5 "DeviceArrayIndex"=dword:6 "Prefix"="COM" "Dll"="ext_uart.dll" "Order"=dword:0 ; "Priority256"=dword:fa ; "IsrDll"="isr16550.dll" ; "IsrHandler"="ISRHandler" "FriendlyName"="Serial Cable on COM6:" [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial_7] "SysIntr"=dword:2e ; "Irq"=dword:3 "MemBase"=dword:10000038 "MemLen"=dword:8 "Index"=dword:6 "DeviceArrayIndex"=dword:7 "Prefix"="COM" "Dll"="ext_uart.dll" "Order"=dword:0 ; "Priority256"=dword:fa ; "IsrDll"="isr16550.dll" ; "IsrHandler"="ISRHandler" "FriendlyName"="Serial Cable on COM7:" 5、将Ext_uart文件夹下mdd.def文件名改为at91sam9263ek_extserial.def 6、在别的驱动文件夹下拷贝文件 makefile.inc文件到Ext_uart文件夹下 7、修改BSP包的CEC文件,添加一扩展串口项 AT91SAM9263 EXTSERIAL BSP_ AT91SAM9263_EXTSERIAL BSP_NOEXTSERIAL 8、在PB中加入扩展串口的BSP包,编译,调试。
我来回答
回答0个
时间排序
认可量排序
易百纳技术社区暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
相关问答
无更多相似问答 去提问
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区