Skip to content

Commit

Permalink
hal/imxrt117x: fix IOpad
Browse files Browse the repository at this point in the history
- properly set ranges of registers configured differently
- add a way of setting ODE field in non-LPSR/SNVS GPIO registers
- set proper ranges for setting ODE field in LPSR, SNVS, and remaining GPIO registers

JIRA: RTOS-963
  • Loading branch information
julianuziemblo committed Nov 5, 2024
1 parent 10063cd commit a04d8cc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions hal/armv7m/imxrt/117x/imxrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ __attribute__((section(".noxip"))) int _imxrt_setIOpad(int pad, char sre, char d
}

if (((pad >= pctl_pad_gpio_emc_b1_00) && (pad <= pctl_pad_gpio_emc_b2_20)) ||
((pad >= pctl_pad_gpio_sd_b1_00) && (pad <= pctl_pad_gpio_disp_b2_15))) {
((pad >= pctl_pad_gpio_sd_b1_00) && (pad <= pctl_pad_gpio_disp_b1_11))) {
/* Fields have slightly diffrent meaning... */
if (pue == 0) {
pull = 3;
Expand All @@ -178,11 +178,15 @@ __attribute__((section(".noxip"))) int _imxrt_setIOpad(int pad, char sre, char d
t = *reg & ~0x1f;
t |= (!!sre) | (!!dse << 1) | (!!pue << 2) | (!!pus << 3);

if ((pad >= pctl_pad_test_mode) && (pad <= pctl_pad_gpio_snvs_09)) {
if ((pad >= pctl_pad_gpio_emc_b1_00) && (pad <= pctl_pad_gpio_disp_b2_15)) {
t &= ~(1 << 4);
t |= !!ode << 4;
}
else if ((pad >= pctl_pad_wakeup) && (pad <= pctl_pad_gpio_snvs_09)) {
t &= ~(1 << 6);
t |= !!ode << 6;
}
else {
else if ((pad >= pctl_pad_gpio_lpsr_00) && (pad <= pctl_pad_gpio_lpsr_15)) {
t &= ~(1 << 5);
t |= !!ode << 5;
}
Expand Down

0 comments on commit a04d8cc

Please sign in to comment.