DEENESPTFRRUARHIKOZHNL

PWM Driver (Pwm)

ModulPwm (PWM Driver)
BSW-Modul-ID121
Standard-Header#include "Pwm.h"
SWS-SpezifikationAUTOSAR_SWS_PWMDriver.pdf
ClusterMicrocontroller Abstraction (MCAL)

Module guideAI-GENERATED

Controls pulse-width-modulated outputs of the microcontroller hardware on a per-channel basis via period and duty cycle.
AI-GENERATED unreviewed Model: claude-opus-5-5 · Effort: high · Temperature: not controllable · Prompt: 346ede702b24 Provenance Open questions (1)
Causal anchor: R20-11 Valid from R20-11 Synthesized for this specification release.
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Controls pulse-width-modulated outputs of the microcontroller hardware on a per-channel basis via period and duty cycle.

As an MCAL module, the PWM driver controls the pulse-width-modulated outputs of the microcontroller on a per-channel basis, accessing its registers directly for this purpose. According to Pwm_Init, Pwm Users set the duty cycle and, for channels with a variable period, also the period. They can switch outputs to the idle state and enable or disable edge notifications [SWS_Pwm_91000]. Optionally, the driver manages two-phase power state transitions via prepare and set. It reports errors such as missing initialization or invalid channels when error detection is active and then performs no action [SWS_Pwm_00201].

The PWM driver is an MCAL module and controls the pulse-width-modulated outputs of the microcontroller via its registers. Therefore, it does not require interfaces of lower-layer modules (SWS PWM Driver p. 44). It is initialized synchronously with Pwm_Init and a pointer to the configuration set [SWS_Pwm_00095], which the ECU State Manager calls as an optional initialization interface (SWS EcuM p. 152). It is typically used by the IoHwAb, for example via a power stage driver (SWS IoHwAb p. 37).

kontext EcuM EcuM (Startup) Pwm Pwm (MCAL-Treiber) EcuM->Pwm Pwm_Init User Pwm User (z. B. IoHwAb / Power-Stage-Treiber) User->Pwm Pwm_SetDutyCycle, Pwm_SetPeriodAndDuty, Pwm_SetOutputToIdle, Pwm_GetOutputState, Pwm_EnableNotification / Pwm_DisableNotification, Power-State-APIs SchM SchM (BSW-Scheduler) SchM->Pwm Pwm_Main_PowerTransitionManager (zyklisch) Pwm->User Pwm_Notification_<#Channel> IoHwAb_Pwm_NotifyReadyForPowerState<#Mode> Det Det Pwm->Det Det_ReportError (optional) HW PWM-Einheit (Mikrocontroller) Pwm->HW direkter Registerzugriff Port Port-Logik / PWM-Pin HW->Port PWM signal (reading point of Pwm_GetOutputState before the port logic)

Context diagram: EcuM initializes the driver, the Pwm User operates it, and the driver reports notifications and errors back. Sources: [SWS_Pwm_00105], [SWS_Pwm_00198], [SWS_Pwm_00104]

Control is performed via a 16-bit duty cycle, where 0x8000 represents 100% (SWS PWM Driver p. 18). The most important services:

  • Pwm_SetDutyCycle changes the duty cycle [SWS_Pwm_91000]. At 0% and 100%, it sets a static level depending on the polarity.
  • Pwm_SetPeriodAndDuty additionally changes the period, but only for channels of class PWM_VARIABLE_PERIOD [SWS_Pwm_00110].
  • Pwm_SetOutputToIdle immediately switches to the idle level [SWS_Pwm_91002].
  • Pwm_GetOutputState reads the internal level [SWS_Pwm_00100].
kanal init after Pwm_Init (configured initial state) mod Modulation (0 % < Tastgrad < 100 %) init->mod Konfiguration: Modulation stat static level (0%: inverse to polarity, 100%: equal to polarity) init->stat Configuration: Low or High mod->mod Pwm_SetPeriodAndDuty (only PWM_VARIABLE_PERIOD) mod->stat Pwm_SetDutyCycle(0x0000 | 0x8000) idle Idle-Zustand (konfigurierter Idle-Pegel) mod->idle Pwm_SetOutputToIdle / Pwm_DeInit stat->mod Pwm_SetDutyCycle(> 0 %, < 100 %) stat->idle Pwm_SetOutputToIdle / Pwm_DeInit idle->mod Pwm_SetPeriodAndDuty (reactivation for variable period)

State diagram: A channel transitions via API between modulation, static level, and idle state. Sources: [SWS_Pwm_91000], [SWS_Pwm_91001], SWS PWM Driver p. 31

Edge notifications are enabled per channel using Pwm_EnableNotification [SWS_Pwm_91004] and arrive as Pwm_Notification_<#Channel> at the Pwm User [SWS_Pwm_00105]. Optionally, the driver also manages power states in two phases. Pwm_PreparePowerState starts the preparation [SWS_Pwm_00183], which the cyclic Pwm_Main_PowerTransitionManager concludes [SWS_Pwm_00189]. After that, Pwm_SetPowerState sets the state [SWS_Pwm_00166].

With active error detection, the functions report errors such as PWM_E_UNINIT, PWM_E_PARAM_CHANNEL, or PWM_E_PERIOD_UNCHANGEABLE [SWS_Pwm_00201] and return without effect (SWS PWM Driver p. 44). In these cases, Pwm_GetOutputState returns PWM_LOW [SWS_Pwm_30051]. If Pwm_SetPowerState is called while the driver is still in use, the runtime error PWM_E_NOT_DISENGAGED [SWS_Pwm_00202] occurs.

Role in the MCAL: Driver between PWM unit and Pwm User

The PWM driver encapsulates the pulse-width-modulated outputs of the microcontroller. As a module of the MCAL layer, it accesses the microcontroller registers directly and therefore does not require interfaces of lower-layer modules (SWS PWM Driver p. 44). For the same reason, it provides no callbacks for lower layers (SWS PWM Driver p. 40) and also offers no service interfaces (SWS PWM Driver p. 44). Its services are available via Pwm.h, such as Pwm_Init [SWS_Pwm_00095], Pwm_SetDutyCycle [SWS_Pwm_91000], and Pwm_GetOutputState [SWS_Pwm_00100]. It imports the standard types Std_ReturnType and Std_VersionInfoType from Std_Types.h [SWS_Pwm_00094].

