匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“TIM Linux driver”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
TIM Linux driver
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== Article purpose == 本文介绍了用于TIM内部外围设备的TIM Linux<sup>®</sup> 驱动程序<ref name="TIM internal peripheral">[[TIM internal peripheral]]</ref>: * 驱动程序支持哪些TIM功能 * 如何配置,使用和调试驱动程序 * 驱动程序的结构是什么,以及在哪里可以找到源代码。 == Short description == Linux驱动程序(内核空间)“ TIM” <ref name="TIM internal peripheral"/> 基于 [[PWM overview|PWM]] 和 [[IIO overview|IIO]] 框架。 它提供了几种功能: '''MFD驱动程序''': * 处理寄存器,时钟和DMA<ref name="DMA internal peripheral">[[DMA_internal_peripheral]]</ref>资源 * 检测TIM计数器分辨率,例如 16或32位。 '''PWM驱动器''': * 检测TIM通道数。 * 处理'''PWM输出'''通道。 *处理'''PWM捕捉'''通道(输入)。 请注意,PWM捕获依赖于由MFD内核处理的DMA。 '''IIO 驱动程序''': * 处理其他内部外围设备的硬件''触发源''(与PWM同步),例如ADC <ref name="adc_internal">[[ADC internal peripheral]]</ref>, DAC<ref name="dac_internal">[[DAC internal peripheral]]</ref>, DFSDM<ref name="dfsdm_internal">[[DFSDM internal peripheral]]</ref>. * 处理‘正交编码器'''quadrature encoder''' interface<ref>[https://en.wikipedia.org/wiki/Rotary_encoder#Incremental_encoder Incremental encoder] Incremental encoder overview</ref>. == Configuration == === Kernel configuration === 使用Linux Menuconfig工具在内核配置中激活TIM驱动程序<ref name="TIM internal peripheral"/> [[Menuconfig or how to configure kernel]]. 启用以下配置(及其依赖项) * CONFIG_MFD_STM32_TIMERS * CONFIG_PWM_STM32 * CONFIG_IIO_STM32_TIMER_TRIGGER Device Drivers ---> -> Multifunction device drivers ---> <*> Support for STM32 Timers -> Pulse-width modulation (PWM) support ---> <*> STMicroelectronics STM32 PWM -> Industrial I/O support ---> -> Triggers - standalone ---> <*> STM32 timer trigger === Device tree === 配置TIM Linux内核驱动程序时,请参阅[[TIM device tree configuration]] 文章。 == How to use == [[PWM_overview#How_to_use_PWM_with_sysfs_interface|How to use PWM with sysfs interface]] [[How to use the IIO user space interface#How to set up a TIM or LPTIM trigger using the sysfs interface|How to set up a TIM or LPTIM trigger using the sysfs interface]] [[How to use the IIO user space interface#How to use the quadrature encoder with the sysfs interface|How to use the quadrature encoder with the sysfs interface]] == How to trace and debug == The ''TIM''<ref name="TIM internal peripheral"/> Linux driver can access the timer registers through REGMAP. It comes with debugfs<ref name="debugfs">[[Debugfs]]</ref> entries, which allow dumping registers: $ cd /sys/kernel/debug/regmap $ ls 40004000.timer 44000000.timer $ cd 44000000.timer $ cat registers 000: 00000081 004: 00000000 008: 00000000 00c: 00000000 ... It also comes with tracepoints<ref name="ftrace">[[Ftrace]]</ref>: $ cd /sys/kernel/debug/tracing $ cat available_events | grep regmap ... regmap:regmap_reg_read regmap:regmap_reg_write == Source code location == The TIM Linux driver source code is composed of: * {{CodeSource | Linux kernel | drivers/mfd/stm32-timers.c | stm32-timers.c MFD driver}} to handle common resources: registers, clock, dmas. * {{CodeSource | Linux kernel | drivers/pwm/pwm-stm32.c | pwm-stm32.c PWM driver}} to handle PWM channel(s). * {{CodeSource | Linux kernel | drivers/iio/trigger/stm32-timer-trigger.c | stm32-timer-trigger.c IIO driver}} to handle trigger source for other internal peripherals and quadrature encoder interface. * {{CodeSource | Linux kernel | include/linux/mfd/stm32-timers.h}} and {{CodeSource | Linux kernel | include/linux/iio/timer/stm32-timer-trigger.h}} header files ==References== <references /> <noinclude> [[Category:Timers]] [[Category:IIO]] {{PublicationRequestId | 9233 | 2018-10-15 | AnneJ}} {{ArticleBasedOnModel | Linux driver article model}} </noinclude>
该页面使用的模板:
模板:CodeSource
(
查看源代码
)
返回至
TIM Linux driver
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志