Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/block/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inline whal_Error whal_Block_Deinit(whal_Block *blockDev)
}

inline whal_Error whal_Block_Read(whal_Block *blockDev, uint32_t block,
uint8_t *data, uint32_t blockCount)
void *data, uint32_t blockCount)
{
if (!blockDev || !blockDev->driver || !blockDev->driver->Read || !data) {
return WHAL_EINVAL;
Expand All @@ -31,7 +31,7 @@ inline whal_Error whal_Block_Read(whal_Block *blockDev, uint32_t block,
}

inline whal_Error whal_Block_Write(whal_Block *blockDev, uint32_t block,
const uint8_t *data, uint32_t blockCount)
const void *data, uint32_t blockCount)
{
if (!blockDev || !blockDev->driver || !blockDev->driver->Write || !data) {
return WHAL_EINVAL;
Expand Down
10 changes: 6 additions & 4 deletions src/block/sdhc_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,9 @@ whal_Error whal_SdhcSpi_Deinit(whal_Block *blockDev)
}

whal_Error whal_SdhcSpi_Read(whal_Block *blockDev, uint32_t block,
uint8_t *data, uint32_t blockCount)
void *data, uint32_t blockCount)
{
uint8_t *dataBuf = (uint8_t *)data;
whal_SdhcSpi_Cfg *cfg;
whal_Error err;
uint8_t r1;
Expand Down Expand Up @@ -309,7 +310,7 @@ whal_Error whal_SdhcSpi_Read(whal_Block *blockDev, uint32_t block,
}

err = whal_Spi_SendRecv(cfg->spiDev, NULL, 0,
data + (i * WHAL_SDHC_SPI_BLOCK_SZ),
dataBuf + (i * WHAL_SDHC_SPI_BLOCK_SZ),
WHAL_SDHC_SPI_BLOCK_SZ);
if (err)
break;
Expand All @@ -334,8 +335,9 @@ whal_Error whal_SdhcSpi_Read(whal_Block *blockDev, uint32_t block,
}

whal_Error whal_SdhcSpi_Write(whal_Block *blockDev, uint32_t block,
const uint8_t *data, uint32_t blockCount)
const void *data, uint32_t blockCount)
{
const uint8_t *dataBuf = (const uint8_t *)data;
whal_SdhcSpi_Cfg *cfg;
whal_Error err;
uint8_t r1;
Expand Down Expand Up @@ -379,7 +381,7 @@ whal_Error whal_SdhcSpi_Write(whal_Block *blockDev, uint32_t block,
if (err)
break;
err = whal_Spi_SendRecv(cfg->spiDev,
data + (i * WHAL_SDHC_SPI_BLOCK_SZ),
dataBuf + (i * WHAL_SDHC_SPI_BLOCK_SZ),
WHAL_SDHC_SPI_BLOCK_SZ, NULL, 0);
if (err)
break;
Expand Down
4 changes: 2 additions & 2 deletions src/eth/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ whal_Error whal_Eth_Stop(whal_Eth *ethDev)
return ethDev->driver->Stop(ethDev);
}

whal_Error whal_Eth_Send(whal_Eth *ethDev, const uint8_t *frame,
whal_Error whal_Eth_Send(whal_Eth *ethDev, const void *frame,
size_t len)
{
if (!ethDev || !ethDev->driver || !ethDev->driver->Send || !frame)
return WHAL_EINVAL;
return ethDev->driver->Send(ethDev, frame, len);
}

whal_Error whal_Eth_Recv(whal_Eth *ethDev, uint8_t *frame, size_t *len)
whal_Error whal_Eth_Recv(whal_Eth *ethDev, void *frame, size_t *len)
{
if (!ethDev || !ethDev->driver || !ethDev->driver->Recv || !frame || !len)
return WHAL_EINVAL;
Expand Down
10 changes: 6 additions & 4 deletions src/eth/stm32h5_eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,10 @@ whal_Error whal_Stm32h5Eth_Stop(whal_Eth *ethDev)
return WHAL_SUCCESS;
}

whal_Error whal_Stm32h5Eth_Send(whal_Eth *ethDev, const uint8_t *frame,
whal_Error whal_Stm32h5Eth_Send(whal_Eth *ethDev, const void *frame,
size_t len)
{
const uint8_t *frameBuf = (const uint8_t *)frame;
whal_Stm32h5Eth_Cfg *cfg;
whal_Stm32h5Eth_TxDesc *desc;
size_t base;
Expand All @@ -318,7 +319,7 @@ whal_Error whal_Stm32h5Eth_Send(whal_Eth *ethDev, const uint8_t *frame,
/* Copy frame into TX buffer */
uint8_t *txBuf = cfg->txBufs + idx * cfg->txBufSize;
for (size_t i = 0; i < len; i++)
txBuf[i] = frame[i];
txBuf[i] = frameBuf[i];

/* Set up descriptor */
desc->des[0] = (uintptr_t)txBuf;
Expand All @@ -336,9 +337,10 @@ whal_Error whal_Stm32h5Eth_Send(whal_Eth *ethDev, const uint8_t *frame,
return WHAL_SUCCESS;
}

whal_Error whal_Stm32h5Eth_Recv(whal_Eth *ethDev, uint8_t *frame,
whal_Error whal_Stm32h5Eth_Recv(whal_Eth *ethDev, void *frame,
size_t *len)
{
uint8_t *frameBuf = (uint8_t *)frame;
whal_Stm32h5Eth_Cfg *cfg;
whal_Stm32h5Eth_RxDesc *desc;
size_t base;
Expand Down Expand Up @@ -378,7 +380,7 @@ whal_Error whal_Stm32h5Eth_Recv(whal_Eth *ethDev, uint8_t *frame,
/* Copy frame data */
uint8_t *rxBuf = (uint8_t *)(cfg->rxBufs + idx * cfg->rxBufSize);
for (size_t i = 0; i < pktLen; i++)
frame[i] = rxBuf[i];
frameBuf[i] = rxBuf[i];
*len = pktLen;

/* Re-arm descriptor for DMA */
Expand Down
4 changes: 2 additions & 2 deletions src/flash/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ inline whal_Error whal_Flash_Unlock(whal_Flash *flashDev, size_t addr, size_t le
return flashDev->driver->Unlock(flashDev, addr, len);
}

inline whal_Error whal_Flash_Read(whal_Flash *flashDev, size_t addr, uint8_t *data,
inline whal_Error whal_Flash_Read(whal_Flash *flashDev, size_t addr, void *data,
size_t dataSz)
{
if (!flashDev || !flashDev->driver || !flashDev->driver->Read || !data) {
Expand All @@ -48,7 +48,7 @@ inline whal_Error whal_Flash_Read(whal_Flash *flashDev, size_t addr, uint8_t *da
return flashDev->driver->Read(flashDev, addr, data, dataSz);
}

inline whal_Error whal_Flash_Write(whal_Flash *flashDev, size_t addr, const uint8_t *data,
inline whal_Error whal_Flash_Write(whal_Flash *flashDev, size_t addr, const void *data,
size_t dataSz)
{
if (!flashDev || !flashDev->driver || !flashDev->driver->Write || !data) {
Expand Down
10 changes: 6 additions & 4 deletions src/flash/pic32cz_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,10 @@ whal_Error whal_Pic32czFlash_Unlock(whal_Flash *flashDev, size_t addr, size_t le
return WHAL_SUCCESS;
}

whal_Error whal_Pic32czFlash_Read(whal_Flash *flashDev, size_t addr, uint8_t *data,
whal_Error whal_Pic32czFlash_Read(whal_Flash *flashDev, size_t addr, void *data,
size_t dataSz)
{
uint8_t *dataBuf = (uint8_t *)data;
const whal_Regmap *reg;
whal_Pic32czFlash_Cfg *cfg;
uint8_t *flashAddr = (uint8_t *)addr;
Expand All @@ -265,17 +266,18 @@ whal_Error whal_Pic32czFlash_Read(whal_Flash *flashDev, size_t addr, uint8_t *da

/* Flash is memory-mapped; read directly */
for (i = 0; i < dataSz; i++) {
data[i] = flashAddr[i];
dataBuf[i] = flashAddr[i];
}

whal_Pic32czFlash_MutexUnlock(reg);

return WHAL_SUCCESS;
}

whal_Error whal_Pic32czFlash_Write(whal_Flash *flashDev, size_t addr, const uint8_t *data,
whal_Error whal_Pic32czFlash_Write(whal_Flash *flashDev, size_t addr, const void *data,
size_t dataSz)
{
const uint8_t *dataBuf = (const uint8_t *)data;
const whal_Regmap *reg;
whal_Pic32czFlash_Cfg *cfg;
const uint32_t *src;
Expand All @@ -294,7 +296,7 @@ whal_Error whal_Pic32czFlash_Write(whal_Flash *flashDev, size_t addr, const uint
}

reg = &flashDev->regmap;
src = (const uint32_t *)data;
src = (const uint32_t *)dataBuf;


err = whal_Pic32czFlash_MutexLock(reg, cfg->timeout);
Expand Down
Loading
Loading