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

The source code of this header can be browsed online.

Description  

See also DRIVER_CLASS_IOMUX.

Purpose  

This class provides functions to configure the pin muxing used by a device internal to a chip.

This is mainly intended for use by device drivers: the device_iomux_setup function is called from the device driver initialization function and the device_iomux_cleanup is called when the driver is unloaded.

Using this API to configure IOs used to drive an external device is wrong. The Description class must be used for that purpose.

Members  

Types  

Functions  

  • void device_iomux_cleanup(struct device_s *dev)
  • void device_iomux_cleanup2(struct device_s *dev, struct device_iomux_s *iomux)
  • error_t device_iomux_fetch(struct device_s *dev, struct device_iomux_s *iomux, const char *io_list, iomux_demux_t *demux, iomux_io_id_t *io_id, iomux_config_t *config)
  • struct device_accessor_s * device_iomux_s_base(struct device_iomux_s *x)
  • struct device_iomux_s * device_iomux_s_cast(struct device_accessor_s *x)
  • error_t device_iomux_setup(struct device_s *dev, const char *io_list, iomux_demux_t *demux, iomux_io_id_t *io_id, iomux_config_t *config)
  • error_t device_res_add_iomux(struct device_s *dev, const char *label, iomux_demux_t demux, iomux_io_id_t io_id, iomux_mux_t mux, iomux_config_t config)

Macros  

Members detail  

#define DEV_IOMUX_SETUP(n)  

This macro is declared in device/class/iomux.h source file, line 70.

See also dev_iomux_setup_t.

#define DEV_STATIC_RES_DEV_IOMUX(path_)  

This macro is declared in device/class/iomux.h source file, line 239.

This macro provides a DEV_RES_DEV_PARAM resource entry which specifies the IOMUX device relevant for some DEV_RES_IOMUX entries.

Preprocessor condition: defined( CONFIG_DEVICE_IOMUX )

#define DEV_STATIC_RES_DEV_IOMUX(path_)  

This macro is declared in device/class/iomux.h source file, line 249.

Documentation from alternate declaration:

This macro provides a DEV_RES_DEV_PARAM resource entry which specifies the IOMUX device relevant for some DEV_RES_IOMUX entries.

Preprocessor condition: not defined( CONFIG_DEVICE_IOMUX )

#define DEV_STATIC_RES_IOMUX(label_, demux_, io_id_, mux_, config_)  

This macro is declared in device/class/iomux.h source file, line 224.

This macro specifies a IOMUX resource entry in a static device resources table declaration.

Preprocessor condition: defined( CONFIG_DEVICE_IOMUX )

See also DEV_RES_IOMUX, device_res_add_iomux and DEV_DECLARE_STATIC.

#define DEV_STATIC_RES_IOMUX(label_, demux_, io_id_, mux_, config_)  

This macro is declared in device/class/iomux.h source file, line 243.

Documentation from alternate declaration:

This macro specifies a IOMUX resource entry in a static device resources table declaration.

Preprocessor condition: not defined( CONFIG_DEVICE_IOMUX )

See also DEV_RES_IOMUX, device_res_add_iomux and DEV_DECLARE_STATIC.

#define DRIVER_IOMUX_METHODS(prefix)  

This macro is declared in device/class/iomux.h source file, line 94.

See also struct driver_iomux_s.

#define IOMUX_INVALID_DEMUX  

This macro is declared in device/class/iomux.h source file, line 63.

This is a reserved invalid demux value.

#define IOMUX_INVALID_ID  

This macro is declared in device/class/iomux.h source file, line 65.

This is a reserved invalid io index value.

#define IOMUX_INVALID_MUX  

This macro is declared in device/class/iomux.h source file, line 67.

This is a reserved invalid mux value.

#define __DEVICE_IOMUX_H__  

This macro is declared in device/class/iomux.h source file, line 48.

typedef error_t (dev_iomux_setup_t)(const struct device_iomux_s *accessor, iomux_io_id_t io_id, enum dev_pin_driving_e dir, iomux_mux_t mux, iomux_config_t config)   

This typedef is declared in device/class/iomux.h source file, line 88.

This typedef configures the IO specified by the io_id parameter. The meaning of the config parameter is driver specific.

When the value of the mux parameter is IOMUX_INVALID_MUX, only the direction of the io is updated.

This typedef is called by the device_iomux_fetch and device_iomux_cleanup2 function when a device driver is loaded and unloaded.

It may also be called by a device driver directly in order to dynamically change the direction of a pin.

