mimxrt: no longer need to collect the pin chainge interrupt ptrs

.. the objects on the gc heap are guaranteed to be alive, as their
finali(s/z)er will disable the interrupt.
This commit is contained in:
Jeff Epler 2023-03-23 09:58:40 -05:00
parent 50ba218afb
commit b235b50647
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
4 changed files with 6 additions and 16 deletions

View File

@ -119,8 +119,3 @@ void claim_pin(const mcu_pin_obj_t *pin) {
void common_hal_mcu_pin_reset_number(uint8_t pin_no) {
common_hal_reset_pin((mcu_pin_obj_t *)(mcu_pin_globals.map.table[pin_no].value));
}
// The 'data' pointers may be to gc objects, they must be kept alive.
void pin_gc_collect() {
gc_collect_root((void **)&pcid, sizeof(pcid) / sizeof(void *));
}

View File

@ -1,5 +1,10 @@
#include "peripherals/mimxrt10xx/pins.h"
typedef struct {
gpio_change_interrupt_t *func;
void *data;
} pin_change_interrupt_data;
/* Array of GPIO peripheral base address. */
static GPIO_Type *const s_gpioBases[] = GPIO_BASE_PTRS;
static uint32_t GPIO_GetInstance(GPIO_Type *base) {
@ -23,7 +28,7 @@ static uint32_t GPIO_GetInstance(GPIO_Type *base) {
static const IRQn_Type low_irqs[] = GPIO_COMBINED_LOW_IRQS;
static const IRQn_Type high_irqs[] = GPIO_COMBINED_HIGH_IRQS;
volatile pin_change_interrupt_data pcid[MP_ARRAY_SIZE(s_gpioBases)][32];
static volatile pin_change_interrupt_data pcid[MP_ARRAY_SIZE(s_gpioBases)][32];
void enable_pin_change_interrupt(const mcu_pin_obj_t *pin, gpio_change_interrupt_t func, void *data) {
int instance = GPIO_GetInstance(pin->gpio);

View File

@ -73,12 +73,6 @@ typedef struct {
}
typedef void (gpio_change_interrupt_t)(void *data);
typedef struct {
gpio_change_interrupt_t *func;
void *data;
} pin_change_interrupt_data;
extern volatile pin_change_interrupt_data pcid[MP_ARRAY_SIZE((GPIO_Type *const[])GPIO_BASE_PTRS)][32];
void disable_pin_change_interrupt(const mcu_pin_obj_t *pin);
void enable_pin_change_interrupt(const mcu_pin_obj_t *pin, gpio_change_interrupt_t func, void *data);

View File

@ -555,10 +555,6 @@ void port_idle_until_interrupt(void) {
common_hal_mcu_enable_interrupts();
}
void port_gc_collect(void) {
pin_gc_collect();
}
// Catch faults where the memory access violates MPU settings.
void MemManage_Handler(void);
__attribute__((used)) void PLACE_IN_ITCM(MemManage_Handler)(void) {