flipperzero-firmware/applications/external/avr_isp_programmer/helpers/avr_isp.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

70 lines
1.6 KiB
C

#pragma once
#include <furi_hal.h>
typedef struct AvrIsp AvrIsp;
typedef void (*AvrIspCallback)(void* context);
struct AvrIspSignature {
uint8_t vendor;
uint8_t part_family;
uint8_t part_number;
};
typedef struct AvrIspSignature AvrIspSignature;
AvrIsp* avr_isp_alloc(void);
void avr_isp_free(AvrIsp* instance);
void avr_isp_set_tx_callback(AvrIsp* instance, AvrIspCallback callback, void* context);
bool avr_isp_auto_set_spi_speed_start_pmode(AvrIsp* instance);
AvrIspSignature avr_isp_read_signature(AvrIsp* instance);
void avr_isp_end_pmode(AvrIsp* instance);
bool avr_isp_erase_chip(AvrIsp* instance);
uint8_t avr_isp_spi_transaction(
AvrIsp* instance,
uint8_t cmd,
uint8_t addr_hi,
uint8_t addr_lo,
uint8_t data);
bool avr_isp_read_page(
AvrIsp* instance,
uint32_t memtype,
uint16_t addr,
uint16_t page_size,
uint8_t* data,
uint32_t data_size);
bool avr_isp_write_page(
AvrIsp* instance,
uint32_t mem_type,
uint32_t mem_size,
uint16_t addr,
uint16_t page_size,
uint8_t* data,
uint32_t data_size);
uint8_t avr_isp_read_lock_byte(AvrIsp* instance);
bool avr_isp_write_lock_byte(AvrIsp* instance, uint8_t lock);
uint8_t avr_isp_read_fuse_low(AvrIsp* instance);
bool avr_isp_write_fuse_low(AvrIsp* instance, uint8_t lfuse);
uint8_t avr_isp_read_fuse_high(AvrIsp* instance);
bool avr_isp_write_fuse_high(AvrIsp* instance, uint8_t hfuse);
uint8_t avr_isp_read_fuse_extended(AvrIsp* instance);
bool avr_isp_write_fuse_extended(AvrIsp* instance, uint8_t efuse);
void avr_isp_write_extended_addr(AvrIsp* instance, uint8_t extended_addr);