This declaration involves expansion of the DEV_IOMUX_SETUP macro.

void device_iomux_cleanup(struct device_s *dev)  

This function resets the direction of all IOs found in the resources.

The device must have a DEV_RES_DEV_PARAM resource entry named iomux which specifies the target IO mux controller. This function calls the device_iomux_cleanup2 function.

This is available when CONFIG_DEVICE_IOMUX is defined.

void device_iomux_cleanup2(struct device_s *dev, struct device_iomux_s *iomux)  

This function resets the direction of all IOs found in the resources.

This is available when CONFIG_DEVICE_IOMUX is defined.

See also device_iomux_cleanup.

error_t device_iomux_fetch(struct device_s *dev, struct device_iomux_s *iomux, const char *io_list, iomux_demux_t *demux, iomux_io_id_t *io_id, iomux_config_t *config)  

This function fetches the pin muxing information and optionally sets the muxing configuration of IOs whose names are listed in the io_list string. IO muxing information from device resources are used.

When not NULL, the demux, io_id and config arrays are updated with the associated values from the device resources for listed IOs.

This also calls the dev_iomux_setup_t function of the iomux device driver for each IO in the list unless the parameter is NULL.

The list string must contain space separated label names. All IO labels in the list are required to match available device resources unless the name is suffixed by ?. In this case, the values IOMUX_INVALID_DEMUX and IOMUX_INVALID_ID are stored in the corresponding arrays if no matching label is found in the device tree.

The directions of the IOs are specified using prefix characters attached to labels in the io_list parameter. (see dev_pin_driving_e symbols). A direction prefix can also be used in the device resource label name; this overrides the direction specified in the list.

Example:

device_iomux_fetch(uart, &pv->iomux, ">tx <rx >rts? <cts?", NULL, NULL, NULL);

This is available when CONFIG_DEVICE_IOMUX is defined.

See also device_iomux_setup.

struct device_iomux_s  

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

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

See also DRIVER_CLASS_IOMUX, struct device_accessor_s and Device accessor.

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

struct device_accessor_s * device_iomux_s_base(struct device_iomux_s *x)  

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

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

struct device_iomux_s * device_iomux_s_cast(struct device_accessor_s *x)  

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

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

error_t device_iomux_setup(struct device_s *dev, const char *io_list, iomux_demux_t *demux, iomux_io_id_t *io_id, iomux_config_t *config)  

This function fetches the pin muxing information declared device resources and sets the muxing configuration of IOs whose names are listed in the io_list string.

The device must have a DEV_RES_DEV_PARAM resource entry named iomux which specifies the target IO mux controller. This function calls the device_iomux_fetch function.

Examples  

device_iomux_setup(uart, ">tx <rx >rts? <cts?", NULL, NULL, NULL);

This is available when CONFIG_DEVICE_IOMUX is defined.

See also dev_pin_driving_e.

error_t device_res_add_iomux(struct device_s *dev, const char *label, iomux_demux_t demux, iomux_io_id_t io_id, iomux_mux_t mux, iomux_config_t config)  

This function is declared in device/class/iomux.h source file, line 219.

This function adds an IO mux entry to the device resources list.

This entry can be used along with a DEV_RES_DEV_PARAM resource entry named iomux if an external IO muxing controller is used.

This entry specifies an IO label name along with some IO configuration values:

  • A demux value which selects between multiple wires able to carry the IO signal out of the muxed device.

  • An io_id value relevant to the external muxing device which specifies the index of the selected IO.

  • A mux value relevant to the external muxing device which specifies the selected function for a given IO.

  • A config value which is driver specific. When no external muxing device is in use, the value is reported to the driver of the muxed device. In the other case, the value is reported to the driver of the IO muxing device and 0 is reported to the driver of the muxed device. The default value should be 0 for all drivers.

This is available when CONFIG_DEVICE_IOMUX and CONFIG_DEVICE_RESOURCE_ALLOC are both defined.

See also DEV_RES_IOMUX.

struct driver_iomux_s  

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

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

See also DRIVER_CLASS_IOMUX and struct driver_class_s.

typedef uint32_t iomux_config_t  

This typedef is declared in device/class/iomux.h source file, line 61.

typedef uint8_t iomux_demux_t  

This typedef is declared in device/class/iomux.h source file, line 58.

typedef uint16_t iomux_io_id_t  

This typedef is declared in device/class/iomux.h source file, line 59.

typedef uint32_t iomux_mux_t  

This typedef is declared in device/class/iomux.h source file, line 60.

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