removed some changes which belong in separate PR

This commit is contained in:
Robin Müller 2022-05-18 13:19:43 +02:00
parent 18b342e94b
commit 7b3de87364
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 8 additions and 51 deletions

View File

@ -205,5 +205,3 @@ ReturnValue_t CommandExecutor::executeBlocking() {
}
return HasReturnvaluesIF::RETURN_OK;
}
const std::vector<char>& CommandExecutor::getReadVector() const { return readVec; }

View File

@ -401,33 +401,12 @@ void SpiComIF::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed)
if (retval != 0) {
utility::handleIoctlError("SpiComIF::setSpiSpeedAndMode: Setting SPI speed failed");
}
}
void SpiComIF::getSpiSpeedAndMode(int spiFd, spi::SpiModes& mode, uint32_t& speed) const {
uint8_t tmpMode = 0;
int retval = ioctl(spiFd, SPI_IOC_RD_MODE, &tmpMode);
if (retval != 0) {
utility::handleIoctlError("SpiComIF::getSpiSpeedAndMode: Reading SPI mode failed");
}
mode = static_cast<spi::SpiModes>(tmpMode);
retval = ioctl(spiFd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
if (retval != 0) {
utility::handleIoctlError("SpiComIF::getSpiSpeedAndMode: Getting SPI speed failed");
}
}
const std::string& SpiComIF::getSpiDev() const { return dev; }
void SpiComIF::updateLinePolarity(int spiFd) {
// This updates the SPI clock default polarity. Only setting the mode does not update
// the line state, which can be an issue on mode switches because the clock line will
// switch the state after the chip select is pulled low
clockUpdateTransfer.len = 0;
retval = ioctl(spiFd, SPI_IOC_MESSAGE(1), &clockUpdateTransfer);
if (retval != 0) {
utility::handleIoctlError("SpiComIF::setSpiSpeedAndMode: Updating SPI default clock failed");
}
}
void SpiComIF::setMutexParams(MutexIF::TimeoutType timeoutType_, uint32_t timeoutMs_) {
timeoutType = timeoutType_;
timeoutMs = timeoutMs_;
}

View File

@ -22,17 +22,15 @@ class SpiCookie;
*/
class SpiComIF : public DeviceCommunicationIF, public SystemObject {
public:
static constexpr dur_millis_t DEFAULT_MUTEX_TIMEOUT = 20;
static constexpr uint8_t CLASS_ID = CLASS_ID::HAL_SPI;
static constexpr uint8_t spiRetvalId = CLASS_ID::HAL_SPI;
static constexpr ReturnValue_t OPENING_FILE_FAILED =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 0);
HasReturnvaluesIF::makeReturnCode(spiRetvalId, 0);
/* Full duplex (ioctl) transfer failure */
static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 1);
HasReturnvaluesIF::makeReturnCode(spiRetvalId, 1);
/* Half duplex (read/write) transfer failure */
static constexpr ReturnValue_t HALF_DUPLEX_TRANSFER_FAILED =
HasReturnvaluesIF::makeReturnCode(CLASS_ID, 2);
HasReturnvaluesIF::makeReturnCode(spiRetvalId, 2);
SpiComIF(object_id_t objectId, GpioIF* gpioComIF);
@ -47,7 +45,6 @@ class SpiComIF : public DeviceCommunicationIF, public SystemObject {
* the chip select must be driven from outside of the com if.
*/
MutexIF* getMutex(MutexIF::TimeoutType* timeoutType = nullptr, uint32_t* timeoutMs = nullptr);
void setMutexParams(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs);
/**
* Perform a regular send operation using Linux iotcl. This is public so it can be used
@ -62,23 +59,6 @@ class SpiComIF : public DeviceCommunicationIF, public SystemObject {
GpioIF* getGpioInterface();
void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed);
<<<<<<< Updated upstream
=======
void getSpiSpeedAndMode(int spiFd, spi::SpiModes& mode, uint32_t& speed) const;
/**
* This updates the SPI clock default polarity. Only setting the mode does not update
* the line state, which can be an issue on mode switches because the clock line will
* switch the state after the chip select is pulled low.
*
* It is recommended to call this function after #setSpiSpeedAndMode and after locking the
* CS mutex if the SPI bus has multiple SPI devices with different speed and SPI modes attached.
* @param spiFd
*/
void updateLinePolarity(int spiFd);
const std::string& getSpiDev() const;
>>>>>>> Stashed changes
void performSpiWiretapping(SpiCookie* spiCookie);
ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer);
@ -93,7 +73,7 @@ class SpiComIF : public DeviceCommunicationIF, public SystemObject {
MutexIF* spiMutex = nullptr;
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = DEFAULT_MUTEX_TIMEOUT;
uint32_t timeoutMs = 20;
spi_ioc_transfer clockUpdateTransfer = {};
using SpiDeviceMap = std::unordered_map<address_t, SpiInstance>;