[FL-2375] Migrate to LL part 3 (#1058)

* FuriHal: replace HAL with LL for ARR and CC
* Rfid, FuriHal: migrate emulation to LL
* RFID hal: disable arr preload during emulation
* Rfid, Furi, FuriHal: last piece of LL puzzle
* Rfid, Furi, FuriHal: filing the last piece of LL puzzle
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
This commit is contained in:
あく
2022-03-26 01:56:18 +03:00
committed by GitHub
parent 7c4b0f534f
commit 413a03defb
16 changed files with 121 additions and 577 deletions

View File

@@ -1,7 +1,6 @@
#include "furi.h"
void furi_init() {
api_interrupt_init();
furi_log_init();
furi_record_init();
furi_stdglue_init();

View File

@@ -18,7 +18,6 @@
#include <furi/log.h>
#include <furi_hal_gpio.h>
#include <furi_hal/api_interrupt_mgr.h>
#include <stdlib.h>

View File

@@ -1,65 +0,0 @@
#include "api_interrupt_mgr.h"
#include <cmsis_os2.h>
#include <furi.h>
static volatile InterruptCallbackItem callback_list[InterruptTypeLast];
bool api_interrupt_init() {
for(uint8_t i = 0; i < InterruptTypeLast; i++) {
callback_list[i].callback = NULL;
callback_list[i].context = NULL;
callback_list[i].ready = false;
}
return true;
}
void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context) {
furi_assert(type < InterruptTypeLast);
furi_check(callback_list[type].callback == NULL);
callback_list[type].callback = callback;
callback_list[type].context = context;
__DMB();
callback_list[type].ready = true;
}
void api_interrupt_remove(InterruptCallback callback, InterruptType type) {
furi_assert(type < InterruptTypeLast);
if(callback_list[type].callback != NULL) {
furi_check(callback_list[type].callback == callback);
}
callback_list[type].ready = false;
__DMB();
callback_list[type].callback = NULL;
callback_list[type].context = NULL;
}
void api_interrupt_enable(InterruptCallback callback, InterruptType type) {
furi_assert(type < InterruptTypeLast);
furi_check(callback_list[type].callback == callback);
callback_list[type].ready = true;
__DMB();
}
void api_interrupt_disable(InterruptCallback callback, InterruptType type) {
furi_assert(type < InterruptTypeLast);
furi_check(callback_list[type].callback == callback);
callback_list[type].ready = false;
__DMB();
}
void api_interrupt_call(InterruptType type, void* hw) {
// that executed in interrupt ctx so mutex don't needed
// but we need to check ready flag
furi_assert(type < InterruptTypeLast);
if(callback_list[type].callback != NULL) {
if(callback_list[type].ready) {
callback_list[type].callback(hw, callback_list[type].context);
}
}
}

View File

@@ -1,74 +0,0 @@
/**
* @file api_interrupt_mgr.h
* Furi: interrupt API
*/
#pragma once
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Interrupt callback prototype */
typedef void (*InterruptCallback)(void*, void*);
/** Interupt type */
typedef enum {
InterruptTypeTimerUpdate,
InterruptTypeLast,
} InterruptType;
/** Interrupt callback type */
typedef struct {
InterruptCallback callback;
void* context;
bool ready;
} InterruptCallbackItem;
/** Init interrupt
*
* @return true on succsessful initialization, false otherwise
*/
bool api_interrupt_init();
/** Add interrupt
*
* @param callback InterruptCallback
* @param type InterruptType
* @param context context for callback
*/
void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context);
/** Remove interrupt
*
* @param callback InterruptCallback
* @param type InterruptType
*/
void api_interrupt_remove(InterruptCallback callback, InterruptType type);
/** Enable interrupt
*
* @param callback InterruptCallback
* @param type InterruptType
*/
void api_interrupt_enable(InterruptCallback callback, InterruptType type);
/** Disable interrupt
*
* @param callback InterruptCallback
* @param type InterruptType
*/
void api_interrupt_disable(InterruptCallback callback, InterruptType type);
/** Call interrupt
*
* @param type InterruptType
* @param hw pointer to hardware peripheral
*/
void api_interrupt_call(InterruptType type, void* hw);
#ifdef __cplusplus
}
#endif