flipperzero-firmware/applications/external/avr_isp_programmer/helpers/flipper_i32hex_file.h
Skorpionm d1ad924216
[AVR_ISP]: add AVR ISP Programmer FAP (#2475)
* [AVR_ISP]: add AVR ISP Programmer FAP
* [AVR_ISP]: add auto detect AVR chip
* [AVR_ISP]: fix auto detect chip
* [AVR_ISP]: fix fast write flash
* AVR_ISP: auto set SPI speed
* AVR_ISP: add clock 4Mhz on &gpio_ext_pa4
* AVR_ISP: fix "[CRASH][ISR 4] NULL pointer dereference" with no AVR chip connected
* AVR_ISP: add AVR ISP Reader
* AVR_ISP: add read and check I32HEX file
* AVR_ISP: add write eerom, flash, fuse, lock byte
* AVR_ISP: add gui Reader, Writer
* Github: unshallow on decontamination
* AVR_ISP: move to external
* API: fix api_symbols
* AVR_ISP: add wiring scene
* GUI: model mutex FuriMutexTypeNormal -> FuriMutexTypeRecursive
* AVR_ISP: add chip_detect view
* AVR_ISP: refactoring gui ISP Programmer
* AVR_ISP: add gui "Dump AVR"
* AVR_ISP: add gui "Flash AVR"
* AVR_ISP: fix navigation gui
* GUI: model mutex FuriMutexTypeRecursive -> FuriMutexTypeNormal
* AVR_ISP: fix conflicts
* AVR_ISP: fix build
* AVR_ISP: delete images
* AVR_ISP: add images
* AVR_ISP: fix gui
* AVR_ISP: fix stuck in navigation
* AVR_ISP:  changing the Fuse bit recording logic
* AVR_ISP: fix read/write chips with memory greater than 64Kb
* AVR_ISP: fix auto set speed SPI
* AVR_ISP: fix gui
* ISP: switching on +5 volts to an external GPIO

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-04-06 12:13:30 +08:00

55 lines
1.7 KiB
C

#pragma once
#include <furi_hal.h>
typedef struct FlipperI32HexFile FlipperI32HexFile;
typedef enum {
FlipperI32HexFileStatusOK = 0,
FlipperI32HexFileStatusData = 2,
FlipperI32HexFileStatusUdateAddr = 3,
FlipperI32HexFileStatusEofFile = 4,
FlipperI32HexFileStatusOpenFileWrite = 5,
FlipperI32HexFileStatusOpenFileRead = 6,
// Errors
FlipperI32HexFileStatusErrorCrc = (-1),
FlipperI32HexFileStatusErrorOverflow = (-2),
FlipperI32HexFileStatusErrorData = (-3),
FlipperI32HexFileStatusErrorUnsupportedCommand = (-4),
FlipperI32HexFileStatusErrorNoOpenFile = (-5),
FlipperI32HexFileStatusErrorFileWrite = (-6),
FlipperI32HexFileStatusErrorFileRead = (-7),
FlipperI32HexFileStatusReserved =
0x7FFFFFFF, ///< Prevents enum down-size compiler optimization.
} FlipperI32HexFileStatus;
typedef struct {
FlipperI32HexFileStatus status;
uint32_t data_size;
} FlipperI32HexFileRet;
FlipperI32HexFile* flipper_i32hex_file_open_write(const char* name, uint32_t start_addr);
FlipperI32HexFile* flipper_i32hex_file_open_read(const char* name);
void flipper_i32hex_file_close(FlipperI32HexFile* instance);
FlipperI32HexFileRet flipper_i32hex_file_bin_to_i32hex_set_data(
FlipperI32HexFile* instance,
uint8_t* data,
uint32_t data_size);
FlipperI32HexFileRet flipper_i32hex_file_bin_to_i32hex_set_end_line(FlipperI32HexFile* instance);
const char* flipper_i32hex_file_get_string(FlipperI32HexFile* instance);
void flipper_i32hex_file_bin_to_i32hex_set_addr(FlipperI32HexFile* instance, uint32_t addr);
bool flipper_i32hex_file_check(FlipperI32HexFile* instance);
FlipperI32HexFileRet flipper_i32hex_file_i32hex_to_bin_get_data(
FlipperI32HexFile* instance,
uint8_t* data,
uint32_t data_size);