Simple sd card driver (#162)

* fixed inline functions for modern C standart

* more stack for application

* added library

* init fatfs library

* fatfs example application

* Merge with current master

* fix typo and delete old files

* cmsis os 2 reentrance fix

* Reworked dependency wait to support multiple dependency

* Build FatFS on local target, syscall.c is target-specific.

* run local target ok

* testcase for fatfs

Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
DrZlo13
2020-10-09 00:37:19 +10:00
committed by GitHub
parent 2ab6f82ddf
commit 59513b05ee
43 changed files with 41377 additions and 39 deletions

View File

@@ -20,7 +20,7 @@ extern "C" void app() {
for(size_t i = 0; i < flipper_app_count; i++) {
// TODO create a dependency tree and run tasks in the desired order
furiac_wait_libs(FLIPPER_STARTUP[i].libs);
furiac_wait_libs(&FLIPPER_STARTUP[i].libs);
handlers[i] = furiac_start(FLIPPER_STARTUP[i].app, FLIPPER_STARTUP[i].name, NULL);
}

View File

@@ -63,6 +63,19 @@ typedef struct {
bool ready;
} FuriApp;
// application dependency info
typedef struct {
uint8_t count;
const char** name;
} FlipperAppLibrary;
// application startup info
typedef struct {
FlipperApplication app;
const char* name;
FlipperAppLibrary libs;
} FlipperStartupApp;
/*!
Simply starts application.
It call app entrypoint with param passed as argument.
@@ -95,7 +108,7 @@ void furiac_ready();
/*
Wait for the libraries we depend on
*/
void furiac_wait_libs(const char* libs);
void furiac_wait_libs(const FlipperAppLibrary* libs);
/*!
Stop specified app without returning to prev application.

View File

@@ -9,7 +9,7 @@
#include <string.h>
#define DEFAULT_STACK_SIZE 1024 // Stack size in bytes
#define DEFAULT_STACK_SIZE 2048 // Stack size in bytes
#define MAX_TASK_COUNT 8
#define INVALID_TASK_ID UINT16_MAX
@@ -27,19 +27,9 @@ uint16_t furiac_get_task_id_by_name(const char* app_name) {
return INVALID_TASK_ID;
}
void furiac_wait_libs(const char* libs) {
char* lib_rest = NULL;
char* lib_name = strtok_r((char*)libs, " ", &lib_rest);
while(lib_name != NULL) {
// trim library name
for(uint16_t i = 0; i < strlen(lib_name); i++) {
if(lib_name[i] == ' ') {
lib_name[i] = 0;
}
}
uint16_t app_id = furiac_get_task_id_by_name(lib_name);
void furiac_wait_libs(const FlipperAppLibrary* libs) {
for(uint8_t i = 0; i < libs->count; i++){
uint16_t app_id = furiac_get_task_id_by_name(libs->name[i]);
if(app_id == INVALID_TASK_ID) {
#ifdef FURI_DEBUG
@@ -53,8 +43,6 @@ void furiac_wait_libs(const char* libs) {
osDelay(50);
}
}
lib_name = strtok_r(NULL, " ", &lib_rest);
}
}