當前位置:首頁 » 編程軟體 » 編譯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")));
}
}

如果還是不行的話,再問吧!

熱點內容
榮耀9i安卓強行關機按哪個鍵 發布:2025-05-15 20:00:32 瀏覽:749
密碼鎖寫什麼最好 發布:2025-05-15 19:05:31 瀏覽:782
5的源碼是 發布:2025-05-15 19:04:07 瀏覽:719
c語言創建的源文件 發布:2025-05-15 18:54:08 瀏覽:611
3個數字密碼鎖有多少種 發布:2025-05-15 18:49:48 瀏覽:684
壓縮包手機打開 發布:2025-05-15 18:37:34 瀏覽:217
安卓取消耳機模式怎麼取消 發布:2025-05-15 18:24:24 瀏覽:59
氣球怎麼解壓視頻 發布:2025-05-15 18:20:00 瀏覽:783
電腦軟體密碼怎麼設置密碼 發布:2025-05-15 18:09:07 瀏覽:107
android應用是否運行 發布:2025-05-15 18:02:40 瀏覽:10