The ECU State Manager lists Pwm_Init among its optional initialization interfaces (SWS EcuM p. 152). In the power stage use case, an IoHwAb power stage driver calls services of PWM, DIO, and SPI, thereby adjusting voltages and frequencies, among other things (SWS IoHwAb p. 37). In the reverse direction, the driver calls two types of functions: the channel-specific notifications Pwm_Notification_<#Channel> [SWS_Pwm_00105] and, in power management, IoHwAb_Pwm_NotifyReadyForPowerState<#Mode> [SWS_Pwm_00198]. It optionally reports development errors via Det_ReportError [SWS_Pwm_00104]. If the hardware offers different mechanisms for different channels, this is not abstracted via vendor-specific API infixes, but via the channel number (TPS BSWMDT p. 122).

kontext EcuM EcuM (Startup) Pwm Pwm (MCAL-Treiber) EcuM->Pwm Pwm_Init User Pwm User (z. B. IoHwAb / Power-Stage-Treiber) User->Pwm Pwm_SetDutyCycle, Pwm_SetPeriodAndDuty, Pwm_SetOutputToIdle, Pwm_GetOutputState, Pwm_EnableNotification / Pwm_DisableNotification, Power-State-APIs SchM SchM (BSW-Scheduler) SchM->Pwm Pwm_Main_PowerTransitionManager (zyklisch) Pwm->User Pwm_Notification_<#Channel> IoHwAb_Pwm_NotifyReadyForPowerState<#Mode> Det Det Pwm->Det Det_ReportError (optional) HW PWM-Einheit (Mikrocontroller) Pwm->HW direkter Registerzugriff Port Port-Logik / PWM-Pin HW->Port PWM signal (reading point of Pwm_GetOutputState before the port logic)

Context diagram: The Pwm driver is initialized by EcuM and operated by the Pwm User. It is called cyclically by the scheduler, reports notifications to the Pwm User and errors to DET, and controls the PWM unit via its registers. Sources: [SWS_Pwm_00104], [SWS_Pwm_00105], [SWS_Pwm_00189], [SWS_Pwm_00198], SWS EcuM p. 152, SWS IoHwAb p. 37, RS PWM Driver p. 14

Signal model: Period, duty cycle, polarity, and channel classes

A channel is addressed via the numerical identifier Pwm_ChannelType [SWS_Pwm_00106]. The period is of type Pwm_PeriodType, an implementation-specific type with 8 to 32 bits [SWS_Pwm_00107]. Three concepts define the signal (SWS PWM Driver p. 9):

  • The polarity defines the starting level of each period.
  • The duty cycle specifies the proportion of this starting level in the period.
  • The idle state is the initial state after Pwm_SetOutputToIdle or Pwm_DeInit.

The diagram for signal description compares both polarities PWM_HIGH and PWM_LOW (SWS PWM Driver p. 7).

The duty cycle is a 16-bit value. 0x0000 represents 0% and 0x8000 represents 100%. As an implementation aid, the specification mentions AbsoluteDutyCycle = ((uint32)AbsolutePeriodTime * RelativeDutyCycle) >> 15; (SWS PWM Driver p. 18). Accordingly, Pwm_SetDutyCycle and Pwm_SetPeriodAndDuty limit the parameter DutyCycle to Min=0x0000 and Max=0x8000 [SWS_Pwm_91000] [SWS_Pwm_91001].

The channel class Pwm_ChannelClassType defines what a channel may change at runtime [SWS_Pwm_00110]:

  • PWM_VARIABLE_PERIOD: Period and duty cycle can be changed.
  • PWM_FIXED_PERIOD: Only the duty cycle can be changed.
  • PWM_FIXED_PERIOD_SHIFTED: Fixed, shifted period that cannot be changed; only available if supported by hardware.

The diagram for the shifted period shows channels with the same period whose period start is offset by a fixed time in each case (SWS PWM Driver p. 23).

Lifecycle and signal control: from Pwm_Init to idle state

Pwm_Init is synchronous and non-reentrant. With ConfigPtr, the function receives a pointer to the configuration set [SWS_Pwm_00095]. Its type Pwm_ConfigType contains hardware-specific content [SWS_Pwm_00111]. According to the initialization diagram, the outputs are subsequently in low, high, or modulation state depending on the configuration. Notifications occur only after the first call to Pwm_EnableNotification (SWS PWM Driver p. 46). If Pwm_Init is called again on an already initialized driver, the development error PWM_E_ALREADY_INITIALIZED must be reported [SWS_Pwm_50002].

Pwm_DeInit is likewise synchronous and non-reentrant [SWS_Pwm_00096]. The function de-initializes the module, sets the outputs to the idle state, and disables PWM interrupts as well as edge notifications. It can be enabled and disabled via PwmDeInitApi (SWS PWM Driver p. 27). Interpretation: After that, the module should again be considered uninitialized, so that a renewed call to Pwm_Init is permissible. Question Q-a892974ddbe644e0 (open)

lebenszyklus start Start uninit not initialized start->uninit uninit->uninit other API → PWM_E_UNINIT (Pwm_GetOutputState returns PWM_LOW) init initialized (channels according to configuration: low, high, or modulation) uninit->init Pwm_Init(ConfigPtr) init->uninit Pwm_DeInit (outputs idle, interrupts and notifications off) Interpretation: subsequent state init->init Pwm_Init → PWM_E_ALREADY_INITIALIZED

State diagram: Lifecycle of the module with initialization, de-initialization, and errors in case of incorrect call sequence. The return to the “uninitialized” state after Pwm_DeInit is an interpretation. Sources: [SWS_Pwm_00095], [SWS_Pwm_00096], [SWS_Pwm_50002], [SWS_Pwm_20002], [SWS_Pwm_30051], SWS PWM Driver p. 27

During operation, Pwm_SetDutyCycle sets the duty cycle of a channel [SWS_Pwm_91000]. At 0% and 100%, the output is set statically (SWS PWM Driver p. 28):

  • At 0%, the level is inverse to the configured polarity.
  • At 100%, the level corresponds to the polarity.
  • For values in between, modulation takes place according to period, duty cycle, and polarity.

