linux 内核3.8,[Beaglebone] BBB迁移到linux 3.8实时内核

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

动机

之前使用TI SDK提供的3.2标准内核,在和fpga进行高速通信时出现CPU 100%中断响应延迟严重(偶尔>50ms)造成数据丢包。为达到严格的中断响应速度(<10ms),亟需实时操作系统内核支持。方案有两个:Standard Linux -> RTOS Linux

Standard Linux -> other RTOS( RT-Thread, freeRTOS,uc/os-ii等)

当前在不牺牲功能性的情况下直接打上内核补丁是最好的方案。

关于RT-Preempt内核

The standard Linux kernel only meets soft real-time requirements: it provides basic POSIX operations for userspace time handling but has no guarantees for hard timing deadlines. With Ingo Molnar’s Realtime Preemption patch (referenced to as RT-Preempt in this document) and Thomas Gleixner’s generic clock event layer with high resolution support, the kernel gains hard realtime capabilities.

The RT-Preempt patch has raised quite some interest throughout the industry. Its clean design and consequent aim towards mainline integration makes it an interesting option for hard and firm realtime applications, reaching from professional audio to industrial control.

The RT-Preempt patch converts Linux into a fully preemptible kernel. The magic is done with:Making in-kernel locking-primitives (using spinlocks) preemptible though reimplementation with rtmutexes

Critical sections protected by i.e. spinlock_t and rwlock_t are now preemptible. The creation of non-preemptible sections (in kernel) is still possible with raw_spinlock_t (same APIs like spinlock_t)

Implementing priority inheritance for in-kernel mutexes, spinlocks and rw_semaphores. For more information on priority inversion and priority inheritance please consult Introduction to Priority Inversion

Converting interrupt handlers into preemptible kernel threads: The RT-Preempt patch treats soft interrupt handlers in kernel thread context, which is represented by a task_struct like a common userspace process. However it is also possible to register an IRQ in kernel context.

Converting the old Linux timer API into separate infrastructures for high resolution kernel timers plus one for timeouts, leading to userspace POSIX timers with high resolution.

git:https://github.com/beagleboard/kernel/tree/3.8-rt,beagleboard官方维护内核库

Device Tree

Device Tree在ARM社区的推行来源于Linus对长期以来内核代码里ARM架构上充斥的相关板级驱动代码、平台相关的垃圾代码无情谩骂,长久以来arch/arm/目录下的诸多platform级描述对内核来说就是一堆×××,因此ARM社区借鉴了PowerPC社区Device Tree概念。

“The Device Tree is a data structure for describing hardware. Rather than hard coding every detail of a device into an operating system, many aspect of the hardware can be described in a data structure that is passed to the operating system at boot time.”

Device Tree代替了以前的硬件platform上的写法,而是用树形节点描述硬件,对硬件的管教分配、时序、资源(中断、DMA通道、物理和虚拟空间等)进行描述,然后自动probe在对应各自模块的驱动下进行探测,解析硬件描述信息,完成platform或者其上的device驱动的注册。

原platform驱动模型下的实现

/* In the foo_platform_data.h file:*/

struct foo_platform_data {

u32 bar;

};

/* In the board file:*/

struct foo_platform_data foo_pdata {

.bar = 5,

};

struct platform_device foo_dev {

.name = "foo",

.id = -1,

.dev.platform_data = &foo_pdata,

};

/* And in the board setup function*/

platform_device_register(&foo_dev);

/* The driver gets access to the platform data in the probe function.*/

static int foo_probe(struct platform_device *pdev)

{

struct foo_platform_data *pdata;

pdata = pdev->dev.platform_data;

if (pdata == NULL) /* ERROR */

...

/* access pdata->bar for configuration */

...

}

static struct platform_driver foo_driver = {

.probe = foo_probe,

....

.driver = {

.name = "foo",

},

...

};

module_platform_driver(&foo_driver);

设备树下的实现

This method no longer works; in a DT based system what you have to do come up with device driver bindings, which contain the configuration the driver requires.

You must add a device node in board.dts under the on-chip-peripherals(OCP) device node:

foo {

compatible = "corp,foo";

bar = <5>;

};

No change in the board file (generic anyway) needs to be made, but the device driver must be updated to support the DT method, with something similar to the following:

static struct foo_platform_data *

foo_parse_dt(struct platform_device *pdev)

{

struct device_node *node = pdev->dev.of_node;

struct foo_platform_data *pdata;

pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);

if (pdata == NULL)

return NULL; /* out of memory */

/* no such property */

