Linux
文章平均质量分 88
feiwatson
这个作者很懒,什么都没留下…
展开
-
Day6: platformDriver-2
在上文中说到,Linux kernel中大部分设备可以归结为平台设备,因此大部分的驱动是平台驱动(patform driver)而对于I2C控制器, 其挂载在platform Bus上,因此我们在linux kernel中常说的I2C driver,都是指I2C controller driver,都是以platform driver的形式存在,当然,对应的控制器是platform device。原创 2023-03-12 15:47:24 · 288 阅读 · 0 评论 -
Day4: 应用篇-1
应用开发环境安装,sysfs操作LED原创 2022-11-27 16:14:41 · 527 阅读 · 0 评论 -
Day3: uboot - 1
uboot 的全称是 Universal Boot Loader,uboot 是一个遵循 GPL 协议的开源软件,uboot 是一个裸机代码,可以看作是一个裸机综合例程。现在的 uboot 已经支持液晶屏、网络、USB 等高级功能。原创 2022-10-23 21:00:34 · 656 阅读 · 0 评论 -
Day2: 正点原子 imx交叉编译环境搭建
正点原子提供两种交叉编译工具链。这两种交叉编译工具链解释如下图。第一种 Poky 编译器是Yocto 项目编译出的,常用于编译Uboot和Linux出厂源码, 及快速编译Qt应用程序到开发板上运行。第二种通用的交叉编译器用于ARM linux驱动,应用开发。原创 2022-10-16 20:18:16 · 807 阅读 · 0 评论 -
yocto 学习:1- 什么是yocto
yocto原创 2022-10-07 19:21:20 · 5779 阅读 · 0 评论 -
Day1: 正点原子mini-linux 开发板 开机测试
从头学linux, day1原创 2022-10-07 12:53:00 · 1075 阅读 · 0 评论 -
wi-fi 基础知识
Wi-Fi 基础知识,Wi-Fi Mesh, Wi-Fi 6这篇我们学习一下Wi-Fi的基础知识,顺便再了解一下Wi-Fi Mesh, 以及Wi-Fi 6.上面的话如果换成"黑话"再来一遍,这篇我们学习一下802.11协议的基础知识,顺便再了解一下8023.11s, 以及802.11ax.我们先来梳理一下802.11协议一族。简介802.11协议主要是对Layer1(物理层)和Layer2(数据链路层)两层进行定义,从无线网卡进来的包携带的是无线报文头部,从有线网卡进来的包携带是有线报文头部,两原创 2021-12-16 23:21:20 · 1823 阅读 · 0 评论 -
树梅派 -- 通过/sys读写ADC芯片 pcf8591
通过wiringPi等library, 在user space 通过/dev/i2c来读写i2c设备的方案不在本文讨论了。编译SENSORS_PCF8591 模块在Default raspberryPi的内核中,pcf591模块是没有编译的。查看drivers\hwmon\Makefileobj-$(CONFIG_HWMON) += hwmon.o...ob...原创 2018-07-31 15:06:07 · 524 阅读 · 0 评论 -
转: 使用 /sys 文件系统访问 Linux 内核
转一个挺不错的文章使用 /sys 文件系统访问 Linux 内核https://www.ibm.com/developerworks/cn/linux/l-cn-sysfs/ 如果你正在开发的设备驱动程序中需要与用户层的接口,一般可选的方法有: 注册虚拟的字符设备文件,以这个虚拟设备上的 read/write/ioctl 等接口与用户交互;但 read/write ...转载 2018-08-01 21:27:10 · 170 阅读 · 0 评论 -
转:使用 /proc 文件系统来访问 Linux 内核的内容
使用 /proc 文件系统来访问 Linux 内核的内容https://www.ibm.com/developerworks/cn/linux/l-proc.html /proc 文件系统并不是 GNU/Linux 系统中的惟一一个虚拟文件系统。在这种系统上,sysfs 是一个与 /proc 类似的文件系统,但是它的组织更好(从 /proc 中学习了很多教训)。不过 /proc ...转载 2018-08-01 22:04:10 · 92 阅读 · 0 评论 -
蓝牙bluez学习(1) Stack Architecture
Bluez支持的featuresCore Specification 4.2 (GAP, L2CAP, RFCOMM, SDP, GATT) Classic Bluetooth (BR/EDR)Bluetooth Smart (Low Energy)Audio and media (A2DP, AVRCP)Telephony (HFP, HSP)Networking (PAN, 6...原创 2018-08-15 16:02:53 · 1329 阅读 · 0 评论 -
蓝牙学习(2)USB Adapter
主要分析一下蓝牙USB Adapter使用USB接口传输HCI包的实现及过程。 主要包括三部分:Linux USB layer (drivers/usb/*)HCI USB transport driver (drivers/bluetooth/hci_usb.c)BlueZ protocol stack (net/bluetooth/*)(待续)...原创 2018-08-15 23:30:22 · 2153 阅读 · 1 评论 -
树莓派 - MQTT
安装mosquitto下载源代码包 wget http://mosquitto.org/files/source/mosquitto-1.5.tar.gz 解压 tar zxfv mosquitto-1.5.tar.gz 进入目录 cd mosquitto-1.5 编译 make 安装 sudo make installhandle_connect.c:33:25: f...原创 2018-08-08 22:21:11 · 1254 阅读 · 2 评论 -
蓝牙学习(3) Linux kernel部分Bluetooth HCI分析
在上文,https://blog.csdn.net/feiwatson/article/details/81712933中主要理解了在Kernel中USB adapter是如何实现USB设备驱动,以及HCI数据是通过不同的pipes和host通信的。Control pipes are used to transport HCI commands. Interrupt pipes are r...原创 2018-08-16 16:45:27 · 1721 阅读 · 0 评论 -
蓝牙学习(4) -- L2CAP
L2CAP in protocol首先看一下L2CAP在Bluetooth protocol architecture diagram中的位置: Features of L2CAPLogical Link Control and Adaptation Protocol (L2CAP) 主要有如下功能:Segmentation L2CAP层接收的frames最长为64K...原创 2018-08-20 11:41:45 · 626 阅读 · 0 评论 -
蓝牙学习(5) -- sockets
Frames由下图可以看出 - SDU由多个I-frames中的Information Payload组成 - 一个I-frames又拆分成多个HCI data payloadsocket bufferssk_buff原创 2018-08-20 15:06:47 · 224 阅读 · 0 评论 -
proto_ops和proto区别
**proto_ops:**该结构体包含了某个特定的“protocol family"的一系列functions。 其包含的functions和struct proto很类似,但是其在socket层。例如,inet_stream_ops对应SOCK_STREAM, inet_dgram_ops对应SOCK_DGRAM当socket相关的systemcall发生时, 首先从"proto_ops"...原创 2018-09-20 14:35:05 · 1809 阅读 · 0 评论 -
Linux I2C驱动
Linux I2C 驱动结构i2c体系结构由三部分组成i2C core i2c core提供了i2c 总线驱动 和 设备驱动的注册,注销方法i2C bus driver (i2c adapter)i2c device driver原创 2018-08-03 21:26:07 · 190 阅读 · 0 评论 -
树莓派 -- oled 续(2) python
上文中的代码通过wiringPi的API调用devfs API来显示图片。 这里分析的Python代码也通过类似的方法来显示图片。主要用到了两个Library.import spidev import RPi.GPIO as GPIORPi.GPIO在 https://blog.csdn.net/feiwatson/article/details/80790340 大致分析了...原创 2018-07-22 16:34:41 · 749 阅读 · 0 评论 -
树莓派--bcm2835 library (2) 交叉编译BCM2835
按照guide, 执行下面的操作InstallationThis library consists of a single non-shared library and header file, which will be installed in the usual places by make install# download the latest version of the librar...原创 2018-06-23 16:07:37 · 2392 阅读 · 1 评论 -
树莓派 -- bcm2835 library (1)
bcm2835 library提供了user space 操作IO的代码。本文不涉及代码分析,先直观的按照user guide完成操作。1. 在Raspberry中安装bcm2835 library2. build LED test3. run led test从http://www.airspayce.com/mikem/bcm2835/ 下载library库,可以直接在树莓派中下载或者宿主机上...原创 2018-06-23 11:00:44 · 4132 阅读 · 0 评论 -
树莓派 - 通过sysfs操控GPIO
点亮或熄灭LED硬件上,一个LED灯接在pi的Pin-25. 该引脚为BCM的GPIO26$ gpio readall +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | N...原创 2018-06-24 18:24:51 · 1011 阅读 · 0 评论 -
树莓派 - platform总线,设备和驱动
以树莓派为例子,分析一下其中LED的 platform device 和 platform driver.查看LED设备,被挂载在/sys/devices/platform下。注意其中的driver指向, driver -> ../../../bus/platform/drivers/leds-gpiopi@raspberrypi:/sys/devices/platform/leds $ t...原创 2018-06-24 23:19:40 · 1182 阅读 · 0 评论 -
树莓派 - 驱动hello
树莓派上Linux驱动,从hello world 开始 ... hello.c #include <linux/init.h> #include <linux/module.h> #include <linux/moduleparam.h> MODULE_LICENSE("Dual BSD/GPL"); static int hell...原创 2018-06-18 15:53:52 · 296 阅读 · 0 评论 -
leds-gpio driver
leds-gpio driver标签(空格分隔): linux raspberry platform-driver我们还是先看看platform device是如何define的platform device 是如何定义的example1在板级驱动中定义, 通过platform_add_devices()函数将这个platform device注册进系统. ar...原创 2018-07-01 00:49:40 · 771 阅读 · 0 评论 -
leds-gpio driver 续1
在上文中分析了gpio-led platform_device是如何定义并注册的。 那么gpio-led platform_device 和 gpio-led platform_driver是如何匹配的呢我们还是先分析probe函数 drivers\leds\leds-gpio.cstatic int gpio_led_probe(struct platform_device *pde...原创 2018-07-01 00:51:15 · 802 阅读 · 1 评论 -
树莓派 -- 按键 (key)使用BCM2835 gpio library
BCM2835 GPIO library介绍 This is a C library for Raspberry Pi (RPi). It provides access to GPIO and other IO functions on the Broadcom BCM 2835 chip, as used in the RaspberryPi, allowing acces...原创 2018-07-01 16:37:00 · 1969 阅读 · 0 评论 -
树莓派 -- 输入设备驱动 (key)
输入设备(如按键,键盘,触摸屏等)是典型的字符设备,其一般工作原理是底层在按键或触摸等动作发生时产生一个中断,然后CPU通过SPI,I2C总线读取键值。 在这些工作中之后中断和读键值是与设备相关的,而输入事件的缓冲区管理,字符设备驱动的file_operations接口则对输入设备是通用的。因此内核设计了输入子系统,由核心层处理公共的工作。先看gpio-keys platform_drive...原创 2018-07-01 22:13:36 · 2164 阅读 · 0 评论 -
树莓派 -- i2c学习 续(1) DeviceTree Overlay实例化rtc
上文中讨论了通过sysfs来实例化i2c设备 (rtc ds3231) https://blog.csdn.net/feiwatson/article/details/81048616本文继续看看如何通过 DeviceTree Overlays来实例化rtc ds3231write dts首先,写一个dts/dts-v1/;/plugin/;/ { co...原创 2018-07-16 22:17:14 · 2656 阅读 · 0 评论 -
树莓派 -- 输入设备驱动 (key) 续1
测试 安装 input-utilspi@raspberrypi:~ $ sudo apt-get install input-utilsReading package lists... DoneBuilding dependency tree Reading state information... DoneThe following NEW packages will ...原创 2018-07-04 22:47:25 · 374 阅读 · 0 评论 -
树莓派 -- 输入设备驱动 (key) 续2: 转载 Setting up a GPIO-Button “keyboard” on a Raspberry Pi
使用device-tree (DT) overlay应该是更方便的方法:http://blog.gegg.us/2017/01/setting-up-a-gpio-button-keyboard-on-a-raspberry-pi/Back in late 2013, when I wrote the first Version of a raspberry-pi based softwa...转载 2018-07-04 23:07:03 · 502 阅读 · 0 评论 -
树莓派 -- i2c学习
硬件平台RaspberryPi-3B+Pioneer600外扩版i2c芯片为DS3231,adddress 0x68首先来看一下i2ctool的使用i2ctool 使用https://i2c.wiki.kernel.org/index.php/I2C_Tools https://git.kernel.org/pub/scm/utils/i2c-tools/i2c-too...原创 2018-07-14 23:18:48 · 3036 阅读 · 0 评论 -
树莓派 -- oled
硬件SPI0,CE0 SPI Master Driver设备树arch\arm\boot\dts\bcm2710-rpi-3-b.dts&gpio { spi0_pins: spi0_pins { brcm,pins = <9 10 11>; brcm,function = <4>; /* a...原创 2018-07-21 20:57:11 · 1473 阅读 · 0 评论 -
树莓派 -- oled 续(1) wiringPi
在上文中,分析了wiringPi 的oled demo是使用devfs来控制spi master和spi slave通讯。 https://blog.csdn.net/feiwatson/article/details/81149028再详细分析一下demo的OLED SSD1306相关代码。定义一个bufferunsigned char buffer[1024];初始化vo...原创 2018-07-21 21:36:51 · 1160 阅读 · 0 评论 -
树莓派-1 移植内核
上手树莓派想玩点什么。 BLE5.0? AI? python ? 那么先走起来,一步一步开始 ..., 移植linux内核搭建开发环境vmware + ubuntu 16.04下载源码https://github.com/raspberrypi/linuxgit clone --depth=1 https://github.com/raspberrypi/linux.git下载toolhtt...原创 2018-06-16 23:16:24 · 1045 阅读 · 0 评论