Furi: core refactoring and CMSIS removal part 2 (#1410)
* Furi: rename and move core * Furi: drop CMSIS_OS header and unused api, partially refactor and cleanup the rest * Furi: CMSIS_OS drop and refactoring. * Furi: refactoring, remove cmsis legacy * Furi: fix incorrect assert on queue deallocation, cleanup timer * Furi: improve delay api, get rid of floats * hal: dropped furi_hal_crc * Furi: move DWT based delay to cortex HAL * Furi: update core documentation Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
@@ -245,7 +245,7 @@
|
||||
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||
#define _SYNC_t osMutexId_t
|
||||
#define _SYNC_t FuriMutex*
|
||||
/* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||
|
@@ -46,7 +46,7 @@ void SD_IO_Init(void) {
|
||||
|
||||
/* SD chip select high */
|
||||
furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, true);
|
||||
furi_hal_delay_us(10);
|
||||
furi_delay_us(10);
|
||||
|
||||
/* Send dummy byte 0xFF, 10 times with CS high */
|
||||
/* Rise CS and MOSI for 80 clocks cycles */
|
||||
@@ -64,11 +64,11 @@ void SD_IO_Init(void) {
|
||||
void SD_IO_CSState(uint8_t val) {
|
||||
/* Some SD Cards are prone to fail if CLK-ed too soon after CS transition. Worst case found: 8us */
|
||||
if(val == 1) {
|
||||
furi_hal_delay_us(10); // Exit guard time for some SD cards
|
||||
furi_delay_us(10); // Exit guard time for some SD cards
|
||||
furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, true);
|
||||
} else {
|
||||
furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, false);
|
||||
furi_hal_delay_us(10); // Entry guard time for some SD cards
|
||||
furi_delay_us(10); // Entry guard time for some SD cards
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -349,13 +349,13 @@ uint8_t BSP_SD_Init(bool reset_card) {
|
||||
furi_hal_power_disable_external_3_3v();
|
||||
SD_SPI_Bus_To_Down_State();
|
||||
hal_sd_detect_set_low();
|
||||
furi_hal_delay_ms(250);
|
||||
furi_delay_ms(250);
|
||||
|
||||
/* reinit bus and enable power */
|
||||
SD_SPI_Bus_To_Normal_State();
|
||||
hal_sd_detect_init();
|
||||
furi_hal_power_enable_external_3_3v();
|
||||
furi_hal_delay_ms(100);
|
||||
furi_delay_ms(100);
|
||||
}
|
||||
|
||||
/* Configure IO functionalities for SD pin */
|
||||
@@ -869,7 +869,7 @@ SD_CmdAnswer_typedef SD_SendCmd(uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t
|
||||
retr.r2 = SD_IO_WriteByte(SD_DUMMY_BYTE);
|
||||
/* Set CS High */
|
||||
SD_IO_CSState(1);
|
||||
furi_hal_delay_us(1000);
|
||||
furi_delay_us(1000);
|
||||
/* Set CS Low */
|
||||
SD_IO_CSState(0);
|
||||
|
||||
|
@@ -38,7 +38,7 @@ int ff_cre_syncobj(/* 1:Function succeeded, 0:Could not create the sync object *
|
||||
|
||||
//osSemaphoreDef(SEM);
|
||||
//*sobj = osSemaphoreCreate(osSemaphore(SEM), 1);
|
||||
*sobj = osMutexNew(NULL);
|
||||
*sobj = furi_mutex_alloc(FuriMutexTypeNormal);
|
||||
ret = (*sobj != NULL);
|
||||
|
||||
return ret;
|
||||
@@ -55,7 +55,7 @@ int ff_cre_syncobj(/* 1:Function succeeded, 0:Could not create the sync object *
|
||||
int ff_del_syncobj(/* 1:Function succeeded, 0:Could not delete due to any error */
|
||||
_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||
) {
|
||||
osMutexDelete(sobj);
|
||||
furi_mutex_free(sobj);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ int ff_req_grant(/* 1:Got a grant to access the volume, 0:Could not get a grant
|
||||
) {
|
||||
int ret = 0;
|
||||
|
||||
if(osMutexAcquire(sobj, _FS_TIMEOUT) == osOK) {
|
||||
if(furi_mutex_acquire(sobj, _FS_TIMEOUT) == FuriStatusOk) {
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ int ff_req_grant(/* 1:Got a grant to access the volume, 0:Could not get a grant
|
||||
|
||||
void ff_rel_grant(_SYNC_t sobj /* Sync object to be signaled */
|
||||
) {
|
||||
osMutexRelease(sobj);
|
||||
furi_mutex_release(sobj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user