Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Linux and cellular change only: Pi 3B+ warning removal and CodeChecke…
Browse files Browse the repository at this point in the history
…r fix. (#1059)

A cast is added to avoid a warning in the SPI porting code on Linux when compiling for a Pi 3B+ (which has 32-bit pointers).  While investigating the problem a CodeChecker fix was made in uCellPrivateFileListFirst().
  • Loading branch information
RobMeades authored Jan 4, 2024
1 parent 13e38ef commit c5fe29c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cell/src/u_cell_private.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ int32_t uCellPrivateFileListFirst(const uCellPrivateInstance_t *pInstance,
int32_t errorCode = (int32_t) U_ERROR_COMMON_INVALID_PARAMETER;
uAtClientHandle_t atHandle;
char *pFileNameTmp;
uCellPrivateFileListContainer_t *pFileContainer;
uCellPrivateFileListContainer_t *pFileContainer = NULL;
bool keepGoing = true;
int32_t bytesRead = 0;
size_t count = 0;
Expand Down
9 changes: 7 additions & 2 deletions port/platform/linux/src/u_port_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,13 @@ int32_t uPortSpiControllerSendReceiveBlock(int32_t handle, const char *pSend,
errorCodeOrReceiveSize = (int32_t)U_ERROR_COMMON_PLATFORM;
if (checkOpenDevice(handle)) {
struct spi_ioc_transfer transf = {0};
transf.tx_buf = (__u64)(pOutBuff ? pOutBuff : pSend);
transf.rx_buf = (__u64)(pInBuff ? pInBuff : pReceive);
// Note: these two pointers, in the spi_ioc_transfer struct,
// are just 64 bit unsigned integers, so some care is required
// in passing what has to be a pointer to a byte-wise buffer
// into them; specifically the uintptr_t is needed on 32-bit
// machines (e.g. Pi 3B+) to avoid a compiler warning
transf.tx_buf = (__u64)(uintptr_t)(pOutBuff ? pOutBuff : pSend);
transf.rx_buf = (__u64)(uintptr_t)(pInBuff ? pInBuff : pReceive);
transf.len = (unsigned int)len;
transf.speed_hz = (unsigned int)gSpiCfg[handle].devCfg.frequencyHertz;
transf.bits_per_word = (unsigned char)(gSpiCfg[handle].devCfg.wordSizeBytes * 8);
Expand Down

0 comments on commit c5fe29c

Please sign in to comment.