]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/pwm.9
MFV r346563:
[FreeBSD/FreeBSD.git] / share / man / man9 / pwm.9
1 .\" Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\"    notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\"    notice, this list of conditions and the following disclaimer in the
10 .\"    documentation and/or other materials provided with the distribution.
11 .\"
12 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
13 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
16 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 .\"
23 .\" $FreeBSD$
24 .\"
25 .Dd January 12, 2019
26 .Dt PWM 9
27 .Os
28 .Sh NAME
29 .Nm pwm ,
30 .Nm PWM_GET_BUS ,
31 .Nm PWM_CHANNEL_CONFIG ,
32 .Nm PWM_CHANNEL_GET_CONFIG ,
33 .Nm PWM_CHANNEL_SET_FLAGS ,
34 .Nm PWM_CHANNEL_GET_FLAGS ,
35 .Nm PWM_CHANNEL_ENABLE ,
36 .Nm PWM_CHANNEL_IS_ENABLED ,
37 .Nm PWM_CHANNEL_MAX
38 .Nd PWM methods
39 .Sh SYNOPSIS
40 .Cd "device pwm"
41 .In "pwm_if.h"
42 .Ft device_t
43 .Fn PWM_GET_BUS "device_t dev"
44 .Ft int
45 .Fn PWM_CHANNEL_CONFIG "device_t dev" "int channel" "uint64_t period" "uint64_t duty"
46 .Ft int
47 .Fn PWM_CHANNEL_GET_CONFIG "device_t dev" "int channel" "uint64_t *period" "uint64_t *duty"
48 .Ft int
49 .Fn PWM_CHANNEL_SET_FLAGS "device_t dev" "int channel" "uint32_t flags"
50 .Ft int
51 .Fn PWM_CHANNEL_GET_FLAGS "device_t dev" "int channel" "uint32_t *flags"
52 .Ft int
53 .Fn PWM_CHANNEL_ENABLE "device_t dev" "int channel" "bool enable"
54 .Ft int
55 .Fn PWM_CHANNEL_IS_ENABLED "device_t dev" "int channel" "bool *enabled"
56 .Ft int
57 .Fn PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
58 .Sh DESCRIPTION
59 The PWM (Pulse-Width Modulation) interface allows the device driver to register to a global
60 bus so other devices in the kernel can use them in a generic way.
61 .Sh INTERFACE
62 .Bl -tag -width indent
63 .It Fn PWM_GET_BUS "device_t dev"
64 Return the bus device.
65 .It Fn PWM_CHANNEL_CONFIG "device_t dev" "int channel" "uint64_t period" "uint64_t duty"
66 Configure the period and duty (in nanoseconds) in the PWM controller for the specified channel.
67 Returns 0 on success or
68 .Er EINVAL
69 if the values are not supported by the controller or
70 .Er EBUSY
71 is the PWM controller is in use and does not support changing the value on the fly.
72 .It Fn PWM_CHANNEL_GET_CONFIG "device_t dev" "int channel" "uint64_t *period" "uint64_t *duty"
73 Get the current configuration of the period and duty for the specified channel.
74 .It Fn PWM_CHANNEL_SET_FLAGS "device_t dev" "int channel" "uint32_t flags"
75 Set the flags of the channel (like inverted polarity).
76 .It Fn PWM_CHANNEL_GET_FLAGS "device_t dev" "int channel" "uint32_t *flags"
77 Get the current flags for the channel.
78 .It Fn PWM_CHANNEL_ENABLE "device_t dev" "int channel" "bool enable"
79 Enable the PWM channel.
80 .It Fn PWM_CHANNEL_ISENABLED "device_t dev" "int channel" "bool *enable"
81 Test if the PWM channel is enabled.
82 .It Fn PWM_CHANNEL_MAX "device_t dev" "int channel" "int *nchannel"
83 Get the maximum number of channels supported by the controller.
84 .El
85 .Sh HISTORY
86 The
87 .Nm pwm
88 interface first appeared in
89 .Fx 13.0 .
90 The
91 .Nm pwm
92 interface and manual page was written by
93 .An Emmanuel Vadot Aq Mt manu@FreeBSD.org .