flash read request

This commit is contained in:
Jakob Meier
2021-12-22 16:06:30 +01:00
parent 8a104c4af2
commit 1331c9e7e9
6 changed files with 221 additions and 38 deletions

View File

@ -103,10 +103,21 @@ public:
*
* @param flashWriteFile_ Full name including absolute path of file to write to flash
* @param region Region ID of flash region to write to
* @param flashWriteAddress Start address of flash write procedure
* @param address Start address of flash write procedure
*/
ReturnValue_t startFlashWrite(std::string flashWriteFile_, uint8_t region,
uint32_t flashWriteAddress);
uint32_t address);
/**
* @brief Starts the flash read procedure
*
* @param flashWriteFile_ Full name including absolute path of file to write to flash
* @param region Region ID of flash region to read from
* @param flashWriteAddress Start address of flash section to read
* @param length Number of bytes to read from flash
*/
ReturnValue_t startFlashRead(std::string flashReadFile_, uint8_t region,
uint32_t address, uint16_t length);
/**
* @brief Can be used to interrupt a running data transfer.
@ -118,6 +129,11 @@ public:
*/
void setDownloadImageName(std::string image);
/**
* @brief Sets the name of the file which will be created to store the data read from flash
*/
void setFlashReadFilename(std::string filename);
private:
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HELPER;
@ -145,7 +161,8 @@ private:
static const uint32_t MAX_POLLS = 10000;
static const uint8_t POS_OFFSET = 2;
static const uint8_t DATA_OFFSET = 5;
static const uint8_t IMAGE_DATA_OFFSET = 5;
static const uint8_t FLASH_READ_DATA_OFFSET = 8;
static const uint8_t REGION_OFFSET = 2;
static const uint8_t ADDRESS_OFFSET = 3;
static const uint8_t LENGTH_OFFSET = 7;
@ -232,6 +249,12 @@ private:
*/
ReturnValue_t performFlashWrite();
/**
* @brief Sends a sequence of commands to the star tracker to read larger parts from the
* flash memory.
*/
ReturnValue_t performFlashRead();
/**
* @brief Sends packet to the star tracker and reads reply by using the communication
* interface
@ -260,12 +283,12 @@ private:
ReturnValue_t checkReplyPosition(uint32_t expectedPosition);
/**
* @brief Checks the region, address and length value of a flash write reply.
* @brief Checks the region, address and length value of a flash write or read reply.
*
* @return RETURN_OK if values match expected values, otherwise appropriate error return
* value.
*/
ReturnValue_t checkFlashWriteReply(struct WriteActionRequest& req);
ReturnValue_t checkFlashActionReply(uint8_t region_, uint32_t address_, uint16_t length_);
/**
* @brief Checks if a path points to an sd card and whether the SD card is monuted.