Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux kernel 关于U-boot驱动程序模型_Linux Kernel_Linux Device Driver_U Boot - Fatal编程技术网

Linux kernel 关于U-boot驱动程序模型

Linux kernel 关于U-boot驱动程序模型,linux-kernel,linux-device-driver,u-boot,Linux Kernel,Linux Device Driver,U Boot,我有一个关于U-boot驱动程序模型的简单问题。我想知道何时以及如何触发驱动程序的ops功能 例如,对于以太网驱动程序,这些是定义的ops: static const struct eth_ops designware_eth_ops = { .start = designware_eth_start, .send = designware_eth_send, .recv

我有一个关于U-boot驱动程序模型的简单问题。我想知道何时以及如何触发驱动程序的ops功能

例如,对于以太网驱动程序,这些是定义的ops:

static const struct eth_ops designware_eth_ops = {
    .start                  = designware_eth_start,
    .send                   = designware_eth_send,
    .recv                   = designware_eth_recv,
    .free_pkt               = designware_eth_free_pkt,
    .stop                   = designware_eth_stop,
    .write_hwaddr           = designware_eth_write_hwaddr,
};
现在,这些eth_操作是在探测函数之后的初始化阶段调用的,还是只有在从u-boot提示符运行一些命令(如ping、tftp等)时才调用的


初始化阶段只探测设备并将其移动到下一个子系统?

它取决于u-boot设置。如果bootcmd和bootargs环境变量定义了与网络相关的内容,比如从tftp服务器加载内核,它将首先调用start回调,然后在发送和接收send/rec回调时调用。如果内核是从flashu-boot加载的,则不需要网络连接,如果您没有在ubootshell上使用网络命令,则不会调用回调
Uboot驱动程序模型与Linux模型非常相似,实际上它们之间有很多通用代码。唯一的“大”区别是uboot使用物理寻址,Linux使用MMU将物理地址空间转换为虚拟地址空间

谢谢您的回复。那么,我可以说这些回调(.start、.send、.recv、.hwaddr)不是u-boot初始化序列的一部分吗?是的。您可以在uboot上看到,当您从外壳发送ping或tftp命令时,它首先初始化网络设备