浏览代码

Merge pull request #17 from tsandmann/bugfixes/dma_alignment

check alignment for DMA buffers
main
Paul Stoffregen 5 年前
父节点
当前提交
0fe064fab9
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. +8
    -0
      utility/NXP_SDHC.cpp

+ 8
- 0
utility/NXP_SDHC.cpp 查看文件

@@ -581,6 +581,10 @@ int SDHC_CardReadBlock(void * buff, uint32_t sector)
{
int result=0;
uint32_t* pData = (uint32_t*)buff;
/* check alignment for DMA */
if (reinterpret_cast<uintptr_t>(static_cast<const void*>(buff)) % 4) {
return -1;
}
// Serial.print("Sector: "); Serial.println(sector); Serial.flush();
// Check if this is ready
if (sdCardDesc.status != 0) return SDHC_RESULT_NOT_READY;
@@ -640,6 +644,10 @@ int SDHC_CardWriteBlock(const void * buff, uint32_t sector)
{
int result=0;
const uint32_t *pData = (const uint32_t *)buff;
/* check alignment for DMA */
if (reinterpret_cast<uintptr_t>(static_cast<const void*>(buff)) % 4) {
return -1;
}

// Check if this is ready
if (sdCardDesc.status != 0) return SDHC_RESULT_NOT_READY;

正在加载...
取消
保存