Skip to content

Commit b235b50

Browse files
committed
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.
1 parent 50ba218 commit b235b50

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

ports/mimxrt10xx/common-hal/microcontroller/Pin.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,3 @@ void claim_pin(const mcu_pin_obj_t *pin) {
119119
void common_hal_mcu_pin_reset_number(uint8_t pin_no) {
120120
common_hal_reset_pin((mcu_pin_obj_t *)(mcu_pin_globals.map.table[pin_no].value));
121121
}
122-
123-
// The 'data' pointers may be to gc objects, they must be kept alive.
124-
void pin_gc_collect() {
125-
gc_collect_root((void **)&pcid, sizeof(pcid) / sizeof(void *));
126-
}

ports/mimxrt10xx/peripherals/mimxrt10xx/pins.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#include "peripherals/mimxrt10xx/pins.h"
22

3+
typedef struct {
4+
gpio_change_interrupt_t *func;
5+
void *data;
6+
} pin_change_interrupt_data;
7+
38
/* Array of GPIO peripheral base address. */
49
static GPIO_Type *const s_gpioBases[] = GPIO_BASE_PTRS;
510
static uint32_t GPIO_GetInstance(GPIO_Type *base) {
@@ -23,7 +28,7 @@ static uint32_t GPIO_GetInstance(GPIO_Type *base) {
2328
static const IRQn_Type low_irqs[] = GPIO_COMBINED_LOW_IRQS;
2429
static const IRQn_Type high_irqs[] = GPIO_COMBINED_HIGH_IRQS;
2530

26-
volatile pin_change_interrupt_data pcid[MP_ARRAY_SIZE(s_gpioBases)][32];
31+
static volatile pin_change_interrupt_data pcid[MP_ARRAY_SIZE(s_gpioBases)][32];
2732

2833
void enable_pin_change_interrupt(const mcu_pin_obj_t *pin, gpio_change_interrupt_t func, void *data) {
2934
int instance = GPIO_GetInstance(pin->gpio);

ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ typedef struct {
7373
}
7474

7575
typedef void (gpio_change_interrupt_t)(void *data);
76-
typedef struct {
77-
gpio_change_interrupt_t *func;
78-
void *data;
79-
} pin_change_interrupt_data;
80-
extern volatile pin_change_interrupt_data pcid[MP_ARRAY_SIZE((GPIO_Type *const[])GPIO_BASE_PTRS)][32];
81-
8276
void disable_pin_change_interrupt(const mcu_pin_obj_t *pin);
8377
void enable_pin_change_interrupt(const mcu_pin_obj_t *pin, gpio_change_interrupt_t func, void *data);
8478

ports/mimxrt10xx/supervisor/port.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,6 @@ void port_idle_until_interrupt(void) {
555555
common_hal_mcu_enable_interrupts();
556556
}
557557

558-
void port_gc_collect(void) {
559-
pin_gc_collect();
560-
}
561-
562558
// Catch faults where the memory access violates MPU settings.
563559
void MemManage_Handler(void);
564560
__attribute__((used)) void PLACE_IN_ITCM(MemManage_Handler)(void) {

0 commit comments

Comments
 (0)