mirror of
https://github.com/keirf/greaseweazle-firmware.git
synced 2025-10-31 11:06:44 -07:00
Implement a test mode for F7 (v3, Lightning Plus) and AT32F4xx models.
This commit is contained in:
@@ -70,7 +70,10 @@
|
||||
/* CMD_GET_PIN, length=3, pin#. Successful ACK is followed by pin-level byte
|
||||
* (1=High, 0=Low). Unsupported pin returns ACK_BAD_PIN and no pin level. */
|
||||
#define CMD_GET_PIN 20
|
||||
#define CMD_MAX 20
|
||||
/* CMD_TEST_MODE, length=10, 0x6e504b4e, 0x382910d3
|
||||
* Responds ACK_OKAY and then switches to board test mode until reset. */
|
||||
#define CMD_TEST_MODE 21
|
||||
#define CMD_MAX 21
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -92,6 +92,21 @@ void fpec_init(void);
|
||||
void fpec_page_erase(uint32_t flash_address);
|
||||
void fpec_write(const void *data, unsigned int size, uint32_t flash_address);
|
||||
|
||||
/* Pin mappings */
|
||||
enum { _A = 0, _B, _C, _D, _E, _F, _G, _H, _I };
|
||||
enum { _OD = 0, _PP };
|
||||
struct pin_mapping {
|
||||
uint8_t pin_id;
|
||||
uint8_t gpio_bank;
|
||||
uint8_t gpio_pin;
|
||||
bool_t push_pull;
|
||||
};
|
||||
GPIO gpio_from_id(uint8_t id);
|
||||
uint8_t write_mapped_pin(
|
||||
const struct pin_mapping *map, int pin_id, bool_t level);
|
||||
uint8_t read_mapped_pin(
|
||||
const struct pin_mapping *map, int pin_id, bool_t *p_level);
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
|
||||
@@ -99,13 +99,6 @@ enum {
|
||||
F7SM_v3,
|
||||
};
|
||||
|
||||
struct pin_mapping {
|
||||
uint8_t pin_id;
|
||||
uint8_t gpio_bank;
|
||||
uint8_t gpio_pin;
|
||||
bool_t push_pull;
|
||||
};
|
||||
|
||||
struct board_config {
|
||||
uint8_t hse_mhz;
|
||||
bool_t hse_byp;
|
||||
@@ -118,10 +111,6 @@ struct board_config {
|
||||
extern const struct board_config *board_config;
|
||||
void identify_board_config(void);
|
||||
|
||||
GPIO gpio_from_id(uint8_t id);
|
||||
uint8_t write_mapped_pin(
|
||||
const struct pin_mapping *map, int pin_id, bool_t level);
|
||||
|
||||
void early_fatal(int blinks) __attribute__((noreturn));
|
||||
#define early_delay_ms(ms) (delay_ticks((ms)*2000))
|
||||
#define early_delay_us(us) (delay_ticks((us)*2))
|
||||
|
||||
@@ -103,6 +103,9 @@ static inline int printk(const char *format, ...) { return 0; }
|
||||
void floppy_init(void);
|
||||
void floppy_process(void);
|
||||
|
||||
/* Test mode */
|
||||
void testmode_process(void);
|
||||
|
||||
/* CRC-CCITT */
|
||||
uint16_t crc16_ccitt(const void *buf, size_t len, uint16_t crc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user