According to the diagram, the driver applies the new duty cycle at the end of the current period if the implementation supports this, otherwise immediately (SWS PWM Driver p. 37).

Pwm_SetPeriodAndDuty sets period and duty cycle together [SWS_Pwm_91001]. Three rules apply here (SWS PWM Driver p. 30):

  • The period is updated at the end of the period if the implementation supports this and it is configured via PwmPeriodUpdatedEndperiod.
  • Glitches at the output must be suppressed.
  • The duty cycle is provided so that frequency and duty cycle match each other.
tastgrad a Call Pwm_SetDutyCycle or Pwm_SetPeriodAndDuty (general checks passed) k Pwm_SetPeriodAndDuty? a->k c Kanalklasse = PWM_VARIABLE_PERIOD? k->c yes d angeforderter Tastgrad? k->d nein (Pwm_SetDutyCycle) e Report PWM_E_PERIOD_UNCHANGEABLE, exit function without action c->e no (if error detection active) p Set period and duty cycle (period at end of period if PwmPeriodUpdatedEndperiod; suppress glitches) c->p yes z Output static: inverse to polarity d->z 0x0000 (0 %) h Output static: equal to polarity d->h 0x8000 (100 %) m Modulation according to period, duty cycle, and polarity d->m dazwischen

Activity diagram: Processing of Pwm_SetDutyCycle and Pwm_SetPeriodAndDuty with verification of channel class and special handling of 0% and 100%. Sources: [SWS_Pwm_40002], SWS PWM Driver p. 28, SWS PWM Driver p. 30, SWS PWM Driver p. 44

Pwm_SetOutputToIdle immediately sets the output to the configured idle state [SWS_Pwm_91002]. Channels with variable period are subsequently re-enabled via Pwm_SetPeriodAndDuty (SWS PWM Driver p. 31). The diagram “Setting Pwm output to idle” shows precisely this sequence (SWS PWM Driver p. 50). Pwm_GetOutputState synchronously reads the internal output state as PWM_HIGH or PWM_LOW [SWS_Pwm_00100] [SWS_Pwm_00108]. A diagram in the requirements specification locates the read value at the output of the PWM unit, i.e., before the port logic and not at the physical pin (RS PWM Driver p. 14).

kanal init after Pwm_Init (configured initial state) mod Modulation (0 % < Tastgrad < 100 %) init->mod Konfiguration: Modulation stat static level (0%: inverse to polarity, 100%: equal to polarity) init->stat Configuration: Low or High mod->mod Pwm_SetPeriodAndDuty (only PWM_VARIABLE_PERIOD) mod->stat Pwm_SetDutyCycle(0x0000 | 0x8000) idle Idle-Zustand (konfigurierter Idle-Pegel) mod->idle Pwm_SetOutputToIdle / Pwm_DeInit stat->mod Pwm_SetDutyCycle(> 0 %, < 100 %) stat->idle Pwm_SetOutputToIdle / Pwm_DeInit idle->mod Pwm_SetPeriodAndDuty (reactivation for variable period)

State diagram: Output states of a channel (modulation, static level, idle) and the APIs switching between them. Sources: [SWS_Pwm_91000], [SWS_Pwm_91001], [SWS_Pwm_91002], SWS PWM Driver p. 28, SWS PWM Driver p. 31, SWS PWM Driver p. 46

Edge notifications per channel

With Pwm_EnableNotification, the Pwm User enables the notification for a channel. The parameter of type Pwm_EdgeNotificationType selects PWM_RISING_EDGE, PWM_FALLING_EDGE, or PWM_BOTH_EDGES [SWS_Pwm_91004] [SWS_Pwm_00109]. The function discards pending interrupts (SWS PWM Driver p. 35). Like Pwm_DisableNotification [SWS_Pwm_91003], it exists only if PwmNotificationSupported is enabled (SWS PWM Driver p. 34).

The driver calls the configured function Pwm_Notification_<#Channel> according to the last call to Pwm_EnableNotification or Pwm_DisableNotification. In doing so, it resets the corresponding interrupt flag (SWS PWM Driver p. 42). The callback has no parameters and is made known via Pwm_Externals.h. Whether it is reentrant depends on the implementation of the Pwm User [SWS_Pwm_00105].

Edge notification of a PWM channelPwm UserPwmPwm_Init(const Pwm_ConfigType*)Pwm_Init()No notification untilersten Pwm_EnableNotificationPwm_EnableNotification(ChannelNumber,PWM_RISING_EDGE | PWM_FALLING_EDGE | PWM_BOTH_EDGES)anstehende Interrupts verwerfenPwm_EnableNotification()loopat each selected edgeReset interrupt flagPwm_Notification_<#Channel>()Pwm_DisableNotification(ChannelNumber)Pwm_DisableNotification()No further notifications

Sequence diagram: Sequence from initialization through enabling and disabling of edge notification up to the absence of further callbacks. Sources: [SWS_Pwm_91004], [SWS_Pwm_91003], [SWS_Pwm_00105], SWS PWM Driver p. 52, SWS PWM Driver p. 42

Power states of the PWM peripheral

The control of power states is an optional feature. It is restricted to the PWM peripheral and requires that the application, mode management, and IoHwAb already satisfy the higher-level constraints (SWS PWM Driver p. 17). If PwmLowPowerStatesSupport is active, the four power state APIs are generated (SWS PWM Driver p. 16). Pwm_PowerStateType recognizes PWM_FULL_POWER (0x00) as well as the range 1..255 for states with decreasing consumption. In R20-11, the type is defined as an enumeration [SWS_Pwm_00197]. A later version, by contrast, lists it as a type derived from uint8 (SWS PWM Driver p. 25).

The power state transition proceeds in two phases:

  1. Pwm_PreparePowerState starts the preparation and provides PWM_SERVICE_ACCEPTED or a rejection reason in the result parameter [SWS_Pwm_00183] [SWS_Pwm_00165]. Whatever cannot be concluded immediately is handled by the cyclically called Pwm_Main_PowerTransitionManager [SWS_Pwm_00189] [SWS_Pwm_00190]. Its call rate is variable, and it sends callbacks only in asynchronous mode (SWS PWM Driver p. 41). The driver reports the completed preparation with IoHwAb_Pwm_NotifyReadyForPowerState<#Mode> [SWS_Pwm_00198].
  2. Pwm_SetPowerState sets the hardware into the prepared state [SWS_Pwm_00166]. Prerequisites such as setting all channels to IDLE and unregistering all notifications must already have been fulfilled by the responsible SWCs, such as the IoHwAb. The function does not execute implicit intermediate states (SWS PWM Driver p. 36).
