CardSight 0.1.0
C API reference for the CardSight firmware and application
Loading...
Searching...
No Matches
app.h File Reference

Public application state and the request message the UI sends. More...

#include "storage/storage_proxy.h"
#include <hal/blkdev.h>
#include <hal/mmc/core.h>
#include <vfs.h>

Go to the source code of this file.

Data Structures

struct  cardsight_file_entry
 One directory entry shown in the file browser. More...
struct  cardsight_file_list
 The listing of one directory, valid or carrying the error that prevented it. More...
struct  cardsight_request
 One request queued to the worker task. More...
struct  cardsight_state
 Everything the worker publishes to the UI. More...

Macros

#define APP_LAYOUT_MAX   8U
 Maximum number of partitions a layout request may describe.
#define APP_FILE_ENTRIES   64U
 Number of directory entries the browser keeps.
#define APP_FILE_NAME   128U
 Longest file name, including the terminating NUL, held in a listing.

Enumerations

enum  cardsight_request_type {
  CARDSIGHT_REQUEST_SCAN , CARDSIGHT_REQUEST_START_DIRECT , CARDSIGHT_REQUEST_START_PROXY , CARDSIGHT_REQUEST_STOP ,
  CARDSIGHT_REQUEST_FORMAT , CARDSIGHT_REQUEST_LAYOUT , CARDSIGHT_REQUEST_LIST
}
 Operation the worker can be asked to perform; one is in flight at a time. More...

Functions

void cardsight_app_init (void)
 Initialise the state, the locks and the worker task.
void cardsight_snapshot (struct cardsight_state *state)
 Copy the shared state for the UI to render.
void send_request (const struct cardsight_request *request)
 Queue one request for the worker.

Detailed Description

Public application state and the request message the UI sends.

The UI thread only reads a snapshot of cardsight_state and submits requests; the worker task in app.c performs every card operation. The types here are the contract between the two.

Macro Definition Documentation

◆ APP_FILE_ENTRIES

#define APP_FILE_ENTRIES   64U

Number of directory entries the browser keeps.

The browser keeps one screenful of names; larger directories report how many were left out.

Enumeration Type Documentation

◆ cardsight_request_type

Operation the worker can be asked to perform; one is in flight at a time.

Enumerator
CARDSIGHT_REQUEST_SCAN 

Re-read the card, its table and its partitions.

CARDSIGHT_REQUEST_START_DIRECT 

Expose the whole card over USB mass storage.

CARDSIGHT_REQUEST_START_PROXY 

Start the exFAT proxy view and expose it over USB.

CARDSIGHT_REQUEST_STOP 

Stop USB mass storage and the proxy.

CARDSIGHT_REQUEST_FORMAT 

Format one partition.

CARDSIGHT_REQUEST_LAYOUT 

Write a new partition table and format its partitions.

CARDSIGHT_REQUEST_LIST 

List one directory of one partition.

Function Documentation

◆ cardsight_snapshot()

void cardsight_snapshot ( struct cardsight_state * state)

Copy the shared state for the UI to render.

Parameters
[out]stateDestination snapshot; running is refreshed from the USB driver at copy time.

◆ send_request()

void send_request ( const struct cardsight_request * request)

Queue one request for the worker.

Parameters
[in]requestRequest to copy into the queue; ignored when the worker is busy or the queue is full.