heading towards completion for low level rw polling task
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
@ -14,15 +14,16 @@ class RwCookie : public SpiCookie {
|
||||
friend class RwPollingTask;
|
||||
|
||||
public:
|
||||
static constexpr size_t REPLY_BUF_LEN = 524;
|
||||
RwCookie(uint8_t rwIdx, address_t spiAddress, gpioId_t chipSelect, const size_t maxSize,
|
||||
spi::SpiModes spiMode, uint32_t spiSpeed)
|
||||
: SpiCookie(spiAddress, chipSelect, maxSize, spiMode, spiSpeed), rwIdx(rwIdx) {}
|
||||
|
||||
private:
|
||||
std::array<uint8_t, 524> replyBuf{};
|
||||
std::array<uint8_t, REPLY_BUF_LEN> replyBuf{};
|
||||
int32_t currentRwSpeed = 0;
|
||||
uint16_t currentRampTime = 0;
|
||||
rws::SpecialRwRequest specialRequest = rws::SpecialRwRequest::NONE;
|
||||
rws::SpecialRwRequest specialRequest = rws::SpecialRwRequest::REQUEST_NONE;
|
||||
uint8_t rwIdx;
|
||||
};
|
||||
|
||||
@ -39,24 +40,26 @@ class RwPollingTask : public SystemObject, public ExecutableObjectIF, public Dev
|
||||
bool debugMode = false;
|
||||
bool modeAndSpeedWasSet = false;
|
||||
MutexIF* ipcLock;
|
||||
MutexIF* spiLock;
|
||||
const char* spiDev;
|
||||
SpiComIF* spiIF;
|
||||
std::array<RwCookie*, 4> rwCookies;
|
||||
std::array<uint8_t, rws::MAX_CMD_SIZE> writeBuffer;
|
||||
std::array<uint8_t, rws::MAX_CMD_SIZE * 2> encodedBuffer;
|
||||
|
||||
size_t writeLen = 0;
|
||||
std::array<uint8_t, 256> processingBuf;
|
||||
//! This is the end and start marker of the frame datalinklayer
|
||||
static constexpr uint8_t FLAG_BYTE = 0x7E;
|
||||
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
|
||||
static constexpr uint32_t TIMEOUT_MS = 20;
|
||||
static constexpr uint8_t MAX_RETRIES_REPLY = 5;
|
||||
|
||||
ReturnValue_t writeAndReadAllRws(const uint8_t* sendData, size_t sendDataLen);
|
||||
ReturnValue_t writeOneRw(uint8_t rwIdx);
|
||||
ReturnValue_t readAllRws(int fd, MutexIF* spiLock, const char* dev);
|
||||
ReturnValue_t sendOneMessage(int fd, RwCookie& rwCookie, MutexIF* spiLock, const uint8_t* data,
|
||||
size_t dataLen);
|
||||
ReturnValue_t readNextReply(const char* spiDev, RwCookie& rwCookie, MutexIF* spiLock,
|
||||
uint8_t* replyBuf);
|
||||
ReturnValue_t writeAndReadAllRws(DeviceCommandId_t id);
|
||||
ReturnValue_t writeOneRwCmd(uint8_t rwIdx, int fd);
|
||||
ReturnValue_t readAllRws(int fd, DeviceCommandId_t id);
|
||||
|
||||
ReturnValue_t sendOneMessage(int fd, RwCookie& rwCookie);
|
||||
ReturnValue_t readNextReply(RwCookie& rwCookie, uint8_t* replyBuf, size_t maxReplyLen);
|
||||
ReturnValue_t initializeInterface(CookieIF* cookie) override;
|
||||
|
||||
ReturnValue_t sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) override;
|
||||
@ -66,11 +69,14 @@ class RwPollingTask : public SystemObject, public ExecutableObjectIF, public Dev
|
||||
ReturnValue_t requestReceiveMessage(CookieIF* cookie, size_t requestLen) override;
|
||||
|
||||
ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override;
|
||||
ReturnValue_t openSpi(const std::string& devname, int flags, int& fd);
|
||||
ReturnValue_t openSpi(int flags, int& fd);
|
||||
ReturnValue_t pullCsLow(gpioId_t gpioId, MutexIF* spiLock, GpioIF& gpioIF);
|
||||
void prepareSimpleCommand(DeviceCommandId_t id);
|
||||
ReturnValue_t prepareSetSpeedCmd(uint8_t rwIdx);
|
||||
|
||||
size_t idAndIdxToReadBuffer(DeviceCommandId_t id, uint8_t rwIdx, uint8_t** readPtr);
|
||||
void encodeHdlc(const uint8_t* sourceBuf, size_t sourceLen, size_t& encodedLen);
|
||||
|
||||
void pullCsHigh(gpioId_t gpioId, MutexIF* spiLock, GpioIF& gpioIF);
|
||||
void closeSpi(int);
|
||||
};
|
||||
|
Reference in New Issue
Block a user