powerzustand uninit not initialized (result PWM_NOT_INIT) stabil stabil (aktueller = Zielzustand) uninit->stabil Pwm_Init stabil->stabil Pwm_SetPowerState without preparation or prepare with current state → PWM_SEQUENCE_ERROR stabil->stabil not supported / not directly reachable → PWM_POWER_STATE_NOT_SUPP / PWM_TRANS_NOT_POSSIBLE vorb preparation in progress (target ≠ current state) stabil->vorb Pwm_PreparePowerState(PowerState) E_OK / PWM_SERVICE_ACCEPTED (asynchroner Modus) bereit Vorbereitung abgeschlossen stabil->bereit Pwm_PreparePowerState (synchroner Modus) vorb->bereit Pwm_Main_PowerTransitionManager → IoHwAb_Pwm_NotifyReadyForPowerState<#Mode> bereit->stabil Pwm_SetPowerState E_OK (neuer Zustand aktiv)

State diagram: Two-phase power state transition with preparation, completion, and setting, as well as the sequence errors. Sources: [SWS_Pwm_00183], [SWS_Pwm_00166], [SWS_Pwm_00165], [SWS_Pwm_00190], SWS PWM Driver p. 39, SWS IoHwAb p. 61

Pwm_GetCurrentPowerState [SWS_Pwm_00177] returns the current state, Pwm_GetTargetPowerState [SWS_Pwm_00180] the requested one. As long as no transition is in progress, both match (SWS PWM Driver p. 38). The IoHwAb specification shows the interaction of BswM, RTE/SchM, IoHwAb, ADC, and PWM for the asynchronous case (SWS IoHwAb p. 60). In the synchronous case, the preparation is already completed when the preparation API returns (SWS IoHwAb p. 61).

Asynchroner Wechsel in einen Niedrigenergiezustand (vereinfacht)BswMRte / SchMIoHwAbPwmUse Case: Phase 1: VorbereitungRTE/SchMSwitch(...)OnEntryRunnable_LowPowerModeA()IoHwAb_PreparePowerState_LowPowerModeA()Pwm_PreparePowerState(PwrSts_3)E_OK / PWM_SERVICE_ACCEPTEDPreparation continues in the backgroundUse Case: Phase 2: Hintergrundverarbeitungloopbis Vorbereitung abgeschlossenPwm_Main_PowerTransitionManager()IoHwAb_Pwm_NotifyReadyForPowerStateLowPowerModeA()IoHwAb_PollForResults()UpdateModePorts()Use Case: Phase 3: Zustand setzenRTE/SchMSwitch(LowPowerModeA_Transition_End)IoHwAb_EnterPowerStateLP1()Prerequisite: all channels IDLE,Benachrichtigungen abgemeldetPwm_SetPowerState(&Result)E_OK / PWM_SERVICE_ACCEPTEDPwm_GetCurrentPowerState(...)E_OK, CurrentPowerState

Sequence diagram: Asynchronous transition to a low-power state, controlled by the IoHwAb. The sequence is simplified and ADC has been omitted. Sources: [SWS_Pwm_00183], [SWS_Pwm_00189], [SWS_Pwm_00198], [SWS_Pwm_00166], SWS IoHwAb p. 57, SWS IoHwAb p. 60

Configuration, channel containers, and concurrency

Mandatory parameters of a channel are the assigned hardware channel, default values for period and duty cycle, polarity, idle level, and channel class. Phase shift, reference channel, and microcontroller-specific properties are optional, provided the hardware offers them (SWS PWM Driver p. 25). In the configuration model, PwmChannelConfigSet contains at least one PwmChannel, and PwmDutycycleDefault is limited to 0 to 0x8000 (ECUC-Parameter p. 545). PwmChannelClass is mapped to Pwm_ChannelClassType. PwmChannelId is assigned to the symbolic name of the channel container (SWS PWM Driver p. 57).

Optional services are enabled and disabled via configuration: PwmSetOutputToIdle (SWS PWM Driver p. 31), PwmGetOutputState (SWS PWM Driver p. 33), as well as the above-mentioned PwmDeInitApi and PwmNotificationSupported.

The following applies to concurrency:

  • Channel services such as Pwm_SetDutyCycle are reentrant for different channel numbers [SWS_Pwm_91000].
  • The power state APIs are non-reentrant [SWS_Pwm_00183].
  • Configurations with partition assignments that the implementation does not support must be rejected by the module [SWS_Pwm_00203].

The BSW Distribution Guide explains the reentrancy levels up to “multi-core reentrant” (BSW Distribution Guide p. 18).

Behavior in the event of an error

If development error detection is active, the functions report detected errors to the Default Error Tracer. They subsequently skip the requested function so that neither data nor hardware registers are corrupted (SWS PWM Driver p. 44). The error codes are [SWS_Pwm_00201]:

  • PWM_E_INIT_FAILED (0x10)
  • PWM_E_UNINIT (0x11) for calls prior to initialization [SWS_Pwm_20002]
  • PWM_E_PARAM_CHANNEL (0x12) for invalid channels [SWS_Pwm_30002]
  • PWM_E_PERIOD_UNCHANGEABLE (0x13) for period changes on channels with fixed period [SWS_Pwm_40002]
  • PWM_E_ALREADY_INITIALIZED (0x14)
  • PWM_E_PARAM_POINTER (0x15) for a NULL parameter to Pwm_GetVersionInfo

Pwm_GetOutputState must always return a value. Prior to initialization or for an invalid channel, this is PWM_LOW [SWS_Pwm_30051].

pruefung a Call of a channel API det Entwicklungsfehlererkennung aktiv? a->det ini Modul initialisiert? det->ini yes ok Execute service det->ok no ch ChannelNumber valid? ini->ch yes u PWM_E_UNINIT an Det melden ini->u no pc PWM_E_PARAM_CHANNEL an Det melden ch->pc no ch->ok yes skip Exit function without action (Pwm_GetOutputState returns PWM_LOW) u->skip pc->skip

