38#define PWM_NAME_PREFIX "PWM"
41#define PWM_TYPE_NONE 0
46#define PWM_STATE_DISABLED 0
47#define PWM_STATE_ENABLED 1
49#define PWM_STATE_MAX 1
52#define PWM_FLAG_NONE 0x00000000
53#define PWM_FLAG_GPIO 0x00000001
54#define PWM_FLAG_MODE 0x00000002
55#define PWM_FLAG_RANGE 0x00000004
56#define PWM_FLAG_FREQUENCY 0x00000008
57#define PWM_FLAG_POLARITY 0x00000010
60#define PWM_MODE_MARKSPACE 0
61#define PWM_MODE_BALANCED 1
62#define PWM_MODE_SERIALIZED 2
67#define PWM_POLARITY_NORMAL 0
68#define PWM_POLARITY_INVERSE 1
70#define PWM_POLARITY_MAX 1
struct _DEVICE DEVICE
Definition devices.h:373
#define STDCALL
Definition globaltypes.h:45
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
uint32_t STDCALL pwm_device_get_frequency(PWM_DEVICE *pwm)
Get the clock frequency of the specified PWM device.
uint32_t STDCALL(* pwm_device_stop_proc)(PWM_DEVICE *pwm)
Definition pwm.h:99
PWM_DEVICE *STDCALL pwm_device_find_by_description(const char *description)
uint32_t STDCALL pwm_device_get_gpio(PWM_DEVICE *pwm)
Get the GPIO pin used by the specified PWM device.
uint32_t STDCALL pwm_device_write(PWM_DEVICE *pwm, uint32_t value)
Write a value to the specified PWM device.
uint32_t STDCALL(* pwm_device_get_frequency_proc)(PWM_DEVICE *pwm)
Definition pwm.h:109
uint32_t STDCALL(* pwm_device_set_mode_proc)(PWM_DEVICE *pwm, uint32_t mode)
Definition pwm.h:106
uint32_t STDCALL pwm_type_to_string(uint32_t pwmtype, char *string, uint32_t len)
Convert a PWM type value to a string.
uint32_t STDCALL(* pwm_device_write_proc)(PWM_DEVICE *pwm, uint32_t value)
Definition pwm.h:101
uint32_t STDCALL pwm_mode_to_string(uint32_t pwmmode, char *string, uint32_t len)
Convert a PWM mode value to a string.
uint32_t STDCALL(* pwm_device_set_gpio_proc)(PWM_DEVICE *pwm, uint32_t gpio)
Definition pwm.h:104
uint32_t STDCALL(* pwm_device_get_properties_proc)(PWM_DEVICE *pwm, PWM_PROPERTIES *properties)
Definition pwm.h:116
uint32_t STDCALL pwm_device_set_default(PWM_DEVICE *pwm)
Set the current default PWM device.
uint32_t STDCALL pwm_device_set_polarity(PWM_DEVICE *pwm, uint32_t polarity)
Set the current polarity for the specified PWM device.
uint32_t STDCALL(* pwm_device_set_polarity_proc)(PWM_DEVICE *pwm, uint32_t polarity)
Definition pwm.h:112
uint32_t STDCALL pwm_get_count(void)
Get the current PWM count.
uint32_t STDCALL pwm_device_set_gpio(PWM_DEVICE *pwm, uint32_t gpio)
Set the GPIO pin used by the specified PWM device.
uint32_t STDCALL pwm_device_get_properties(PWM_DEVICE *pwm, PWM_PROPERTIES *properties)
Get the properties for the specified PWM device.
PWM_DEVICE *STDCALL pwm_device_find_by_name(const char *name)
uint32_t STDCALL pwm_device_set_mode(PWM_DEVICE *pwm, uint32_t mode)
Set the current mode for the specified PWM device.
uint32_t STDCALL(* pwm_device_set_frequency_proc)(PWM_DEVICE *pwm, uint32_t frequency)
Definition pwm.h:110
uint32_t STDCALL(* pwm_device_get_range_proc)(PWM_DEVICE *pwm)
Definition pwm.h:107
uint32_t STDCALL(* pwm_device_get_gpio_proc)(PWM_DEVICE *pwm)
Definition pwm.h:103
PWM_DEVICE *STDCALL pwm_device_create_ex(uint32_t size)
Create a new PWM entry.
uint32_t STDCALL(* pwm_device_get_mode_proc)(PWM_DEVICE *pwm)
Definition pwm.h:105
uint32_t STDCALL(* pwm_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition pwm.h:95
PWM_DEVICE *STDCALL pwm_device_get_default(void)
Get the current default PWM device.
PWM_DEVICE *STDCALL pwm_device_create(void)
Create a new PWM entry.
uint32_t STDCALL(* pwm_device_set_range_proc)(PWM_DEVICE *pwm, uint32_t range)
Definition pwm.h:108
uint32_t STDCALL pwm_device_get_range(PWM_DEVICE *pwm)
Get the current range of the specified PWM device.
PWM_DEVICE *STDCALL pwm_device_find(uint32_t pwmid)
uint32_t STDCALL(* pwm_device_get_polarity_proc)(PWM_DEVICE *pwm)
Definition pwm.h:111
uint32_t STDCALL(* pwm_device_configure_proc)(PWM_DEVICE *pwm, uint32_t dutyns, uint32_t periodns)
Definition pwm.h:114
struct _PWM_DEVICE PWM_DEVICE
Definition pwm.h:90
uint32_t STDCALL pwm_device_deregister(PWM_DEVICE *pwm)
Deregister a PWM from the PWM table.
uint32_t STDCALL(* pwm_device_start_proc)(PWM_DEVICE *pwm)
Definition pwm.h:98
uint32_t STDCALL pwm_device_register(PWM_DEVICE *pwm)
Register a new PWM in the PWM table.
uint32_t STDCALL pwm_polarity_to_string(uint32_t pwmpolarity, char *string, uint32_t len)
Convert a PWM polarity value to a string.
uint32_t STDCALL pwm_device_set_range(PWM_DEVICE *pwm, uint32_t range)
Set the current range for the specified PWM device.
uint32_t STDCALL pwm_device_stop(PWM_DEVICE *pwm)
Stop the specified PWM device.
uint32_t STDCALL pwm_device_start(PWM_DEVICE *pwm)
Start the specified PWM device.
uint32_t STDCALL(* pwm_enumerate_cb)(PWM_DEVICE *pwm, void *data)
Definition pwm.h:93
struct _PWM_PROPERTIES PWM_PROPERTIES
Definition pwm.h:75
uint32_t STDCALL pwm_device_properties(PWM_DEVICE *pwm, PWM_PROPERTIES *properties)
Get the properties for the specified PWM device.
uint32_t STDCALL pwm_device_get_polarity(PWM_DEVICE *pwm)
Get the current polarity of the specified PWM device.
uint32_t STDCALL pwm_device_set_frequency(PWM_DEVICE *pwm, uint32_t frequency)
Set the clock frequency for the specified PWM device.
PWM_DEVICE *STDCALL pwm_device_check(PWM_DEVICE *pwm)
Check if the supplied PWM is in the PWM table.
uint32_t STDCALL pwm_device_get_mode(PWM_DEVICE *pwm)
Get the current mode of the specified PWM device.
uint32_t STDCALL pwm_device_notification(PWM_DEVICE *pwm, pwm_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
uint32_t STDCALL pwm_device_enumerate(pwm_enumerate_cb callback, void *data)
uint32_t STDCALL pwm_state_to_string(uint32_t pwmstate, char *string, uint32_t len)
Convert a PWM state value to a string.
uint32_t STDCALL pwm_device_destroy(PWM_DEVICE *pwm)
Destroy an existing PWM entry.
uint32_t STDCALL pwm_device_configure(PWM_DEVICE *pwm, uint32_t dutyns, uint32_t periodns)
Set the configuration of the specified PWM device.
uint32_t periodns
Period Nanonseconds.
Definition pwm.h:153
uint32_t pwmstate
PWM state (eg PWM_STATE_ENABLED).
Definition pwm.h:124
pwm_device_set_frequency_proc devicesetfrequency
A Device specific DeviceSetFrequency method implementing the standard PWM device interface (Or nil if...
Definition pwm.h:135
pwm_device_set_mode_proc devicesetmode
A Device specific DeviceSetMode method implementing the standard PWM device interface (Or nil if the ...
Definition pwm.h:131
pwm_device_configure_proc deviceconfigure
A Device specific DeviceConfigure method implementing the standard PWM device interface (Mandatory).
Definition pwm.h:138
MUTEX_HANDLE lock
Device lock.
Definition pwm.h:146
uint32_t configcount
Definition pwm.h:144
pwm_device_set_polarity_proc devicesetpolarity
A Device specific DeviceSetPolarity method implementing the standard PWM device interface (Or nil if ...
Definition pwm.h:137
pwm_device_get_polarity_proc devicegetpolarity
A Device specific DeviceGetPolarity method implementing the standard PWM device interface (Or nil if ...
Definition pwm.h:136
PWM_DEVICE * next
Next entry in PWM table.
Definition pwm.h:157
uint32_t writecount
Definition pwm.h:143
uint32_t dutyns
Duty Nanoseconds.
Definition pwm.h:152
DEVICE device
The Device entry for this PWM.
Definition pwm.h:121
pwm_device_start_proc devicestart
A Device specific DeviceStart method implementing the standard PWM device interface (Mandatory).
Definition pwm.h:125
uint32_t mode
Device Mode.
Definition pwm.h:148
uint32_t getcount
Definition pwm.h:141
uint32_t range
Device Range.
Definition pwm.h:149
pwm_device_get_frequency_proc devicegetfrequency
A Device specific DeviceGetFrequency method implementing the standard PWM device interface (Or nil if...
Definition pwm.h:134
pwm_device_get_range_proc devicegetrange
A Device specific DeviceGetRange method implementing the standard PWM device interface (Or nil if the...
Definition pwm.h:132
PWM_PROPERTIES properties
Device properties.
Definition pwm.h:154
uint32_t polarity
Output Polarity.
Definition pwm.h:151
uint32_t setcount
Definition pwm.h:142
PWM_DEVICE * prev
Previous entry in PWM table.
Definition pwm.h:156
pwm_device_write_proc devicewrite
A Device specific DeviceWrite method implementing the standard PWM device interface (Mandatory).
Definition pwm.h:127
uint32_t pwmid
Unique Id of this PWM in the PWM table.
Definition pwm.h:123
pwm_device_set_range_proc devicesetrange
A Device specific DeviceSetRange method implementing the standard PWM device interface (Or nil if the...
Definition pwm.h:133
pwm_device_get_properties_proc devicegetproperties
A Device specific DeviceGetProperties method implementing the standard PWM device interface (Or nil i...
Definition pwm.h:139
uint32_t frequency
Clock Frequency.
Definition pwm.h:150
uint32_t gpio
GPIO Pin.
Definition pwm.h:147
pwm_device_get_mode_proc devicegetmode
A Device specific DeviceGetMode method implementing the standard PWM device interface (Or nil if the ...
Definition pwm.h:130
pwm_device_set_gpio_proc devicesetgpio
A Device specific DeviceSetGPIO method implementing the standard PWM device interface (Or nil if the ...
Definition pwm.h:129
pwm_device_stop_proc devicestop
A Device specific DeviceStop method implementing the standard PWM device interface (Mandatory).
Definition pwm.h:126
pwm_device_get_gpio_proc devicegetgpio
A Device specific DeviceGetGPIO method implementing the standard PWM device interface (Or nil if the ...
Definition pwm.h:128
uint32_t periodns
Definition pwm.h:85
uint32_t dutyns
Definition pwm.h:84
uint32_t minperiod
Definition pwm.h:86
uint32_t mode
Definition pwm.h:80
uint32_t range
Definition pwm.h:81
uint32_t flags
Device flags (eg PWM_FLAG_MODE).
Definition pwm.h:78
uint32_t polarity
Definition pwm.h:83
uint32_t frequency
Definition pwm.h:82
uint32_t gpio
Definition pwm.h:79