if (of_property_read_u32(node, "bar", &pdata->bar) != 0)

return NULL;

/* pdata->bar is filled in with 5 */

return pdata;

}

static int foo_probe(struct platform_device *pdev)

{

struct foo_platform_data *pdata;

pdata = pdev->dev.platform_data;

if (pdata == NULL) /* ERROR */

...

/* access pdata->bar for configuration */

...

}

static struct platform_driver foo_driver = {

.probe = foo_probe,

....

.driver = {

.name = "foo",

},

...

};

module_platform_driver(&foo_driver);

其他

3.2-Standard迁移到3.8-RT内核需要变化的驱动包括LCD7和GPMC驱动(包括DMA),两块驱动都以Device Tree Overlay的方法加载。此外,配套Device tree的U-Boot需要升级,老版本U-boot不支持Device Tree & Overlay。

3.8内核实时性的检验

因为正好有FPGA端需要处理的中断源,因此使用示波器跑一下脉宽就可以检验。

参考https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO

https://github.com/beagleboard/kernel/tree/3.8-rt

http://elinux.org/BeagleBone_and_the_3.8_Kernel

http://devicetree.org/mediawiki/index.php?title=Device_Tree_Usage

http://valentfx.com/wiki/index.php?title=LOGI_-_BBB_GPMC_Bus-_HW

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/427708.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

软考解析:2017年上半年下午试卷

软考解析&#xff1a;2017年上半年下午试卷 第一题&#xff1a;数据流图 第二题&#xff1a;数据库设计 第三题&#xff1a;面向对象开发 真题 理论 类图 状态图 解题思路 第四题&#xff1a;算法与数据结构 第五题&#xff1a;设计模式与Java转载于:https://www.cnblogs.com/…

PHP配置开发环境

PHP配置开发环境 1.建3个文件夹&#xff1a; 2&#xff1a;找到apache的安装包 3&#xff1a;可以随意写 4&#xff1a; 5&#xff1a;找到你的apache的路径 6&#xff1a;注意&#xff1a;不要解压到当前文件夹 7&#xff1a;剪切替换名字修改为php 8&#xff1a;在apache >…

linux下tar包安装sudo命令,ubuntu12.04LTS安装gv-412-Linux-x86.tar.gz方法

折腾了2天多&#xff0c;终于装好了。操作系统Ubuntu 12.04 LTS (在win7系统下用ubuntu的windows安装工具安装的&#xff0c;有点类似双系统)gaussian view程序gv-412-Linux-x86.tar.gz(软件可以从这里找到一些Linux&WinGaussian&gview下载地址)特别提示下面的设计到的…

linux 端口tnpl,Linux和Windows端口占用情况查看

Linux &#xff1a;netstat-t tcp三次握手-u udp直传数据-l 监听-r 路由-n 显示ip端口号-p 进程一般的我们使用 netstat -tnpl | grep xxx 配合管道符来查找[rootVM_48_173_centos conf]# netstat -tnplActive Internet connections (only servers)Proto Recv-Q Send-Q Local A…

SpringAOP aspectJ ProceedingJoinPoint 获取当前方法

aspectJ切面通过ProceedingJoinPoint想要获取当前执行的方法&#xff1a; 错误方法&#xff1a; Signature s pjp.getSignature(); MethodSignature ms (MethodSignature)s; Method m ms.getMethod(); 这种方式获取到的方法是接口的方法而不是具体的实现类的方法&…

linux修改挂载目录名字,linux下修改mount挂载目录名

有时根据情况需要更改mount挂载目录名来保持多个机器的统一&#xff0c;方便我们的分布式操作&#xff0c;下面是具体的操作细节。修改前&#xff1a;文件系统 容量 已用 可用 已用%% 挂载点/dev/mapper/VolGroup-lv_root50G 3.3G 44G 7% /tmpfs …

Linux禁止ip拒绝访问80,Linux iptables 设置允许(禁止)IP范围

假设有一个情况&#xff0c;我们要将某一个网段内的IP“一段IP”封锁起来&#xff0c;如192.168.0.2-192.168.0.61&#xff0c;请问该如何来设定这个规则&#xff1f;因为这个网段并没有符合任何一个CIDR网段&#xff0c;因此我们不能使用如“-s 192.168.0.0/28”的网段来匹配这…

转:linux中fork()函数详解

转&#xff1a;linux中fork&#xff08;&#xff09;函数详解 https://blog.csdn.net/jason314/article/details/5640969转载于:https://www.cnblogs.com/igfirstblog/p/9046580.html

