Developer World
Spresense SDK Library v3.2.0-ebc0364
cxd56_power.h
1/****************************************************************************
2 * boards/arm/cxd56xx/spresense/include/cxd56_power.h
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership. The
7 * ASF licenses this file to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance with the
9 * License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 * License for the specific language governing permissions and limitations
17 * under the License.
18 *
19 ****************************************************************************/
20
21#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_POWER_H
22#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_POWER_H
23
24/****************************************************************************
25 * Included Files
26 ****************************************************************************/
27
28#include <nuttx/config.h>
29
30#include <stdbool.h>
31
32/****************************************************************************
33 * Public Types
34 ****************************************************************************/
35
36#ifndef __ASSEMBLY__
37
38/****************************************************************************
39 * Public Data
40 ****************************************************************************/
41
42#undef EXTERN
43#if defined(__cplusplus)
44#define EXTERN extern "C"
45extern "C"
46{
47#else
48#define EXTERN extern
49#endif
50
51/****************************************************************************
52 * Public Function Prototypes
53 ****************************************************************************/
54
55/****************************************************************************
56 * Name: board_pmic_read
57 *
58 * Description:
59 * Read the value from the specified sub address
60 *
61 * Input Parameter:
62 * addr - sub address
63 * buf - pointer to read buffer
64 * size - byte count of read
65 *
66 * Returned Value:
67 * Return 0 on success. Otherwise, return a negated errno.
68 *
69 ****************************************************************************/
70
71int board_pmic_read(uint8_t addr, void *buf, uint32_t size);
72
73/****************************************************************************
74 * Name: board_pmic_write
75 *
76 * Description:
77 * Write the value to the specified sub address
78 *
79 * Input Parameter:
80 * addr - sub address
81 * buf - pointer to write buffer
82 * size - byte count of write
83 *
84 * Returned Value:
85 * Return 0 on success. Otherwise, return a negated errno.
86 *
87 ****************************************************************************/
88
89int board_pmic_write(uint8_t addr, void *buf, uint32_t size);
90
91/****************************************************************************
92 * Name: board_power_setup
93 *
94 * Description:
95 * Initial setup for board-specific power control
96 *
97 ****************************************************************************/
98
99int board_power_setup(int status);
100
101/****************************************************************************
102 * Name: board_power_control
103 *
104 * Description:
105 * Power on/off the device on the board.
106 *
107 ****************************************************************************/
108
109int board_power_control(int target, bool en);
110
111/****************************************************************************
112 * Name: board_power_control_tristate
113 *
114 * Description:
115 * Power on/off/HiZ the device on the board.
116 * (HiZ is available only for PMIC_TYPE_GPO.)
117 *
118 * Input Parameter:
119 * target : PMIC channel
120 * value : 1 (ON), 0 (OFF), -1(HiZ)
121 *
122 * Returned Value:
123 * 0 on success, else a negative error code
124 *
125 ****************************************************************************/
126
127int board_power_control_tristate(int target, int value);
128
129/****************************************************************************
130 * Name: board_power_monitor
131 *
132 * Description:
133 * Get status of Power on/off the device on the board.
134 *
135 ****************************************************************************/
136
137bool board_power_monitor(int target);
138
139/****************************************************************************
140 * Name: board_power_monitor_tristate
141 *
142 * Description:
143 * Get status of Power on/off/HiZ the device on the board.
144 *
145 * Input Parameter:
146 * target : PMIC channel
147 *
148 * Returned Value:
149 * 1 (ON), 0 (OFF), -1(HiZ)
150 *
151 ****************************************************************************/
152
153int board_power_monitor_tristate(int target);
154
155/****************************************************************************
156 * Name: board_flash_power_control
157 *
158 * Description:
159 * Power on/off the flash device on the board.
160 *
161 ****************************************************************************/
162
163int board_flash_power_control(bool en);
164
165/****************************************************************************
166 * Name: board_flash_power_monitor
167 *
168 * Description:
169 * Get status of Power on/off the flash device on the board.
170 *
171 ****************************************************************************/
172
173bool board_flash_power_monitor(void);
174
175/****************************************************************************
176 * Name: board_xtal_power_control
177 *
178 * Description:
179 * Power on/off the Xtal device on the board.
180 *
181 ****************************************************************************/
182
183int board_xtal_power_control(bool en);
184
185/****************************************************************************
186 * Name: board_xtal_power_monitor
187 *
188 * Description:
189 * Get status of Power on/off the Xtal device on the board.
190 *
191 ****************************************************************************/
192
193bool board_xtal_power_monitor(void);
194
195/****************************************************************************
196 * Name: board_lna_power_control
197 *
198 * Description:
199 * Power on/off the LNA device on the board.
200 *
201 ****************************************************************************/
202
203int board_lna_power_control(bool en);
204
205/****************************************************************************
206 * Name: board_set_reset_gpo
207 *
208 * Description:
209 * Set gpo to off when power off the board.
210 *
211 ****************************************************************************/
212
213int board_set_reset_gpo(int target);
214
215/****************************************************************************
216 * Name: board_unset_reset_gpo
217 *
218 * Description:
219 * Keep gpo status when power off the board.
220 *
221 ****************************************************************************/
222
223int board_unset_reset_gpo(int target);
224
225#undef EXTERN
226#if defined(__cplusplus)
227}
228#endif
229
230#endif /* __ASSEMBLY__ */
231#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_POWER_H */