44 lines
723 B
C
44 lines
723 B
C
#ifndef CONTROL_H
|
|
#define CONTROL_H
|
|
|
|
#include "stm32f4xx_hal.h"
|
|
#include "fatfs.h"
|
|
#include <sys/types.h>
|
|
|
|
typedef struct {
|
|
// Block and size are in blocks of 128
|
|
uint8_t user;
|
|
char name[8];
|
|
char ext[3];
|
|
uint32_t size;
|
|
uint16_t allocation[8];
|
|
char* filename;
|
|
} DiskEntry;
|
|
|
|
typedef struct {
|
|
FATFS *fs;
|
|
FIL *file;
|
|
uint8_t command;
|
|
uint8_t ready;
|
|
uint32_t counter;
|
|
uint32_t lba;
|
|
uint8_t* buffer;
|
|
uint8_t* directory;
|
|
unsigned int size;
|
|
} Storage;
|
|
|
|
typedef struct {
|
|
uint8_t memory_config;
|
|
Storage storage;
|
|
} Control;
|
|
|
|
uint16_t read_address();
|
|
void write_data(uint8_t value);
|
|
uint8_t read_data();
|
|
|
|
void control_program_eeprom(uint8_t* data, uint16_t length);
|
|
void control_cycle();
|
|
void control_reset();
|
|
|
|
#endif
|