当前位置:首页 » 编程软件 » 编译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")));
}
}

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

热点内容
c编译时多态 发布:2025-07-17 05:56:00 浏览:845
软件服务器超时是什么意思 发布:2025-07-17 05:55:59 浏览:349
c语言期末试卷 发布:2025-07-17 05:49:58 浏览:404
64位access数据库 发布:2025-07-17 05:35:58 浏览:374
php文件的相对路径 发布:2025-07-17 05:34:22 浏览:711
矢量的叉乘运算法则 发布:2025-07-17 05:29:41 浏览:661
dell云存储服务器 发布:2025-07-17 05:21:06 浏览:255
铣床怎么编程 发布:2025-07-17 05:20:29 浏览:776
sql11oracle 发布:2025-07-17 05:15:39 浏览:744
全国各地移动dns服务器ip地址 发布:2025-07-17 05:07:47 浏览:312