Activity diagram: General checks of the channel APIs with active development error detection, aborting without effect. Sources: [SWS_Pwm_20002], [SWS_Pwm_30002], [SWS_Pwm_30051], SWS PWM Driver p. 44

The power state APIs additionally report errors via Std_ReturnType and the result type Pwm_PowerStateRequestResultType. Possible values are PWM_NOT_INIT, PWM_SEQUENCE_ERROR, PWM_HW_FAILURE, PWM_POWER_STATE_NOT_SUPP, and PWM_TRANS_NOT_POSSIBLE [SWS_Pwm_00165]. For an unsupported state, PWM_E_POWER_STATE_NOT_SUPPORTED is additionally specified [SWS_Pwm_00174]; for a state that cannot be reached directly, PWM_E_TRANSITION_NOT_POSSIBLE [SWS_Pwm_00175].

If Pwm_SetPowerState is called even though channels are still outside IDLE or notifications are registered, the runtime error PWM_E_NOT_DISENGAGED (0x16) occurs [SWS_Pwm_00202] (SWS PWM Driver p. 20). Pwm_Main_PowerTransitionManager simply returns without initialization and deliberately does not report a development error. The reason: Cyclic tasks may run even before initialization is completed (SWS PWM Driver p. 41).

Further detailed evidence

AI-generated guide based on the requirements and document citations provided in the payload for AUTOSAR Classic R20-11. Only the specification is binding.

PWM Driver (Pwm)

Generates pulse-width-modulated signals with configurable duty cycle and period.

Funktionen — Übersicht

Typen — Übersicht

Funktionen & Typen — Detailansicht

function Pwm_Init [SWS_Pwm_00095] 📄 PDF

void Pwm_Init (const Pwm_ConfigType* ConfigPtr);

Service for PWM initialization.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 0770524664d2 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function Pwm_Init serves as the central service for initializing the entire PWM driver ([SWS_Pwm_00095]). It is provided via header file Pwm.h and has the hexadecimal service ID 0x00 ([SWS_Pwm_00095]). As the sole input parameter, ConfigPtr is passed, which acts as a pointer to the driver-specific configuration set of type Pwm_ConfigType ([SWS_Pwm_00095]). The interface has no return value and uses neither output parameters nor input/output parameters ([SWS_Pwm_00095]).

Regarding runtime behavior, Pwm_Init is synchronous and specified as non-reentrant (Non Reentrant) ([SWS_Pwm_00095]). A concurrent or interrupting call to this function from multiple threads, tasks, or interrupt service routines is therefore strictly impermissible. Execution is typically expected to occur once during system startup in the ECU initialization phase prior to further use of the PWM channels. Question Q-ff3f1cf769dfed70 (open)

To safeguard the permissible call sequence, the module monitors its state: If service Pwm_Init is called when the PWM driver is already initialized, the module reports the development error PWM_E_ALREADY_INITIALIZED with the identifier 0x14 ([SWS_Pwm_50002]). Repeated initialization is thus treated as an error.

This text was created by an AI. AUTOSAR specifications are authoritative.

Implementer's Guide to follow (complexity I1)

function Pwm_DeInit [SWS_Pwm_00096] 📄 PDF

void Pwm_DeInit (void);

Service for PWM De - Initialization.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e8e4048754f1 Provenance Open questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Usage and signature

The function Pwm_DeInit serves as a service for de-initializing the PWM driver ([SWS_Pwm_00096]). It is provided via the header file Pwm.h and carries the service ID 0x01 ([SWS_Pwm_00096]). The interface has the signature void Pwm_DeInit(void), accepts neither input nor output parameters, and returns no value to the caller ([SWS_Pwm_00096]).

The call to Pwm_DeInit is executed synchronously ([SWS_Pwm_00096]). The calling control flow thus remains in the function until the de-initialization steps of the PWM module are completed.

Concurrency and Limitations

The following boundary conditions regarding concurrency apply to the execution:

  • Non-reentrant: The service is specified as non-reentrant ([SWS_Pwm_00096]). Simultaneous or interrupting calls from multiple threads, tasks, or ISRs are not permitted.
  • Call context: Due to the synchronous semantics and the lack of reentrancy, the call is likely to take place typically during a controlled shutdown phase at task level. Question Q-f1afc58637cba5cf (open)

Error handling

Neither return values nor specific error codes are defined in the specification of Pwm_DeInit ([SWS_Pwm_00096]). Any runtime or state errors are presumably likely to be logged or caught via module-internal monitoring mechanisms such as the development error tracer (DET), since direct error feedback via the function interface is not provided. Question (open)

This text was automatically generated based on the specification AUTOSAR Classic R20-11.

function Pwm_DisableNotification [SWS_Pwm_91003] 📄 PDF

void Pwm_DisableNotification (Pwm_ChannelType ChannelNumber);

Service to disable the PWM signal edge notification.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2d97fc6435bd Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The function Pwm_DisableNotification serves to disable the edge notification (Signal Edge Notification) of a specific PWM channel [SWS_Pwm_91003]. The function declaration and associated type definitions are provided via the header file Pwm.h [SWS_Pwm_91003].

Parameters and Return Value

The interface has the service ID 0x06 and exhibits the following signature characteristics [SWS_Pwm_91003]:

  • ChannelNumber (in): Numeric identifier of the PWM channel to be configured of type Pwm_ChannelType [SWS_Pwm_91003].

There are neither input/output parameters (inout) nor pure output parameters (out) [SWS_Pwm_91003]. The function returns no return value (void) to the caller [SWS_Pwm_91003].

Synchronization Behavior and Concurrency

The call to Pwm_DisableNotification operates asynchronously [SWS_Pwm_91003]. With respect to multithreading behavior, the service is reentrant as long as different channel numbers are addressed [SWS_Pwm_91003].

Interpretation: Because reentrancy is explicitly restricted to different channels, the function is presumably not reentrant for the same PWM channel [SWS_Pwm_91003]. Question Q-005e97fd25679da7 (open) Simultaneous calls for the identical channel are therefore likely to have to be synchronized against each other on the caller side.

Curated usage notes based on the specification AUTOSAR Classic R20-11.

function Pwm_EnableNotification [SWS_Pwm_91004] 📄 PDF

