Zephyr support (zephyr)¶
Description¶
The Zephyr module supports code generation for the Zephyr RTOS.
To use the module in inline code generation import it by:
cogeno.import_module('zephyr')
In case you want to use the Zephyr module in another Python project import it by:
import cogeno.modules.zephyr
Cogeno invocation options¶
There are NO Cogeno invocation options.
Code generation functions¶
-
cogeno.modules.zephyr.str2ident(s)¶ Converts ‘s’ to a form suitable for (part of) an identifier.
- Return
identifier
- Parameters
s: string
-
cogeno.modules.zephyr.device_name_by_id(device_id)¶ Get device name from device id.
- Return
device name
- Parameters
device_id: device id
-
cogeno.modules.zephyr.device_declare_single(device_config_symbol, driver_name, device_init, device_pm_control, device_level, device_prio, device_api, device_info, device_defaults={})¶ Declare a single device instance.
Generate device instances code for a device instance that:
match the driver names that
is activated (‘status’ = ‘ok’) in the board device tree file and that is
configured by Kconfig.
The device name is derived from the device tree label property or - if not avalable - the node name.
- Return
True if device is declared, False otherwise
- Parameters
device_config_symbol: A configuration symbol for device instantiation. (e.g. ‘CONFIG_SPI_0’)driver_name: The name this instance of the driver can be looked up from user mode with device_get_binding().device_init: Address to the init function of the driver.device_pm_control: The device power management functiondevice_level: The initialization level at which configuration occurs. Must be one of the following symbols, which are listed in the order they are performed by the kernel:PRE_KERNEL_1: Used for devices that have no dependencies, such as those that rely solely on hardware present in the processor/SOC. These devices cannot use any kernel services during configuration, since they are not yet available.
PRE_KERNEL_2: Used for devices that rely on the initialization of devices initialized as part of the PRE_KERNEL_1 level. These devices cannot use any kernel services during configuration, since they are not yet available.
POST_KERNEL: Used for devices that require kernel services during configuration.
POST_KERNEL_SMP: Used for initialization objects that require kernel services during configuration after SMP initialization
APPLICATION: Used for application components (i.e. non-kernel components) that need automatic configuration. These devices can use all services provided by the kernel during configuration.
device_prio: The initialization priority of the device, relative to other devices of the same initialization level. Specified as an integer value in the range 0 to 99; lower values indicate earlier initialization. Must be a decimal integer literal without leading zeroes or sign (e.g. 32), or an equivalent symbolic name (e.g. #define MY_INIT_PRIO 32 or e.g. CONFIG_KERNEL_INIT_PRIORITY_DEFAULT + 5).device_api: Identifier of the device api. (e.g. ‘spi_stm32_driver_api’)device_info: Device info template for device driver config, data and interrupt initialisation.device_defaults: Device default property values.device_defaultsis a dictionary of property path : property value (e.g. { ‘label’ : ‘My default label’ }).
-
cogeno.modules.zephyr.device_declare_multi(device_config_symbols, driver_names, device_inits, device_pm_controls, device_levels, device_prios, device_api, device_info, device_defaults={})¶ Declare multiple device instances.
Generate device instances code for all device instances that:
match the driver names that
are activated (‘status’ = ‘ok’) in the board device tree file and that are
configured by Kconfig.
- Parameters
device_config_symbols: A list of configuration symbols for device instantiation. (e.g. [‘CONFIG_SPI_0’, ‘CONFIG_SPI_1’])driver_names: A list of driver names for device instantiation. The list shall be ordered as the list of device configs. (e.g. [‘SPI_0’, ‘SPI_1’])device_inits: A list of device initialisation functions or a single function. The list shall be ordered as the list of device configs. (e.g. ‘spi_stm32_init’)device_pm_controls: A list of device power management functions or a single function. The list shall be ordered as the list of device configs. (e.g. ‘device_pm_control_nop’)device_levels: A list of driver initialisation levels or one single level definition. The list shall be ordered as the list of device configs. (e.g. ‘PRE_KERNEL_1’)device_prios: A list of driver initialisation priorities or one single priority definition. The list shall be ordered as the list of device configs. (e.g. 32)device_api: Identifier of the device api. (e.g. ‘spi_stm32_driver_api’)device_info: Device info template for device driver config, data and interrupt initialisation.device_defaults: Device default property values.device_defaultsis a dictionary of property path : property value.