Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

armv7m/imxrt117x: add CCM shared GPR registers #564

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions hal/armv7m/imxrt/117x/imxrt117x.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,31 @@ static int _imxrt_getIOlpsrGpr(int which, unsigned int *what)
}


static int _imxrt_setSharedGpr(int which, unsigned int what)
{
if ((which < 0) || (which > 7)) {
return -EINVAL;
}

*(imxrt_common.ccm + 0x1200 + which * 0x8) = what;
hal_cpuDataSyncBarrier();

return 0;
}


static int _imxrt_getSharedGpr(int which, unsigned int *what)
{
if ((which < 0) || (which > 7) || (what == NULL)) {
return -EINVAL;
}

*what = *(imxrt_common.ccm + 0x1200 + which * 0x8);

return 0;
}


int hal_platformctl(void *ptr)
{
platformctl_t *data = ptr;
Expand Down Expand Up @@ -920,6 +945,18 @@ int hal_platformctl(void *ptr)
}
break;

case pctl_sharedGpr:
if (data->action == pctl_set) {
ret = _imxrt_setSharedGpr(data->iogpr.field, data->iogpr.val);
}
else if (data->action == pctl_get) {
ret = _imxrt_getSharedGpr(data->iogpr.field, &t);
if (ret == 0) {
data->iogpr.val = t;
}
}
break;

default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion include/arch/armv7m/imxrt/11xx/imxrt1170.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ enum { cti0_err_irq = 17 + 16, cti1_err_irq, core_irq, lpuart1_irq, lpuart2_irq,
typedef struct {
enum { pctl_set = 0, pctl_get } action;
enum { pctl_devclock = 0, pctl_iogpr, pctl_iolpsrgpr, pctl_iomux, pctl_iopad, pctl_ioisel, pctl_reboot, pctl_devcache,
pctl_lpcg, pctl_cleanInvalDCache, pctl_resetSlice } type;
pctl_lpcg, pctl_cleanInvalDCache, pctl_resetSlice, pctl_sharedGpr } type;

union {
struct {
Expand Down
Loading