void Pwm_EnableNotification (Pwm_ChannelType ChannelNumber, Pwm_EdgeNotificationType Notification);

Service to enable the PWM signal edge notification according to notification pa rameter.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 0c9ffc1eca13 Provenance Open questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The function Pwm_EnableNotification serves to enable signal edge notifications for a specific PWM channel according to the passed notification parameter [SWS_Pwm_91004]. The service is provided via the header file Pwm.h, has service ID 0x07, and returns no value (void) to the caller [SWS_Pwm_91004].

When calling the interface, two mandatory input parameters must be passed [SWS_Pwm_91004]:

  • ChannelNumber (of type Pwm_ChannelType): Numeric identifier of the PWM channel to be addressed [SWS_Pwm_91004].
  • Notification (of type Pwm_EdgeNotificationType): Defines the type of edge notification with the permitted values PWM_RISING_EDGE, PWM_FALLING_EDGE, or PWM_BOTH_EDGES [SWS_Pwm_91004].

Semantics and concurrency

The execution of the service is specified as asynchronous [SWS_Pwm_91004]. Regarding concurrency, Pwm_EnableNotification is designed to be reentrant for different channel numbers [SWS_Pwm_91004]. In the event of simultaneous or interrupting access to the same PWM channel, the service is presumably non-reentrant; such a call must therefore be safeguarded on the caller side. Question Q-73309ed8589161a3 (open)

Error Handling and Boundary Conditions

The specification excerpt defines neither specific return values nor error messages for the Development Error Tracer (DET) or the Diagnostic Event Manager (DEM) for this function [SWS_Pwm_91004]. Likewise, specifications regarding permitted call contexts or task-related execution sequences are absent. Since no preconditions are stated, the function call is likely to be permissible only after successful initialization of the PWM driver. Question Q-7f428f59a20175c2 (open)

This usage note was generated automatically based on the specification excerpt of AUTOSAR Classic R20-11.

function Pwm_SetPowerState [SWS_Pwm_00166] 📄 PDF

Std_ReturnType Pwm_SetPowerState (Pwm_PowerStateRequestResultType* Result);

This API configures the Pwm module so that it enters the already prepared power st ate, chosen between a predefined set of configured ones.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: b7532b0354d7 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function Pwm_SetPowerState sets the PWM module to a previously prepared state from a preconfigured selection of power states [SWS_Pwm_00166]. The declaration is available via header Pwm.h [SWS_Pwm_00166].

Usage and return values

The function takes no input parameters and passes the detailed result via the pointer parameter Result of type Pwm_PowerStateRequestResultType* [SWS_Pwm_00166]:

  • If the mode could be changed successfully, the function returns E_OK and sets Result to PWM_SERVICE_ACCEPTED [SWS_Pwm_00166].
  • If the request is rejected, the call returns E_NOT_OK [SWS_Pwm_00166].

Error handling

In case of an error (return value E_NOT_OK), Result specifies the cause of the failure [SWS_Pwm_00166]:

  • PWM_NOT_INIT: The PWM module is not initialized [SWS_Pwm_00166].
  • PWM_SEQUENCE_ERROR: An invalid API call sequence has occurred [SWS_Pwm_00166].
  • PWM_HW_FAILURE: An error in the hardware module prevents entry into the requested power state [SWS_Pwm_00166].

Concurrency and Constraints

Pwm_SetPowerState is non-reentrant (Non Reentrant) and, to avoid a sequence error, requires that the target state was prepared prior to the call [SWS_Pwm_00166].

This text was created by an AI based on the AUTOSAR specification.

Implementer's Guide to follow (complexity I1)

function Pwm_GetCurrentPowerState [SWS_Pwm_00177] 📄 PDF

Std_ReturnType Pwm_GetCurrentPowerState (Pwm_PowerStateType* CurrentPowerState, Pwm_PowerStateRequestResultType* Result);

This API returns the current power state of the PWM HW unit. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_PWMDriver

function Pwm_PreparePowerState [SWS_Pwm_00183] 📄 PDF

Std_ReturnType Pwm_PreparePowerState (Pwm_PowerStateType PowerState, Pwm_PowerStateRequestResultType* Result);

This API starts the needed process to allow the PWM HW module to enter the requested power state. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_PWMDriver

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 50b7f8a853d8 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

use

The synchronous function Pwm_PreparePowerState initiates the required preparation process so that the PWM hardware module can transition into a requested power state [SWS_Pwm_00183]. The desired target state is passed via parameter PowerState, while the detailed result is provided via the output pointer Result [SWS_Pwm_00183]. If the preparation was initiated successfully, the function returns E_OK and sets Result to PWM_SERVICE_ACCEPTED [SWS_Pwm_00183].

Error handling

If the service is rejected, the function returns E_NOT_OK and reports the specific cause via Result [SWS_Pwm_00183]:

  • PWM_NOT_INIT: The PWM module is not initialized [SWS_Pwm_00183].
  • PWM_SEQUENCE_ERROR: Invalid call sequence, as the current power state already corresponds to the target state [SWS_Pwm_00183].
  • PWM_POWER_STATE_NOT_SUPP: The module does not support the requested power state [SWS_Pwm_00183].
  • PWM_TRANS_NOT_POSSIBLE: A direct transition is not possible or the hardware peripheral is still busy [SWS_Pwm_00183].

Concurrency and Interaction

The function is non-reentrant (Non Reentrant) and therefore must not be called concurrently for the same module [SWS_Pwm_00183]. After successful preparation by Pwm_PreparePowerState, downstream actions that do not take effect immediately must be executed to finalize the power state transition [SWS_Pwm_00190].

This usage note was generated automatically based on specification R20-11.

Implementer's Guide to follow (complexity I1)

function Pwm_Main_PowerTransitionManager [SWS_Pwm_00189] 📄 PDF

void Pwm_Main_PowerTransitionManager (void);

This API is cyclically called and supervises the power state transitions, checking for the readiness of the module and issuing the callbacks Io Hw Ab_ Pwm_ Notify Ready For Power State (see Pwm Power State Ready Cb k Ref configuration parameter). AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_PWMDriver

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 879296577e8e Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The interface Pwm_Main_PowerTransitionManager is used for the cyclic monitoring of power state transitions of the PWM driver according to [SWS_Pwm_00189]. It has service ID 0x0d, takes no input parameters, and returns no value (signature void Pwm_Main_PowerTransitionManager(void)).

