Software APIs
dif_pwm_autogen.h
Go to the documentation of this file.
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
5
6
7
#ifndef OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_PWM_AUTOGEN_H_
8
#define OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_PWM_AUTOGEN_H_
9
10
// THIS FILE HAS BEEN GENERATED, DO NOT EDIT MANUALLY. COMMAND:
11
// util/autogen_dif.py -i hw/top_earlgrey/ip_autogen/pwm/data/pwm.hjson
12
// -o bazel-out/k8-fastbuild/bin/sw/device/lib/dif/autogen
13
14
15
/**
16
* @file
17
* @brief <a href="/book/hw/ip/pwm/">PWM</a> Device Interface Functions
18
*/
19
20
#include <stdbool.h>
21
#include <stdint.h>
22
23
#include "
sw/device/lib/base/macros.h
"
24
#include "
sw/device/lib/base/mmio.h
"
25
#include "
sw/device/lib/dif/dif_base.h
"
26
#include "
dt/dt_pwm.h
"
// Generated.
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
// __cplusplus
31
32
/**
33
* A handle to pwm.
34
*
35
* This type should be treated as opaque by users.
36
*/
37
typedef
struct
dif_pwm
{
38
/**
39
* The base address for the pwm hardware registers.
40
*/
41
mmio_region_t
base_addr
;
42
/**
43
* The instance, set to `kDtPwmCount` if not initialized
44
* through `dif_pwm_init_from_dt`.
45
*/
46
dt_pwm_t
dt
;
47
}
dif_pwm_t
;
48
49
/**
50
* Creates a new handle for a(n) pwm peripheral.
51
*
52
* This function does not actuate the hardware.
53
*
54
* @param base_addr The MMIO base address of the pwm peripheral.
55
* @param[out] pwm Out param for the initialized handle.
56
* @return The result of the operation.
57
*
58
* DEPRECATED This function exists solely for the transition to
59
* dt-based DIFs and will be removed in the future.
60
*/
61
OT_WARN_UNUSED_RESULT
62
dif_result_t
dif_pwm_init
(
63
mmio_region_t
base_addr,
64
dif_pwm_t
*pwm);
65
66
/**
67
* Creates a new handle for a(n) pwm peripheral.
68
*
69
* This function does not actuate the hardware.
70
*
71
* @param dt The devicetable description of the device.
72
* @param[out] pwm Out param for the initialized handle.
73
* @return The result of the operation.
74
*/
75
OT_WARN_UNUSED_RESULT
76
dif_result_t
dif_pwm_init_from_dt
(
77
dt_pwm_t
dt,
78
dif_pwm_t
*pwm);
79
80
/**
81
* Get the DT handle from this DIF.
82
*
83
* If this DIF was initialized by `dif_pwm_init_from_dt(dt, ..)`
84
* then this function will return `dt`. Otherwise it will return an error.
85
*
86
* @param pwm A pwm handle.
87
* @param[out] dt DT handle.
88
* @return `kDifBadArg` if the DIF has no DT information, `kDifOk` otherwise.
89
*/
90
OT_WARN_UNUSED_RESULT
91
dif_result_t
dif_pwm_get_dt
(
92
const
dif_pwm_t
*pwm,
93
dt_pwm_t
*dt);
94
95
/**
96
* A pwm alert type.
97
*/
98
typedef
enum
dif_pwm_alert
{
99
/**
100
* This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
101
*/
102
kDifPwmAlertFatalFault
= 0,
103
}
dif_pwm_alert_t
;
104
105
/**
106
* Forces a particular alert, causing it to be escalated as if the hardware
107
* had raised it.
108
*
109
* @param pwm A pwm handle.
110
* @param alert The alert to force.
111
* @return The result of the operation.
112
*/
113
OT_WARN_UNUSED_RESULT
114
dif_result_t
dif_pwm_alert_force
(
115
const
dif_pwm_t
*pwm,
116
dif_pwm_alert_t
alert);
117
118
119
#ifdef __cplusplus
120
}
// extern "C"
121
#endif
// __cplusplus
122
123
#endif
// OPENTITAN_SW_DEVICE_LIB_DIF_AUTOGEN_DIF_PWM_AUTOGEN_H_
(earlgrey)
sw
device
lib
dif
autogen
dif_pwm_autogen.h
Return to
OpenTitan Documentation