Skip to content
Snippets Groups Projects
Forked from card10 / firmware
1023 commits behind the upstream repository.
  • swym's avatar
    9b0fd54f
    feat(epicardium): Add ESB module · 9b0fd54f
    swym authored and rahix's avatar rahix committed
    usb/epc_usb
    ====
    Contains device-independent USB implementation, services MAXUSB stack
    and is given the actual USB descriptors & callbacks on initialization.
    Handles USB events and configures/deconfigures the device accordingly
    during the USB setup procedure.
    
    usb/mass_storage & cdcacm
    ====
    Contain device-specific implementations, service MAXUSB's device class
    APIs for cdcacm and mass storage.
    Here, mass storage is independent of the underlying storage device.
    
    modules/usb
    ====
    Public apic_usb API, configuration and storage device management.
    Defines the actual USB device descriptors and services the upc_usb API.
    
    If we want to add SD card functionality, this would be the place to add
    it.
    9b0fd54f
    History
    feat(epicardium): Add ESB module
    swym authored and rahix's avatar rahix committed
    usb/epc_usb
    ====
    Contains device-independent USB implementation, services MAXUSB stack
    and is given the actual USB descriptors & callbacks on initialization.
    Handles USB events and configures/deconfigures the device accordingly
    during the USB setup procedure.
    
    usb/mass_storage & cdcacm
    ====
    Contain device-specific implementations, service MAXUSB's device class
    APIs for cdcacm and mass storage.
    Here, mass storage is independent of the underlying storage device.
    
    modules/usb
    ====
    Public apic_usb API, configuration and storage device management.
    Defines the actual USB device descriptors and services the upc_usb API.
    
    If we want to add SD card functionality, this would be the place to add
    it.
filesystem.h 1000 B
#ifndef EPICARDIUM_MODULE_FILESYSTEM_INCLUDED
#define EPICARDIUM_MODULE_FILESYSTEM_INCLUDED

/* ---------- FAT fs ------------------------------------------------------ */

#include <stdbool.h>
#include "epicardium.h"

/**
 * module initialization - to be called once at startup before any FreeRTOS tasks
 * have been started
 *
 * calls fatfs_attach
 */
void fatfs_init(void);

/**
 * initialize and mount the FLASH storage
 * 
 * NOTE: not safe to be called from an ISR
 */
int fatfs_attach(void);


/**
 * asynchronously attach the FLASH storage
 * 
 * safe to be called from an ISR
 */
void fatfs_schedule_attach(void);

/** close all opened FDs, sync and deinitialize FLASH layer */
void fatfs_detach(void);

/** close all onpened FDs 
 * TODO: add ability to close FDs opened by core0/core1 only
 */
#define EPICARDIUM_COREMASK_0		0x01
#define EPICARDIUM_COREMASK_1		0x02
#define EPICARDIUM_COREMASK_BOTH	0x03

void fatfs_close_all(int coreMask);

#endif//EPICARDIUM_MODULE_FILESYSTEM_INCLUDED