Linux表空间扩容,linux下oracle表空间导致磁盘空间不足

今天在执行oracle存储过程的时候报错&#xff0c;错误信息:"01652 无法通过128(在表空间temp中)扩展temp段"。在linux中执行df命令后发现表空间由于autoextend的原因&#xff0c;导致磁盘已用空间为100%。[rootlocalhost ~]# df -h文件系统 容量 已用 可用 已用% 挂…

作业1#python用列表实现多用户登录,并有三次机会

1 username ["juebai","haha"]2 password [123,456]3 count 04 while count < 3:5 _username input("用户名&#xff1a;")6 _password int(input("密码&#xff1a;"))7 if _username username[0] and _passwor…

linux命令 sed 有的功能有,Linux命令:sed简介

sed是一种在线行编辑器&#xff0c;一次处理一行。工作时&#xff0c;把当前处理的行放到“模式空间”中进行编辑&#xff0c;编辑完成后把内容输送至屏幕。语法&#xff1a;sed [OPTION]…{script}…[input file]选项&#xff1a;-r:支持正则表达式-n:静默模式&#xff0c;不显…

while中的break

while中的break意思是结束循环 start 0 while True:print(start)if start 100:break # 如果start 100 就退出循环start 1转载于:https://www.cnblogs.com/zhengkui/p/9052875.html

linux tcp header更改,Linux Netfilter中修改TCP/UDP Payload的方法

来自linux-2.6.36/net/ipv4/netfilter/nf_nat_helper.c注&#xff1a;该代码可以移植到ebtables中使用&#xff0c;但需要注意struct rtable *rt结构在ebtables中是没有的。修改UDP payload的代码&#xff1a;/* Unusual, but possible case. */static int enlarge_skb(struct …

Servlet跳转到JSP页面后的路径问题相关解释

一、现象与概念 1. 问题 在Servlet转发到JSP页面时&#xff0c;此时浏览器地址栏上显示的是Servlet的路径&#xff0c;而若JSP页面的超链接还是相对于该JSP页面的地址且该Servlet和该JSP页面不在同一个文件夹下时&#xff0c;则会出现路径混乱问题。 2. 绝对路径概念 相对于con…

linux7 kickstart,Linux运维知识之CENTOS 7 验证KICKSTART文件是否完整方法

本文主要向大家介绍了Linux运维知识之CENTOS 7 验证KICKSTART文件是否完整方法&#xff0c;通过具体的内容向大家展现&#xff0c;希望对大家学习Linux运维知识有所帮助。功能简介&#xff1a;CentOS 7 包含 ksvalidator 命令行程序&#xff0c;可使用该程序进行确认Kickstart文…

CI项目设计Redis队列

项目开发过程中需要设计提供可平衡的处理多个用户请求的队列。需求&#xff1a;当用户登录后&#xff0c;查看系统中已经登录的管理员队列&#xff0c;然后查看后台管理员的处理能力&#xff0c;如果已经不能处理新的请求&#xff0c;则把该管理员从处理队列中删除&#xff0c;…

c语言在函数中传递指针,[求助]关于文件指针在函数中传递的问题

[求助]关于文件指针在函数中传递的问题我写的一个程序中文件指针在各函数间传递。请各位整理一下思路。/**//* 。。。(开头部分省略) *//* 部分函数省略 *//* 打开号码文件&#xff0c;号码文件必须与该程序放在同一文件夹。*/void OpenFile(char * argv , FILE ** fin , FILE …

担当大任者的九大特征

一、忍得住孤独人生想要获得成功&#xff0c;必须忍得住孤独&#xff0c;尤其是在创业之初&#xff0c;很多时候为了达成目标&#xff0c;可能别人在休息时&#xff0c;我们还一个人在默默无闻的付出&#xff0c;这种过程是非常孤独的&#xff0c;但如果能挺得过去&#xff0c;…

c语言竖等于意思,C语言竖式问题

#include#includeint main(){char str[30];//键盘输入数组scanf("%s",str);int i,j;char sta[50];//字符串输入输出数组int count0;for(i1000;i<9999;i){for(j10;i<99;i){int proi*j;int pro1i*(j%10);int pro2i*(j/10);sprintf(sta,"%d%d%d%d%d",i,…

6章 Models

传统的MVC结构中&#xff0c;有模型这么一个概念。Django中&#xff0c;Models又是怎么一回事呢? 刚才生成的这些乱七八糟的数据迁移就是Django自带的一些应用 INSTALLED_APPS [django.contrib.admin,django.contrib.auth,django.contrib.contenttypes,django.contrib.sessio…