匿名
未登录
登录
百问网嵌入式Linux wiki
搜索
查看“LPTIM Linux driver”的源代码
来自百问网嵌入式Linux wiki
名字空间
页面
讨论
更多
更多
页面选项
Read
查看源代码
历史
←
LPTIM Linux driver
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== Article purpose == This article introduces the LPTIM Linux<sup>®</sup> driver for the LPTIM internal peripheral<ref name="LPTIM internal peripheral">[[LPTIM internal peripheral]]</ref>: * Which LPTIM features are supported by the driver * How to configure, use and debug the driver * What is the driver structure, and where the source code can be found. == Short description == The ''LPTIM''<ref name="LPTIM internal peripheral"/> Linux driver (kernel space) is based on the [[PWM overview|PWM]] and [[IIO overview|IIO]] frameworks. It provides several functionalities: '''MFD driver''': * handles common resources (registers, clock) '''PWM driver''': * handles the '''PWM output''' channel (single channel) '''IIO hardware trigger driver''': * handles hardware '''trigger sources''' (synchronously with PWM) for other internal peripherals such as 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> '''IIO counter driver''': * handles the '''quadrature encoder''' interface<ref name="quadrature_encoder">[https://en.wikipedia.org/wiki/Rotary_encoder#Incremental_encoder Incremental encoder overview]</ref> as well as the external event counter. == Configuration == === Kernel configuration === Activate the LPTIM<ref name="LPTIM internal peripheral"/> Linux driver in the kernel configuration using the Linux Menuconfig tool: [[Menuconfig or how to configure kernel]]. Enable the following configurations (as well as their dependencies): * CONFIG_MFD_STM32_LPTIMER * CONFIG_PWM_STM32_LP * CONFIG_IIO_STM32_LPTIMER_TRIGGER * CONFIG_STM32_LPTIMER_CNT <pre> Device Drivers ---> -> Multifunction device drivers ---> <*> Support for STM32 low-power timer -> Pulse-width modulation (PWM) support ---> <*> STMicroelectronics STM32 PWM LP -> Industrial I/O support ---> -> Triggers - standalone ---> <*> STM32 low-power timer trigger -> Counters ---> <*> STM32 low-power timer encoder counter driver </pre> === Device tree === Refer to the [[LPTIM device tree configuration]] article when configuring the LPTIM Linux kernel driver. == 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 LPTIM Linux driver can access LPTIM 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 40009000.timer $ cd 40009000.timer $ cat registers 000: 00000003 004: 00000000 008: 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 LPTIM Linux driver is composed of: * {{CodeSource | Linux kernel | drivers/mfd/stm32-lptimer.c | stm32-lptimer.c driver}} to handle common resources, such as registers and clock. * {{CodeSource | Linux kernel | drivers/pwm/pwm-stm32-lp.c | pwm-stm32-lp.c driver}} to handle PWM channel * {{CodeSource | Linux kernel | drivers/iio/trigger/stm32-lptimer-trigger.c | stm32-lptimer-trigger.c driver}} to handle trigger sources for other internal peripherals * {{CodeSource | Linux kernel | drivers/iio/counter/stm32-lptimer-cnt.c | stm32-lptimer-cnt.c driver}} to handle quadrature encoder and external event counter * {{CodeSource | Linux kernel | include/linux/mfd/stm32-lptimer.h}} and {{CodeSource | Linux kernel | include/linux/iio/timer/stm32-lptim-trigger.h}} header files ==References== <references /> <noinclude> [[Category:Timers|1]] [[Category:IIO]] {{PublicationRequestId | 9230 | 2018-10-16 | AnneJ}} {{ArticleBasedOnModel | Linux driver article model}} </noinclude>
该页面使用的模板:
模板:ArticleBasedOnModel
(
查看源代码
)
模板:CodeSource
(
查看源代码
)
模板:PublicationRequestId
(
查看源代码
)
返回至
LPTIM Linux driver
。
导航
导航
WIKI首页
官方店铺
资料下载
交流社区
所有页面
所有产品
MPU-Linux开发板
MCU-单片机开发板
Linux开发系列视频
单片机开发系列视频
所有模块配件
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志