xenomai-3.0 初始化
2016-09-09 18:21
239 查看
static int __init xenomai_init(void) { int ret, __maybe_unused cpu; setup_init_state();/*检查是否使能xenomai*/ /*如果没有使能就退出*/ if (!realtime_core_enabled()) { printk(XENO_WARNING "disabled on kernel command line\n"); return 0; } #ifdef CONFIG_SMP //检查cpu屏蔽字 cpumask_clear(&xnsched_realtime_cpus); for_each_online_cpu(cpu) { if (supported_cpus_arg & (1UL << cpu)) cpumask_set_cpu(cpu, &xnsched_realtime_cpus); } if (cpumask_empty(&xnsched_realtime_cpus)) { printk(XENO_WARNING "disabled via empty real-time CPU mask\n"); set_realtime_core_state(COBALT_STATE_DISABLED); return 0; } cobalt_cpu_affinity = xnsched_realtime_cpus; #endif /* CONFIG_SMP */ //注册调度的类:idle 和 rt schedule. xnsched_register_classes(); //proc 文件初始化 ret = xnprocfs_init_tree(); if (ret) goto fail; //初始化具体的machine,比如时钟等。一般相关的值是让cobalt自动获取,不要手动设置。 ret = mach_setup(); if (ret) goto cleanup_proc; //xenomai中断相关初始化 xnintr_mount(); //创建实时任务的管道,可与用户实时任务交互的/dev/rtp*,可做IPC通信。 //同时,注册了一个唤醒任务 xnpipe_wakeup_apc = // xnapc_alloc("pipe_wakeup", &xnpipe_wakeup_proc, NULL); ret = xnpipe_mount(); if (ret) goto cleanup_mach; //注册select唤醒删除任务 // deletion_apc = xnapc_alloc("selector_list_destroy", // xnselector_destroy_loop, NULL); ret = xnselect_mount(); if (ret) goto cleanup_pipe; /* 1.xenomai堆区申请 2.proc目录下文件架构组织 */ ret = sys_init(); if (ret) goto cleanup_select; /* 延迟初始化 */ ret = mach_late_setup(); if (ret) goto cleanup_sys; /* rtdm的class初始化 */ ret = rtdm_init(); if (ret) goto cleanup_sys; ret = cobalt_init(); if (ret) goto cleanup_rtdm; rtdm_fd_init(); printk(XENO_INFO "Cobalt v%s (%s) %s%s%s%s\n", XENO_VERSION_STRING, XENO_VERSION_NAME, boot_debug_notice, boot_lat_trace_notice, boot_evt_trace_notice, boot_state_notice); return 0; cleanup_rtdm: rtdm_cleanup(); cleanup_sys: sys_shutdown(); cleanup_select: xnselect_umount(); cleanup_pipe: xnpipe_umount(); cleanup_mach: mach_cleanup(); cleanup_proc: xnprocfs_cleanup_tree(); fail: set_realtime_core_state(COBALT_STATE_DISABLED); printk(XENO_ERR "init failed, code %d\n", ret); return ret; }
相关文章推荐
- 3.0+百度地图在地图初始化的时候就弹框展示一个信息框,而不是用户点击poi时才弹出
- C# 3.0--对象初始化语法
- 微软免费图书《Introducing Microsoft LINQ》翻译Chapter2.1:C# 3.0 特性(对象初始化表达式\匿名类型\查询表达式)
- C# 3.0新特征之创建和初始化集合对象
- Swift3.0语言教程使用字符串创建和初始化字符串
- C# 3.0新特征之创建和初始化集合对象
- Swift3.0语言教程使用编码创建和初始化字符串
- opencv 3.0 Mat 初始化 eye ones zeros create randn
- Swift3.0语言教程使用字符串创建和初始化字符串
- Swift3.0语言教程使用指针创建和初始化字符串
- Spring之WebContext不使用web.xml启动 初始化重要的类源码分析(Servlet3.0以上的)
- Swift3.0语言教程使用占位符格式创建和初始化字符串
- Swift3.0语言教程使用占位符格式创建和初始化字符串
- webx3.0-容器初始化
- vue3.0 CLI - 1 - npm 安装与初始化的入门教程
- Swift3.0语言教程使用占位符格式创建和初始化字符串
- Swift3.0语言教程使用指针创建和初始化字符串
- 升级到Android Studio 3.0 第三方包 初始化crash,如xutils, universal-image-loader, RongIM等
- C# 3.0新特征之创建和初始化集合对象
- C# 3.0新特征之创建和初始化集合对象