AP_FlashIface: fix comments and correct ms to us in vars

This commit is contained in:
Siddharth Purohit 2021-06-14 23:22:38 +05:30 committed by Andrew Tridgell
parent bc65bfa3f3
commit be28a55364
4 changed files with 28 additions and 9 deletions

View File

@ -12,7 +12,9 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Code by Siddharth Bharat Purohit
* Code by
* Andy Piper
* Siddharth Bharat Purohit, Cubepilot Pty. Ltd.
*/
/*
Implements Common Flash Interface Driver based on

View File

@ -12,7 +12,9 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Code by Siddharth Bharat Purohit
* Code by
* Andy Piper
* Siddharth Bharat Purohit, Cubepilot Pty. Ltd.
*/
/*
Implements Common frontend methods for Flash Interface Driver
@ -69,7 +71,7 @@ public:
* @retval true if the operation succeeded.
*
*/
virtual bool start_program_page(uint32_t page, const uint8_t *data, uint32_t &delay_ms, uint32_t &timeout_ms) = 0;
virtual bool start_program_page(uint32_t page, const uint8_t *data, uint32_t &delay_us, uint32_t &timeout_us) = 0;
/**
* @details Tries to program as much as possible starting from the offset
@ -88,7 +90,7 @@ public:
*
*/
virtual bool start_program_offset(uint32_t offset, const uint8_t* data, uint32_t size, uint32_t &programming,
uint32_t &delay_ms, uint32_t &timeout_ms)
uint32_t &delay_us, uint32_t &timeout_us)
{
return false;
}

View File

@ -12,7 +12,9 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Code by Siddharth Bharat Purohit
* Code by
* Andy Piper
* Siddharth Bharat Purohit, Cubepilot Pty. Ltd.
*/
/*
Implements Common Flash Interface Driver based on following
@ -37,7 +39,7 @@ struct supported_device {
};
static const struct supported_device supported_devices[] = {
{"mt25q", 0x20, 0xBA},
{"mt25q", 0x20, 0xBA}, // https://www.mouser.in/datasheet/2/671/mict_s_a0003959700_1-2290909.pdf
{"w25q", 0xEF, 0x40}
};
@ -82,13 +84,24 @@ static const struct supported_device supported_devices[] = {
// quad enable for winbond
#define QUAD_ENABLE_B1R2 0x4
//#define DEBUG
#ifdef HAL_BOOTLOADER_BUILD
#ifdef DEBUG
#define Debug(fmt, args ...) do {uprintf("JEDEC: " fmt "\n", ## args);} while(0)
#else
#define Debug(fmt, args ...)
#endif
#define Msg_Print(fmt, args ...) do {uprintf("JEDEC: " fmt "\n", ## args);} while(0)
#else
#ifdef DEBUG
#define Debug(fmt, args ...) do {hal.console->printf("JEDEC: " fmt "\n", ## args);} while(0)
#define Msg_Print(fmt, args ...) do {hal.console->printf("JEDEC: " fmt "\n", ## args);} while(0)
#else
#define Debug(fmt, args ...)
#endif
#define Msg_Print(fmt, args ...) do {hal.console->printf("JEDEC: " fmt "\n", ## args);} while(0)
#endif // #ifdef HAL_BOOTLOADER_BUILD
#define MAX_READ_SIZE 1024UL
#ifdef HAL_BOOTLOADER_BUILD

View File

@ -12,7 +12,9 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Code by Siddharth Bharat Purohit
* Code by
* Andy Piper
* Siddharth Bharat Purohit, Cubepilot Pty. Ltd.
*/
/*
Implements Common Flash Interface Driver based on
@ -100,7 +102,7 @@ public:
// Erase Methods
/**
* @details Sends command to erase the entire chips.
* @details Sends command to erase the entire chip.
*
* @param[out] delay_ms Time to wait until next is_device_busy call
* @param[out] timeout_ms Time by which the erase should have timedout