Hardware studies specific
From Wiki at Neela Nurseries
2022-05-02 Monday
Search for Zephyr's I2C peripheral configuration code . . .
ted@localhost:~/projects/zephyr-based/hardware-Stage1-firmware-aws-iot-stand-alone/build$ grep -nr i2c_configure ./* ./mcuboot/zephyr/include/generated/syscall_dispatch.c:668:uintptr_t z_mrsh_i2c_configure(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, ./mcuboot/zephyr/include/generated/syscall_dispatch.c:1412: [K_SYSCALL_I2C_CONFIGURE] = z_mrsh_i2c_configure, ./mcuboot/zephyr/include/generated/syscalls/i2c.h:24:extern int z_impl_i2c_configure(const struct device * dev, uint32_t dev_config); ./mcuboot/zephyr/include/generated/syscalls/i2c.h:25:static inline int i2c_configure(const struct device * dev, uint32_t dev_config) ./mcuboot/zephyr/include/generated/syscalls/i2c.h:33: return z_impl_i2c_configure(dev, dev_config); ./mcuboot/zephyr/include/generated/syscalls/i2c_configure_mrsh.c:10:extern int z_vrfy_i2c_configure(const struct device * dev, uint32_t dev_config); ./mcuboot/zephyr/include/generated/syscalls/i2c_configure_mrsh.c:11:uintptr_t z_mrsh_i2c_configure(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, ./mcuboot/zephyr/include/generated/syscalls/i2c_configure_mrsh.c:19: int ret = z_vrfy_i2c_configure(*(const struct device **)&arg0, *(uint32_t*)&arg1) ./mcuboot/zephyr/misc/generated/syscalls.json:1159: "int i2c_configure", ./spm/zephyr/include/generated/syscall_dispatch.c:668:uintptr_t z_mrsh_i2c_configure(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, ./spm/zephyr/include/generated/syscall_dispatch.c:1412: [K_SYSCALL_I2C_CONFIGURE] = z_mrsh_i2c_configure, ./spm/zephyr/include/generated/syscalls/i2c.h:24:extern int z_impl_i2c_configure(const struct device * dev, uint32_t dev_config); ./spm/zephyr/include/generated/syscalls/i2c.h:25:static inline int i2c_configure(const struct device * dev, uint32_t dev_config) ./spm/zephyr/include/generated/syscalls/i2c.h:33: return z_impl_i2c_configure(dev, dev_config); ./spm/zephyr/include/generated/syscalls/i2c_configure_mrsh.c:10:extern int z_vrfy_i2c_configure(const struct device * dev, uint32_t dev_config); ./spm/zephyr/include/generated/syscalls/i2c_configure_mrsh.c:11:uintptr_t z_mrsh_i2c_configure(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, ./spm/zephyr/include/generated/syscalls/i2c_configure_mrsh.c:19: int ret = z_vrfy_i2c_configure(*(const struct device **)&arg0, *(uint32_t*)&arg1) ./spm/zephyr/misc/generated/syscalls.json:1159: "int i2c_configure", ./zephyr/include/generated/syscall_dispatch.c:668:uintptr_t z_mrsh_i2c_configure(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, ./zephyr/include/generated/syscall_dispatch.c:1412: [K_SYSCALL_I2C_CONFIGURE] = z_mrsh_i2c_configure, ./zephyr/include/generated/syscalls/i2c.h:24:extern int z_impl_i2c_configure(const struct device * dev, uint32_t dev_config); ./zephyr/include/generated/syscalls/i2c.h:25:static inline int i2c_configure(const struct device * dev, uint32_t dev_config) ./zephyr/include/generated/syscalls/i2c.h:33: return z_impl_i2c_configure(dev, dev_config); ./zephyr/include/generated/syscalls/i2c_configure_mrsh.c:10:extern int z_vrfy_i2c_configure(const struct device * dev, uint32_t dev_config); ./zephyr/include/generated/syscalls/i2c_configure_mrsh.c:11:uintptr_t z_mrsh_i2c_configure(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, ./zephyr/include/generated/syscalls/i2c_configure_mrsh.c:19: int ret = z_vrfy_i2c_configure(*(const struct device **)&arg0, *(uint32_t*)&arg1) ./zephyr/misc/generated/syscalls.json:1159: "int i2c_configure", ted@vibratsiya:~/projects/zephyr-based/hardware-Stage1-firmware-aws-iot-stand-alone/build$
- STEP - To identify first reference to routine i2c_configure() in Zephyr based project build artifacts.
An excerpt from file `ncs/project_root/build/zephyr/include/generated/syscalls/i2c.h:
24 extern int z_impl_i2c_configure(const struct device * dev, uint32_t dev_config); 25 static inline int i2c_configure(const struct device * dev, uint32_t dev_config) 26 { 27 #ifdef CONFIG_USERSPACE 28 if (z_syscall_trap()) { 29 return (int) arch_syscall_invoke2(*(uintptr_t *)&dev, *(uintptr_t *)&dev_config, K_SYSCALL_I2C_CONFIGURE); 30 } 31 #endif 32 compiler_barrier(); 33 return z_impl_i2c_configure(dev, dev_config); 34 }
Search results:
ted@vibratsiya:~/projects/zephyr-based/hardware-Stage1-firmware-aws-iot-stand-alone/build$ grep -nr z_impl_i2c_configure ./* ./mcuboot/zephyr/include/generated/syscalls/i2c.h:24:extern int z_impl_i2c_configure(const struct device * dev, uint32_t dev_config); ./mcuboot/zephyr/include/generated/syscalls/i2c.h:33: return z_impl_i2c_configure(dev, dev_config); ./spm/zephyr/include/generated/syscalls/i2c.h:24:extern int z_impl_i2c_configure(const struct device * dev, uint32_t dev_config); ./spm/zephyr/include/generated/syscalls/i2c.h:33: return z_impl_i2c_configure(dev, dev_config); ./zephyr/include/generated/syscalls/i2c.h:24:extern int z_impl_i2c_configure(const struct device * dev, uint32_t dev_config); ./zephyr/include/generated/syscalls/i2c.h:33: return z_impl_i2c_configure(dev, dev_config);
Hmm kind of dead ending here, no routine definitions found in either `zephyr` source tree nor `nrf` code projects. And `west build -t menuconfig` session shows CONFIG_USERSPACE=n.
- STEP - A search for CONFIG_PULL_UP symbol among Zephyr sources:
Subset of many results . . .
./boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common.dts:47: gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; ./boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common.dts:51: gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; ./boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common.dts:55: gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; ./boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common.dts:59: gpios = <&gpio0 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; ./boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common_0_14_0.dtsi:38: int-gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;