As part of its cyclic execution, the function checks the operational readiness of the module for the respective power state. As soon as readiness is established, it triggers the notification callbacks IoHwAb_Pwm_NotifyReadyForPowerState<Mode> that are referenced via the configuration parameter PwmPowerStateReadyCbkRef [SWS_Pwm_00189].

The function is intended for a cyclic call context and is provided via the header file SchM_Pwm.h. Consequently, the periodic call is likely to typically occur in the context of the BSW scheduler (Schedule Manager) [SWS_Pwm_00189]. Specific error codes, error handling mechanisms via DET or DEM, and special reentrancy conditions are not defined in the module specification for this service. Question Q-b9b0431e7ccbca88 (open)

This text was generated by an AI based on the AUTOSAR specification R20-11.

Implementer's Guide to follow (complexity I1)

function Pwm_ [SWS_Pwm_00105] 📄 PDF

void Pwm_Notification_<#Channel> (void);

The Pwm module shall call the function Pwm_ Notification_<#Channel> accordingly to the last call of Pwm_ Enable Notification for channel <#Channel>.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 6eff8686a5f4 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The channel-specific notification function Pwm_Notification_<#Channel> is called synchronously by the PWM module as soon as the edge event configured for the respective channel occurs [SWS_Pwm_00105]. The function has the signature void Pwm_Notification_<#Channel>(void), accepts no input parameters, and returns no value [SWS_Pwm_00105]. It is declared in the file Pwm_Externals.h and must be provided by the user [SWS_Pwm_00105].

The call is made depending on the last call to Pwm_EnableNotification for the channel in question [SWS_Pwm_00105]. The triggering events are based on the values of Pwm_EdgeNotificationType, which distinguishes rising (PWM_RISING_EDGE), falling (PWM_FALLING_EDGE), or both signal edges (PWM_BOTH_EDGES) [SWS_Pwm_00109]. Prior to signal generation and event notification, the PWM module must have been initialized via Pwm_Init with a hardware-dependent Pwm_ConfigType structure [SWS_Pwm_00095], [SWS_Pwm_00111].

With regard to concurrency, the reentrancy of the callback function is explicitly defined as user-dependent (PWM user implementation dependant) [SWS_Pwm_00105]. The exact execution context (such as whether the call occurs directly in an interrupt service routine or in task context) is likely to depend on the underlying driver implementation (interpretation). Question Q-327872e0e8fecb37 (open) Specific error codes, return values, or standardized DET or DEM messages do not exist for this notification interface [SWS_Pwm_00105].

This text was created by an AI and is based on the specification AUTOSAR Classic Release R20-11.

function IoHwAb_Pwm_NotifyReadyForPower [SWS_Pwm_00198] 📄 PDF

void IoHwAb_Pwm_NotifyReadyForPowerState<#Mode> (void);

The API shall be invoked by the PWM Driver when the requested power state preparation for mode <#Mode> is completed.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 23b0f44b508d Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The function IoHwAb_Pwm_NotifyReadyForPower (declared in the syntax as IoHwAb_Pwm_NotifyReadyForPowerState<#Mode>) is provided via the header IoHwAb_Pwm.h and serves as a callback interface in AUTOSAR power management [SWS_Pwm_00198].

Regarding usage, interface properties, and system interaction, the following mandatory requirements apply:

  • Usage and call context: The interface has the service ID 0x60 and is executed synchronously [SWS_Pwm_00198]. It must mandatory be called by the PWM driver as soon as the device-side preparation for a requested power state of a mode has been successfully completed [SWS_Pwm_00198].
  • Parameters and return values: The function signature defines neither input, input/output, nor output parameters and has no return value (void) [SWS_Pwm_00198]. Interpretation: The assignment to the respective power mode is likely to be derived directly from the mode-specific function name in the source code. Question Q-ab761160ed91de78 (open)
  • Concurrency and restrictions: The function is specified as non-reentrant (Non Reentrant) [SWS_Pwm_00198]. Calls must consequently not occur in parallel or nested within the same driver context.
  • Interaction: In the cross-module sequence, the call signals to the higher-level I/O hardware abstraction that the driver stage is ready for the transition to the desired operating state [SWS_Pwm_00198].

In the specification sources, no specific error codes or notifications to DET or DEM are provided for this function [SWS_Pwm_00198].

This text was created by an AI; all statements are based exclusively on the AUTOSAR specification.

Implementer's Guide to follow (complexity I1)

type Pwm_OutputStateType [SWS_Pwm_00108] 📄 PDF

Output state of a PWM channel.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 4d670762d069 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The enumeration type Pwm_OutputStateType defines the output state of a PWM channel within the Classic AUTOSAR driver Pwm [SWS_Pwm_00108]. The type definition is provided via the header file Pwm.h for calling software units and driver applications [SWS_Pwm_00108].

The value range of this enumeration distinguishes two uniquely defined states of the channel [SWS_Pwm_00108]:

  • PWM_HIGH (numerical value 0x00): Indicates that the PWM channel in question is in the high state [SWS_Pwm_00108].
  • PWM_LOW (numerical value 0x01): Indicates that the PWM channel in question is in the low state [SWS_Pwm_00108].

Regarding call context and intended use, the element itself as a type does not define any interface functions [SWS_Pwm_00108]. Interpretation: The values are typically likely to serve as parameters or return values in API functions of the module to signal the current or desired logical level state of a channel. Question Q-9c142d658ab7fcfd (open)

Since this is an elementary type definition, no specific error handlings regarding DET or DEM exist, nor are there any requirements for reentrancy or synchronous execution within the specification scope [SWS_Pwm_00108].

This text was generated by an AI based on the specification AUTOSAR Classic R20-11.

Implementer's Guide to follow (complexity I1)

type Pwm_EdgeNotificationType [SWS_Pwm_00109] 📄 PDF

Definition of the type of edge notification of a PWM channel.

type Pwm_ConfigType [SWS_Pwm_00111] 📄 PDF

This is the type of data structure containing the initialization data for the PWM driver.

type Pwm_PowerStateRequestResultType [SWS_Pwm_00165] 📄 PDF

