diff --git a/arch/arm/src/s32k1xx/s32k1xx_clockconfig.c b/arch/arm/src/s32k1xx/s32k1xx_clockconfig.c index 77ee15e49e..37f99dda0b 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_clockconfig.c +++ b/arch/arm/src/s32k1xx/s32k1xx_clockconfig.c @@ -2557,7 +2557,7 @@ int s32k1xx_clockconfig(const struct clock_configuration_s *clkcfg) /* Set PCC configuration */ - s32k1xx_periphclocks(clkcfg->pcc.count, clkcfg->pcc.pclks); + s32k1xx_periphclocks(num_of_peripheral_clocks_0, clkcfg->pcc.pclks); /* Set SIM configuration */ diff --git a/arch/arm/src/s32k1xx/s32k1xx_clockconfig.h b/arch/arm/src/s32k1xx/s32k1xx_clockconfig.h index ad55077fc0..01cd3fd470 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_clockconfig.h +++ b/arch/arm/src/s32k1xx/s32k1xx_clockconfig.h @@ -86,6 +86,8 @@ * Public Types ****************************************************************************/ +extern const unsigned int num_of_peripheral_clocks_0; + /* Clock Configuration ******************************************************/ enum scg_system_clock_type_e @@ -412,7 +414,6 @@ struct sim_clock_config_s struct peripheral_clock_config_s; /* Forward reference */ struct pcc_config_s { - unsigned int count; /* Number of peripherals to be configured */ const struct peripheral_clock_config_s *pclks; /* The peripheral clock configuration array */ }; diff --git a/arch/arm/src/s32k3xx/s32k3xx_clockconfig.c b/arch/arm/src/s32k3xx/s32k3xx_clockconfig.c index 2a413d29a5..0bae42a560 100644 --- a/arch/arm/src/s32k3xx/s32k3xx_clockconfig.c +++ b/arch/arm/src/s32k3xx/s32k3xx_clockconfig.c @@ -1053,7 +1053,7 @@ int s32k3xx_clockconfig(const struct clock_configuration_s *clkcfg) ret = s32k3xx_cgm_config(&clkcfg->cgm); if (ret >= 0) { - s32k3xx_periphclocks(clkcfg->pcc.count, clkcfg->pcc.pclks); + s32k3xx_periphclocks(num_of_peripheral_clocks_0, clkcfg->pcc.pclks); } return 0; diff --git a/arch/arm/src/s32k3xx/s32k3xx_clockconfig.h b/arch/arm/src/s32k3xx/s32k3xx_clockconfig.h index 046dc678d1..e34f23c86d 100644 --- a/arch/arm/src/s32k3xx/s32k3xx_clockconfig.h +++ b/arch/arm/src/s32k3xx/s32k3xx_clockconfig.h @@ -53,6 +53,8 @@ * Public Types ****************************************************************************/ +extern const unsigned int num_of_peripheral_clocks_0; + /* Clock Configuration ******************************************************/ enum cgm_system_clock_type_e diff --git a/boards/arm/s32k1xx/rddrone-bms772/src/rddrone-bms772.h b/boards/arm/s32k1xx/rddrone-bms772/src/rddrone-bms772.h index f9865c7f9d..61114c4c00 100644 --- a/boards/arm/s32k1xx/rddrone-bms772/src/rddrone-bms772.h +++ b/boards/arm/s32k1xx/rddrone-bms772/src/rddrone-bms772.h @@ -77,10 +77,6 @@ #define NUM_OF_GPIO 12 -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 12 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_clockconfig.c b/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_clockconfig.c index f628d415e5..a6cf7ce645 100644 --- a/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_clockconfig.c +++ b/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_clockconfig.c @@ -163,7 +163,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, .pmc = diff --git a/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_periphclocks.c b/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_periphclocks.c index 969eb59402..4d4a3eabe0 100644 --- a/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_periphclocks.c +++ b/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_periphclocks.c @@ -123,6 +123,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = }, }; +unsigned int const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k118evb/src/s32k118evb.h b/boards/arm/s32k1xx/s32k118evb/src/s32k118evb.h index f4bd7af58f..3309ca8897 100644 --- a/boards/arm/s32k1xx/s32k118evb/src/s32k118evb.h +++ b/boards/arm/s32k1xx/s32k118evb/src/s32k118evb.h @@ -64,10 +64,6 @@ #define GPIO_SW2 (PIN_PTD3 | PIN_INT_BOTH) #define GPIO_SW3 (PIN_PTD5 | PIN_INT_BOTH) -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 11 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_clockconfig.c b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_clockconfig.c index 084c3ad343..211d3aaba1 100644 --- a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_clockconfig.c +++ b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_clockconfig.c @@ -145,7 +145,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, .pmc = diff --git a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_periphclocks.c b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_periphclocks.c index 2b01db0044..b14d9b049e 100644 --- a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_periphclocks.c +++ b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_periphclocks.c @@ -115,6 +115,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = }, }; +unsigned int const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k144evb/src/s32k144evb.h b/boards/arm/s32k1xx/s32k144evb/src/s32k144evb.h index 7da255502b..d675f48014 100644 --- a/boards/arm/s32k1xx/s32k144evb/src/s32k144evb.h +++ b/boards/arm/s32k1xx/s32k144evb/src/s32k144evb.h @@ -64,10 +64,6 @@ #define GPIO_SW2 (PIN_PTC12 | PIN_INT_BOTH) #define GPIO_SW3 (PIN_PTC13 | PIN_INT_BOTH) -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 15 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_clockconfig.c b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_clockconfig.c index 9c3905a30c..b83ef015ad 100644 --- a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_clockconfig.c +++ b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_clockconfig.c @@ -163,7 +163,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, .pmc = diff --git a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_periphclocks.c b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_periphclocks.c index afcd2d199f..dd14c44b41 100644 --- a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_periphclocks.c +++ b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_periphclocks.c @@ -149,6 +149,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = }, }; +unsigned int const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k146evb/src/s32k146evb.h b/boards/arm/s32k1xx/s32k146evb/src/s32k146evb.h index f8c3d7b8a1..98b247f25b 100644 --- a/boards/arm/s32k1xx/s32k146evb/src/s32k146evb.h +++ b/boards/arm/s32k1xx/s32k146evb/src/s32k146evb.h @@ -64,10 +64,6 @@ #define GPIO_SW2 (PIN_PTC12 | PIN_INT_BOTH) #define GPIO_SW3 (PIN_PTC13 | PIN_INT_BOTH) -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 15 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_clockconfig.c b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_clockconfig.c index 950b780bf3..050a052bf4 100644 --- a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_clockconfig.c +++ b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_clockconfig.c @@ -163,7 +163,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, .pmc = diff --git a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_periphclocks.c b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_periphclocks.c index 6a097ce2f3..e26433e72a 100644 --- a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_periphclocks.c +++ b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_periphclocks.c @@ -149,6 +149,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = }, }; +size_t const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k148evb/src/s32k148evb.h b/boards/arm/s32k1xx/s32k148evb/src/s32k148evb.h index d99b89de37..04a46baad8 100644 --- a/boards/arm/s32k1xx/s32k148evb/src/s32k148evb.h +++ b/boards/arm/s32k1xx/s32k148evb/src/s32k148evb.h @@ -64,10 +64,6 @@ #define GPIO_SW3 (PIN_PTC12 | PIN_INT_BOTH) #define GPIO_SW4 (PIN_PTC13 | PIN_INT_BOTH) -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 18 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_clockconfig.c b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_clockconfig.c index 8d6960c85d..a2d163eaed 100644 --- a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_clockconfig.c +++ b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_clockconfig.c @@ -169,7 +169,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, .pmc = diff --git a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_periphclocks.c b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_periphclocks.c index 5a2c697570..bc88639b98 100644 --- a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_periphclocks.c +++ b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_periphclocks.c @@ -177,6 +177,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = }, }; +unsigned int const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_clockconfig.c b/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_clockconfig.c index dc7c9e38e0..e6483d952c 100644 --- a/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_clockconfig.c +++ b/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_clockconfig.c @@ -163,7 +163,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, .pmc = diff --git a/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_periphclocks.c b/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_periphclocks.c index 2b85f8b9b2..6f34239d07 100644 --- a/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_periphclocks.c +++ b/boards/arm/s32k1xx/ucans32k146/src/s32k1xx_periphclocks.c @@ -122,6 +122,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = }, }; +unsigned int const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/arm/s32k1xx/ucans32k146/src/ucans32k146.h b/boards/arm/s32k1xx/ucans32k146/src/ucans32k146.h index a737b6440b..f33a1af748 100644 --- a/boards/arm/s32k1xx/ucans32k146/src/ucans32k146.h +++ b/boards/arm/s32k1xx/ucans32k146/src/ucans32k146.h @@ -66,10 +66,6 @@ #define GPIO_SE050_EN (PIN_PTA6 | GPIO_LOWDRIVE) -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 12 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k3xx/mr-canhubk3/src/mr-canhubk3.h b/boards/arm/s32k3xx/mr-canhubk3/src/mr-canhubk3.h index bc686ebe39..7c4533bb24 100644 --- a/boards/arm/s32k3xx/mr-canhubk3/src/mr-canhubk3.h +++ b/boards/arm/s32k3xx/mr-canhubk3/src/mr-canhubk3.h @@ -66,10 +66,6 @@ #define GPIO_SW1 (PIN_EIRQ31_2 | PIN_INT_BOTH) /* PTD15 */ #define GPIO_SW2 (PIN_EIRQ5_2 | PIN_INT_BOTH) /* PTA25 */ -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 26 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_clockconfig.c b/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_clockconfig.c index 64649d30c7..bf2e7b3134 100644 --- a/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_clockconfig.c +++ b/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_clockconfig.c @@ -152,7 +152,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number of peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, }; diff --git a/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_periphclocks.c b/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_periphclocks.c index 0db0859f02..bf3de7599d 100644 --- a/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_periphclocks.c +++ b/boards/arm/s32k3xx/mr-canhubk3/src/s32k3xx_periphclocks.c @@ -253,6 +253,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = } }; +unsigned int const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/boards/arm/s32k3xx/s32k344evb/src/s32k344evb.h b/boards/arm/s32k3xx/s32k344evb/src/s32k344evb.h index abe697c6fc..3e8527e9d7 100644 --- a/boards/arm/s32k3xx/s32k344evb/src/s32k344evb.h +++ b/boards/arm/s32k3xx/s32k344evb/src/s32k344evb.h @@ -74,10 +74,6 @@ #define GPIO_SW0 (PIN_WKPU41 | PIN_INT_BOTH) #define GPIO_SW1 (PIN_WKPU38 | PIN_INT_BOTH) -/* Count of peripheral clock user configurations */ - -#define NUM_OF_PERIPHERAL_CLOCKS_0 25 - /**************************************************************************** * Public Data ****************************************************************************/ diff --git a/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_clockconfig.c b/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_clockconfig.c index b52e88670c..b918eeeaa9 100644 --- a/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_clockconfig.c +++ b/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_clockconfig.c @@ -147,7 +147,6 @@ const struct clock_configuration_s g_initial_clkconfig = }, .pcc = { - .count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number of peripheral clock configurations */ .pclks = g_peripheral_clockconfig0, /* Peripheral clock configurations */ }, }; diff --git a/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_periphclocks.c b/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_periphclocks.c index 85a3ad1469..6afe069173 100644 --- a/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_periphclocks.c +++ b/boards/arm/s32k3xx/s32k344evb/src/s32k3xx_periphclocks.c @@ -245,6 +245,10 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] = }, }; +unsigned int const num_of_peripheral_clocks_0 = + sizeof(g_peripheral_clockconfig0) / + sizeof(g_peripheral_clockconfig0[0]); + /**************************************************************************** * Public Functions ****************************************************************************/