mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-13 01:37:55 -06:00
spi_flash: support for firmware upgrades via SD Card
This module connects directly to MCU's previously flashed with Klipper, uploads Klipper firmware to an attached SD Card, and performs a device reset to intiate the bootloader's update process. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
7699834a61
commit
44c1caf2b9
5 changed files with 1574 additions and 0 deletions
50
scripts/spi_flash/fatfs_api.h
Normal file
50
scripts/spi_flash/fatfs_api.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Python CFFI definitions for fatfs
|
||||
//
|
||||
// Copyright (C) 2021 Eric Callahan <arksine.code@gmail.com>
|
||||
//
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
#ifndef FATFS_API_H
|
||||
#define FATFS_API_H
|
||||
|
||||
#include <stdint.h> // uint8_t
|
||||
|
||||
#define __visible __attribute__((externally_visible))
|
||||
|
||||
void fatfs_set_callbacks(
|
||||
uint8_t (*status_callback)(void),
|
||||
uint8_t (*init_callback)(void),
|
||||
uint8_t (*read_callback)(uint8_t*, uint32_t, unsigned int),
|
||||
uint8_t (*write_callback)(const uint8_t*, uint32_t, unsigned int),
|
||||
uint8_t (*ioctl_callback)(uint8_t, void*),
|
||||
uint32_t (*fattime_callback)(void));
|
||||
void fatfs_clear_callbacks(void);
|
||||
|
||||
struct ff_file;
|
||||
|
||||
struct ff_file_info {
|
||||
uint32_t size;
|
||||
uint16_t modified_date;
|
||||
uint16_t modified_time;
|
||||
uint8_t attrs;
|
||||
char name[13];
|
||||
};
|
||||
|
||||
struct ff_disk_info {
|
||||
char label[12];
|
||||
uint32_t serial_number;
|
||||
uint8_t fs_type;
|
||||
};
|
||||
|
||||
uint8_t fatfs_mount(void);
|
||||
uint8_t fatfs_unmount(void);
|
||||
struct ff_file* fatfs_open(const char* path, uint8_t mode);
|
||||
uint8_t fatfs_close(struct ff_file* fhdl);
|
||||
int fatfs_read(struct ff_file* fhdl, void* rbuf, uint16_t btr);
|
||||
int fatfs_write(struct ff_file* fhdl, const void* wbuf, uint16_t btw);
|
||||
uint8_t fatfs_remove(const char* path);
|
||||
uint8_t fatfs_get_fstats(struct ff_file_info* finfo, const char* path);
|
||||
uint8_t fatfs_get_disk_info(struct ff_disk_info* dinfo);
|
||||
uint8_t fatfs_list_dir(struct ff_file_info* flist, uint8_t max_size,
|
||||
char* path);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue