device/class/pwm.h header reference
[Devices support library module]

The source code of this header can be browsed online.

Description  

Members  

Types  

Functions  

Constant  

Macros  

Members detail  

#define DEV_PWM_REQUEST(n)  

This macro is declared in device/class/pwm.h source file, line 115.

See also dev_pwm_config_t.

#define DRIVER_PWM_METHODS(prefix)  

This macro is declared in device/class/pwm.h source file, line 178.

See also struct driver_pwm_s.

#define __DEVICE_PWM_H__  

This macro is declared in device/class/pwm.h source file, line 32.

struct dev_pwm_config_s  

This struct is declared in device/class/pwm.h source file, line 84.

FieldDescription
struct dev_freq_s freq;
struct dev_freq_ratio_s duty;
enum dev_pwm_polarity_e pol;

enum dev_pwm_mask_e  

This enum is declared in device/class/pwm.h source file, line 69.

IdentifierDescription
DEV_PWM_MASK_NONE
DEV_PWM_MASK_FREQ
DEV_PWM_MASK_DUTY
DEV_PWM_MASK_POL

const char dev_pwm_polarity_e[]  

This variable is declared in ENUM_DESCRIPTOR function like macro expansion, line 1 in device/class/pwm.h source file, line 54.

PWM polarity.

Alternate declarations with same identifier: [1], [2].

enum dev_pwm_polarity_e  

This enum is declared in device/class/pwm.h source file, line 57.

Alternate declarations with same identifier: [1], [2].

IdentifierDescription
DEV_PWM_POL_HIGH
DEV_PWM_POL_LOW

typedef void (dev_pwm_request_t)(const struct device_pwm_s *pdev, struct dev_pwm_rq_s *rq)   

This typedef is declared in device/class/pwm.h source file, line 172.

This typedef configures some PWM channels. The first channel to configure is identified by the device accessor number. Subsequent channels with a configuration specified in the cfg array of the request are selected by the chan_mask field. The least significant bit of the mask corresponds to the API instance number given by the accessor and must be set. The size of the array must match the number of bits set in the chan_mask field.

The dev_pwm_rq_s::mask field selects the parameters that are updated. A single call to this typedef, can set the configuration of multiple channels atomically if this is supported by the the hardware.

Depending on the hardware design, some parameters may be shared between channels. This is usually the case for the frequency parameters. The configuration of all started channels with a shared parameter must be updated at the same time. A channel is considered started when it's duty cycle is neither 0 nor 1. In any case, if the value of a shared parameter is not updated simultaneously for all started channels, the -ENOTSUP error is reported.

The duty cycle of channels is set to 0 when the driver is initialized. The device_start function can be called in order to keep the internal counter running when channels are not started.

The kr is executed upon completion. In case of error, the dev_request_s::kr kroutine is called with the error field set appropriately. If at least one error condition is detected for a single channel no configuration is performed at all on other channels.

Error values
Error
description
0
Success
-ECANCELED
New configuration requested while previous one is not completed
-ENOTSUP
Conflict on shared parameter
-ERANGE
Configuration can not be achieved

The kroutine of the request may be executed from within this function. Please read Nested device request completion.

This declaration involves expansion of the DEV_PWM_REQUEST macro.

void dev_pwm_rq_done(struct dev_pwm_rq_s *rq)  

This function is declared in device/class/pwm.h source file, line 113.

This function invokes or schedules execution of the pwm request callback associated to the request. For use in device drivers.

struct dev_pwm_rq_s * dev_pwm_rq_from_kr(struct kroutine_s *kr)  

This function is declared in device/class/pwm.h source file, line 113.

This function retrieves a pointer to the request when in the request completion callback routine.

struct dev_pwm_rq_s * dev_pwm_rq_head(dev_request_queue_root_t *q)  

This function is declared in device/class/pwm.h source file, line 113.

This function returns the oldest pwm request in the given queue. A NULL pointer is returned if the queue is empty. For use in device drivers.

void dev_pwm_rq_init(struct dev_pwm_rq_s *rq, kroutine_exec_t *exec)  

This function is declared in device/class/pwm.h source file, line 113.

This function initializes the given pwm request callback. This must be used before submitting the request to a driver.

This is available when CONFIG_MUTEK_KROUTINE_SCHED is defined.

void dev_pwm_rq_init_immediate(struct dev_pwm_rq_s *rq, kroutine_exec_t *exec)  

This function is declared in device/class/pwm.h source file, line 113.

This function initializes the given pwm request callback. This must be used before submitting the request to a driver.

void dev_pwm_rq_init_queue(struct dev_pwm_rq_s *rq, kroutine_exec_t *exec, struct kroutine_queue_s *queue)  

This function is declared in device/class/pwm.h source file, line 113.

This function initializes the given pwm request callback. This must be used before submitting the request to a driver.

This is available when CONFIG_MUTEK_KROUTINE_QUEUE is defined.

void dev_pwm_rq_init_seq(struct dev_pwm_rq_s *rq, kroutine_exec_t *exec, struct kroutine_sequence_s *seq)  

This function is declared in device/class/pwm.h source file, line 113.

This function initializes the given pwm request callback. This must be used before submitting the request to a driver.

This is available when CONFIG_MUTEK_KROUTINE_SCHED is defined.

struct dev_pwm_rq_s * dev_pwm_rq_pop(dev_request_queue_root_t *q)  

This function is declared in device/class/pwm.h source file, line 113.

This function removes and return the oldest pwm request in the queue. A NULL pointer is returned if the queue is empty. For use in device drivers.

void dev_pwm_rq_pushback(dev_request_queue_root_t *q, struct dev_pwm_rq_s *rq)  

This function is declared in device/class/pwm.h source file, line 113.

This function insert a new pwm request at the end of the given queue. For use in device drivers.

void dev_pwm_rq_remove(dev_request_queue_root_t *q, struct dev_pwm_rq_s *rq)  

This function is declared in device/class/pwm.h source file, line 113.

This function removes the specified pwm request from the queue. For use in device drivers.

struct dev_pwm_rq_s  

This struct is declared in device/class/pwm.h source file, line 96.

FieldDescription
union <anonymous> {
struct dev_request_s base;
typeof(struct dev_request_s::error) error;
typeof(struct dev_request_s::pvdata) pvdata;
};
const struct dev_pwm_config_s * cfg;
uint32_t chan_mask;
uint_fast8_t mask;

struct dev_request_s * dev_pwm_rq_s_base(struct dev_pwm_rq_s *x)  

struct dev_pwm_rq_s * dev_pwm_rq_s_cast(struct dev_request_s *x)  

error_t dev_pwm_wait_op(const struct device_pwm_s *acc, const struct dev_pwm_config_s *cfg, uint_fast8_t mask)  

This function is declared in device/class/pwm.h source file, line 206.

This function configures the PWM devices and blocks until the configuration is effective or an error occured.

If the configuration cannot be applied, the function returns an error code.

Parameter list:

  • pdev: a pwm device accessor pointing to a pwm channel.
  • cfg: the configuration to apply to the pwm channel.
  • mask: a bitmask defining which configuration fields to consider.

This is available when CONFIG_DEVICE_PWM and CONFIG_MUTEK_CONTEXT_SCHED are both defined.

error_t dev_pwm_wait_rq(const struct device_pwm_s *acc, struct dev_pwm_rq_s *rq)  

This function is declared in device/class/pwm.h source file, line 185.

This function use the scheduler api to put current context in wait state during the request. This can only be called from a scheduler context.

This is available when CONFIG_MUTEK_CONTEXT_SCHED is defined.

struct device_pwm_s  

This struct is declared in DRIVER_CLASS_TYPES function like macro expansion, line 18 in device/class/pwm.h source file, line 176.

This struct is the device accessor object type for the pwm device class. This accessor must be initialized by calling the device_get_accessor function.

See also DRIVER_CLASS_PWM, struct device_accessor_s and Device accessor.

FieldDescription
union <anonymous> {
struct device_accessor_s base;
struct <anonymous> {
struct device_s * dev;
struct driver_pwm_s * api;
uint_fast8_t number;
};
};

struct device_accessor_s * device_pwm_s_base(struct device_pwm_s *x)  

This function is declared in DRIVER_CLASS_TYPES function like macro expansion, line 39 in device/class/pwm.h source file, line 176.

This function casts a pwm device accessor to a generic device accessor

struct device_pwm_s * device_pwm_s_cast(struct device_accessor_s *x)  

This function is declared in DRIVER_CLASS_TYPES function like macro expansion, line 32 in device/class/pwm.h source file, line 176.

This function casts a generic device accessor to a pwm device accessor

struct driver_pwm_s  

This struct is declared in DRIVER_CLASS_TYPES function like macro expansion, line 5 in device/class/pwm.h source file, line 176.

This struct is the driver API descriptor for the pwm device class.

See also DRIVER_CLASS_PWM and struct driver_class_s.

Valid XHTML 1.0 StrictGenerated by diaxen on Wed Oct 17 21:18:38 2018 using MkDoc