Result of the requests related to power state transitions.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 615a415d7a52 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The enumeration type Pwm_PowerStateRequestResultType provides the result of requests for changing the power management mode (power state transitions) in the PWM driver according to [SWS_Pwm_00165]. The type definition is available via the header Pwm.h [SWS_Pwm_00165].

The type maps both the successful transition and specific error conditions [SWS_Pwm_00165]:

  • PWM_SERVICE_ACCEPTED (0x00): The requested power state change was executed successfully [SWS_Pwm_00165].
  • PWM_NOT_INIT (0x01): The PWM module is not yet initialized [SWS_Pwm_00165].
  • PWM_SEQUENCE_ERROR (0x02): The call sequence of the API is invalid [SWS_Pwm_00165].
  • PWM_HW_FAILURE (0x03): A hardware failure prevents entering the requested power state [SWS_Pwm_00165].
  • PWM_POWER_STATE_NOT_SUPP (0x04): The requested state is not supported by the module [SWS_Pwm_00165].
  • PWM_TRANS_NOT_POSSIBLE (0x05): A direct state transition is not possible or the hardware peripheral is still busy [SWS_Pwm_00165].

Callers must evaluate the result to determine whether a state change took effect immediately. Interpretation: The type is likely to typically serve as the return value or output parameter of corresponding power management functions in order to inform higher-level modules about transition conflicts or hardware blockages. Question Q-fd06829e5c030906 (open)

This text was generated by an AI and serves as guidance. The AUTOSAR specification is authoritative.

Implementer's Guide to follow (complexity I1)

type Pwm_PowerStateType [SWS_Pwm_00197] 📄 PDF

Power state currently active or set as target power state.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: b1411c45ba56 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The enumeration type Pwm_PowerStateType is used in the PWM module to describe power states [SWS_Pwm_00197]. It represents either the currently active operating state or a newly specified target power state of the driver [SWS_Pwm_00197]. This data type is provided via the header file Pwm.h [SWS_Pwm_00197].

The specification defines the following values and value ranges for the enumeration [SWS_Pwm_00197]:

  • PWM_FULL_POWER (value 0x00): Designates the full power state (“Full Power”) [SWS_Pwm_00197].
  • Value range 1..255: Defines graduated power modes with progressively decreasing power consumption (“power modes with decreasing power consumptions”) [SWS_Pwm_00197].

Regarding the usage context, the type is likely to serve as an input parameter when requesting a power-saving mode and as a return value during status queries, since the type represents both active and target states [SWS_Pwm_00197]. Question Q-f0423f8b958d7e91 (open) Specific API functions, error handling (DET/DEM), and concurrency restrictions are not included for this data type in the present specification excerpt and are therefore omitted [SWS_Pwm_00197].

This text was generated by an AI based on the AUTOSAR specification R20-11.

Implementer's Guide to follow (complexity I1)

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/CP_MOD_Pwm
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_Pwm@rel:R20-11#e8f5496f
Content hash
e8f5496f
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_PWMDriver.pdf#nameddest=SWS_Pwm_00095

Initialization and status

Pwm_DeInit function

Service for PWM De - Initialization.

void Pwm_DeInit (void);

Service returns the version information of this module.

void Pwm_GetVersionInfo (Std_VersionInfoType* versioninfo);
Pwm_Init function

Service for PWM initialization.

void Pwm_Init (const Pwm_ConfigType* ConfigPtr);

Services · Set…

Service sets the duty cycle of the PWM channel.

void Pwm_SetDutyCycle (Pwm_ChannelType ChannelNumber, uint16 DutyCycle);

Service sets the PWM output to the configured Idle state.

void Pwm_SetOutputToIdle (Pwm_ChannelType ChannelNumber);

Service sets the period and the duty cycle of a PWM channel

void Pwm_SetPeriodAndDuty (Pwm_ChannelType ChannelNumber, Pwm_PeriodType Period, uint16 DutyCycle);

This API configures the Pwm module so that it enters the already prepared power st ate, chosen between a predefined set of configured ones.

Std_ReturnType Pwm_SetPowerState (Pwm_PowerStateRequestResultType* Result);

Services · Get…

This API returns the current power state of the PWM HW unit. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_PWMDriver

Std_ReturnType Pwm_GetCurrentPowerState (Pwm_PowerStateType* CurrentPowerState, Pwm_PowerStateRequestResultType* Result);

Service to read the internal state of the PWM out put signal.

Pwm_OutputStateType Pwm_GetOutputState (Pwm_ChannelType ChannelNumber);

This API returns the Target power state of the PWM HW unit.

Std_ReturnType Pwm_GetTargetPowerState (Pwm_PowerStateType* TargetPowerState, Pwm_PowerStateRequestResultType* Result);

Services · More

The API shall be invoked by the PWM Driver when the requested power state preparation for mode <#Mode> is completed.

void IoHwAb_Pwm_NotifyReadyForPowerState<#Mode> (void);

Service to disable the PWM signal edge notification.

void Pwm_DisableNotification (Pwm_ChannelType ChannelNumber);

Service to enable the PWM signal edge notification according to notification pa rameter.

void Pwm_EnableNotification (Pwm_ChannelType ChannelNumber, Pwm_EdgeNotificationType Notification);

This API is cyclically called and supervises the power state transitions, checking for the readiness of the module and issuing the callbacks Io Hw Ab_ Pwm_ Notify Ready For Power State (see Pwm Power State Ready Cb k Ref configuration parameter). AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_PWMDriver

void Pwm_Main_PowerTransitionManager (void);

The Pwm module shall call the function Pwm_ Notification_<#Channel> accordingly to the last call of Pwm_ Enable Notification for channel <#Channel>.

void Pwm_Notification_<#Channel> (void);

This API starts the needed process to allow the PWM HW module to enter the requested power state. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_PWMDriver

Std_ReturnType Pwm_PreparePowerState (Pwm_PowerStateType PowerState, Pwm_PowerStateRequestResultType* Result);

Types

Defines the class of a PWM channel

Nume ric identifier of a PWM channel.

This is the type of data structure containing the initialization data for the PWM driver.

Definition of the type of edge notification of a PWM channel.

Output state of a PWM channel.

Definition of the period of a PWM channel.

Result of the requests related to power state transitions.

Power state currently active or set as target power state.