pinctrl
[TOC] pinctrl-uclass.cpinctrl_post_bind 以递归方式将其子项绑定为 pinconfig属性的 设备pinctrl_select_state pin选择状态并配置pinctrl_select_state_simple pin选择状态并配置1234567891011121314151617181920212223242526static int pinctrl_select_state_simple(struct udevice *dev){ struct udevice *pctldev; struct pinctrl_ops *ops; int ret; /* * 对于大多数系统,只有一个 pincontroller 设备。但在 * 在多个 pincontroller 设备的情况下,探测序列 * 数字 0(由 alias 定义)以避免争用条件。 */ ret = uclass_get_device_by_seq(UCLASS_PINCTRL, 0, &pctldev); if (ret) /* if not fou...
simple-bus
[TOC] simple-bus驱动信息 在重定向之前调用123456789101112131415161718192021UCLASS_DRIVER(simple_bus) = { .id = UCLASS_SIMPLE_BUS, .name = "simple_bus", .post_bind = simple_bus_post_bind, .per_device_plat_auto = sizeof(struct simple_bus_plat),};#if CONFIG_IS_ENABLED(OF_REAL)static const struct udevice_id generic_simple_bus_ids[] = { { .compatible = "simple-bus" }, { .compatible = "simple-mfd" }, { }};#endifU_BOOT_DRIVER(simpl...
syscon
[TOC] syscon - System Controller 系统控制器 Kconfig 1234567891011121314 config REGMAPbool "Support register maps"depends on DM/*help 硬件外设往往有一组或多组 registers可以访问它来控制硬件。A 寄存器映射使用简单的读/写接口对此进行建模。 原则上可以支持任何总线类型(I2C、SPI)、但到目前为止这仅支持直接内存访问。 */ config SYSCONbool "Support system controllers"depends on REGMAP/*help 许多 SoC 有许多系统控制器需要处理.作为一个组。提供了一些常见的功能. 通过这个 uclass,包括通过 regmap 和 每个 Cookie 分配一个唯一的编号。 */ DTS1234567891011121314soc { #address-cells = <0x01>; ...
spi
[TOC] spi-uclass.c.post_bind dm_scan_fdt_devspi_child_post_bind 子节点绑定到总线123456789static int spi_child_post_bind(struct udevice *dev){ struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev); if (!dev_has_ofnode(dev)) return 0; return spi_slave_of_to_plat(dev, plat);} spi_slave_of_to_plat 获取spi设备的属性1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374int spi_slave_of_to_plat(struct udevice *dev,...
timer
[TOC] timer-uclass.cdm_timer_init 注意到这个函数在多个地方都可以被调; DM扫描识别之后 get_tick和get_tbclk时没有gd->timer的时候 但是只有在gd->timer为空的时候才会执行 12345678910111213141516171819202122232425262728293031323334353637383940int dm_timer_init(void){ struct udevice *dev = NULL; __maybe_unused ofnode node; int ret; if (gd->timer) return 0; if (gd->dm_root == NULL) return -EAGAIN; if (CONFIG_IS_ENABLED(OF_REAL)) { node = ofnode_get_chosen_node("tick-timer"); //优先使用tick-timer节点 if (ofnode_va...
kconfig
linux/kconfig.h__count_args 计算可变参数宏的参数数123456/* * 计算可变参数宏的参数数。目前只需要 * 它用于 1、2 或 3 个参数。 */#define __arg6(a1, a2, a3, a4, a5, a6, ...) a6#define __count_args(...) __arg6(dummy, ##__VA_ARGS__, 4, 3, 2, 1, 0) 传递一个虚拟参数 dummy和参数传入,并返回第6个参数; 例如传入 __count_args(a, b, c),则展开为 __arg6(dummy, a, b, c, 4, 3, 2, 1, 0),则返回3 dummy 是一个虚拟参数,用于确保宏展开时参数列表的长度一致。在 __count_args 宏中,dummy 被用作第一个参数,以确保即使没有传递任何参数,参数列表的长度也至少为 1。 ##__VA_ARGS__ 是一个预处理器技巧,用于处理可变参数宏。VA_ARGS 是一个特殊的宏参数,表示传递给宏的所有可变参数。## 是预处理器的连接运算符,用于将两个...
env
envU_BOOT_ENV_LOCATION 通过该宏定义环境变量的位置 1234567891011121314151617181920/* * Define a callback that can be associated with variables. * when associated through the ".callbacks" environment variable, the callback * will be executed any time the variable is inserted, overwritten, or deleted. * * For SPL these are silently dropped to reduce code size, since environment * callbacks are not supported with SPL. */#ifdef CONFIG_XPL_BUILD#define U_BOOT_ENV_CALLBACK(name, callback) \ static ...
linker_list
linker_lists.h linker_lists api手册 1234567891011121314151617181920212223242526272829303132333435363738// 声明一个链接生成的条目,以__u_boot_list_2_XXX_2_YYY命名#define ll_entry_declare(_type, _name, _list) \ _type _u_boot_list_2_##_list##_2_##_name __aligned(4) \ __attribute__((unused)) \ __section("__u_boot_list_2_"#_list"_2_"#_name)// 声明一个链接生成的列表,以__u_boot_list_2_XXX_2_YYY命名,但是是一个数组#define ll_entry_declare_list(_type, _name, _list) \ _type _u_boot_list_2_##_list##_2_##_nam...
杂项
system-constants.h 定义系统堆栈指针地址 定义了系统初始化的堆栈指针地址 其配置在include/generated/autoconf.h,由include/config.h->include/linux/kconfig.h->include/generated/autoconf.h include/generated/autoconf.h为自动生成的文件,包含了系统的配置信息,原始配置在configs/stm32h750-art-pi_defconfig 12345678/* * The most common case for our initial stack pointer address is to * say that we have defined a static intiial ram address location and * size and from that we subtract the generated global...
test
[TOC] testtest.hUNIT_TEST12345678//在段中定义一个测试用例函数#define UNIT_TEST(_name, _flags, _suite) \ ll_entry_declare(struct unit_test, _name, ut_ ## _suite) = { \ .file = __FILE__, \ .name = #_name, \ .flags = _flags, \ .func = _name, \ } ut.c 单元测试相关函数 参考Unity测试框架,不在分析








