当前位置:首页 » 编程软件 » 编译xdma

编译xdma

发布时间: 2022-10-31 14:16:12

㈠ WINCE 6.0 SPI驱动如何工作起来

给你一些意见,我自己总结的,不知道对不对!
1,如何编译出spi.dll文件
BSP默认是不生成spi.dll文件的,可以通过设置smdk210.bat文件中的BSP_NOSPI=1设置为BSP_NOSPI=即可,因为
在source文件中添加了!if "$(BSP_NOSPI)" == "1" SKIPBUILD=1 !endif 选项
2,spi_INIT失败 Error KernelIoControl问题
找到原因是isri.dwIrq的值 为-1
解决办法:在DDKReg_GetIsrInfo的定义中看到
// If no IRQ value is specified in the registry, dwIrq will be set to IRQ_UNSPECIFIED.
// If no SYSINTR value is specified in the registry, dwSysintr will be set to SYSINTR_NOP.
这里需要设置注册表项WRITE_REG_DWORD(DrvKey,L"Irq", DriverIRQ); DriverIRQ为spi的物理中断号
不需要设置Sysintr,一般采用动态申请的方式。
还要设置WRITE_REG_DWORD(DrvKey,L"DeviceArrayIndex", DriverDeviceArrayIndex);这个是什么我也不知道
3,对spi的初始化
static void InitSpiConfig(BOOL mode)
{
if (mode)//master
{
spiConfig.dwMode = SPI_MASTER_MODE;
}
else//slave
{
spiConfig.dwMode = SPI_SLAVE_MODE;
}
/*receive & send use interrupt mode, not use DMA mode*/
spiConfig.bUseRxDMA = FALSE;
spiConfig.bUseRxIntr = TRUE;
spiConfig.bUseTxDMA = FALSE;
spiConfig.bUseTxIntr = TRUE;
spiConfig.dwLineStrength = 0;
spiConfig.dwFBClkSel = 0;
spiConfig.Format = SPI_FORMAT_1;
/*setting SPI's pre-fre and time-out value*/

spiConfig.dwTimeOutVal = 0;
spiConfig.dwPrescaler = 120;
if( DeviceIoControl(hdDevice, SPI_IOCTL_SET_CONFIG, &spiConfig, sizeof(spiConfig), NULL, NULL, NULL, NULL)!=TRUE )
{
RETAILMSG(1, (TEXT("[SPI1] SPI_IOCTL_SET_CONFIG fail\r\n")));
}

if( DeviceIoControl(hdDevice, SPI_IOCTL_START, NULL, NULL, NULL, NULL, NULL, NULL)!=TRUE )
{
RETAILMSG(1, (TEXT("[SPI1] SPI_IOCTL_START fail\r\n")));
}
}

如果还是不行的话,再问吧!

热点内容
安卓市场手机版从哪里下载 发布:2025-05-15 20:17:28 浏览:813
幼儿速算法 发布:2025-05-15 20:15:08 浏览:86
best把枪密码多少 发布:2025-05-15 20:13:42 浏览:547
android安装程序 发布:2025-05-15 20:13:20 浏览:559
c语言跳出死循环 发布:2025-05-15 20:06:04 浏览:824
a19处理器相当于安卓哪个水平 发布:2025-05-15 20:05:29 浏览:639
荣耀9i安卓强行关机按哪个键 发布:2025-05-15 20:00:32 浏览:750
密码锁写什么最好 发布:2025-05-15 19:05:31 浏览:782
5的源码是 发布:2025-05-15 19:04:07 浏览:719
c语言创建的源文件 发布:2025-05-15 18:54:08 浏览:611