mbed library sources. Supersedes mbed-src. Edited target satm32f446 for user USART3 pins

Dependents:   IGLOO_board

Fork of mbed-dev by mbed official

Committer:
ua1arn
Date:
Mon Jul 30 12:31:10 2018 +0000
Revision:
188:3f10722804f9
Parent:
186:707f6e361f3e
before add multi-configuration USB descriptors

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anna Bridge 186:707f6e361f3e 1 /**
Anna Bridge 186:707f6e361f3e 2 * @file
Anna Bridge 186:707f6e361f3e 3 * @brief Registers, Bit Masks and Bit Positions for the PMU module.
Anna Bridge 186:707f6e361f3e 4 */
Anna Bridge 186:707f6e361f3e 5 /* ****************************************************************************
Anna Bridge 186:707f6e361f3e 6 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
Anna Bridge 186:707f6e361f3e 7 *
Anna Bridge 186:707f6e361f3e 8 * Permission is hereby granted, free of charge, to any person obtaining a
Anna Bridge 186:707f6e361f3e 9 * copy of this software and associated documentation files (the "Software"),
Anna Bridge 186:707f6e361f3e 10 * to deal in the Software without restriction, including without limitation
Anna Bridge 186:707f6e361f3e 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Anna Bridge 186:707f6e361f3e 12 * and/or sell copies of the Software, and to permit persons to whom the
Anna Bridge 186:707f6e361f3e 13 * Software is furnished to do so, subject to the following conditions:
Anna Bridge 186:707f6e361f3e 14 *
Anna Bridge 186:707f6e361f3e 15 * The above copyright notice and this permission notice shall be included
Anna Bridge 186:707f6e361f3e 16 * in all copies or substantial portions of the Software.
Anna Bridge 186:707f6e361f3e 17 *
Anna Bridge 186:707f6e361f3e 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Anna Bridge 186:707f6e361f3e 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Anna Bridge 186:707f6e361f3e 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Anna Bridge 186:707f6e361f3e 21 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Anna Bridge 186:707f6e361f3e 22 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Anna Bridge 186:707f6e361f3e 23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Anna Bridge 186:707f6e361f3e 24 * OTHER DEALINGS IN THE SOFTWARE.
Anna Bridge 186:707f6e361f3e 25 *
Anna Bridge 186:707f6e361f3e 26 * Except as contained in this notice, the name of Maxim Integrated
Anna Bridge 186:707f6e361f3e 27 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Anna Bridge 186:707f6e361f3e 28 * Products, Inc. Branding Policy.
Anna Bridge 186:707f6e361f3e 29 *
Anna Bridge 186:707f6e361f3e 30 * The mere transfer of this software does not imply any licenses
Anna Bridge 186:707f6e361f3e 31 * of trade secrets, proprietary technology, copyrights, patents,
Anna Bridge 186:707f6e361f3e 32 * trademarks, maskwork rights, or any other form of intellectual
Anna Bridge 186:707f6e361f3e 33 * property whatsoever. Maxim Integrated Products, Inc. retains all
Anna Bridge 186:707f6e361f3e 34 * ownership rights.
Anna Bridge 186:707f6e361f3e 35 *
Anna Bridge 186:707f6e361f3e 36 * $Date: 2016-10-10 19:24:21 -0500 (Mon, 10 Oct 2016) $
Anna Bridge 186:707f6e361f3e 37 * $Revision: 24667 $
Anna Bridge 186:707f6e361f3e 38 *
Anna Bridge 186:707f6e361f3e 39 **************************************************************************** */
Anna Bridge 186:707f6e361f3e 40
Anna Bridge 186:707f6e361f3e 41 /* Define to prevent redundant inclusion */
Anna Bridge 186:707f6e361f3e 42 #ifndef _PMU_H_
Anna Bridge 186:707f6e361f3e 43 #define _PMU_H_
Anna Bridge 186:707f6e361f3e 44
Anna Bridge 186:707f6e361f3e 45 /* **** Includes **** */
Anna Bridge 186:707f6e361f3e 46 #include "pmu_regs.h"
Anna Bridge 186:707f6e361f3e 47
Anna Bridge 186:707f6e361f3e 48 #ifdef __cplusplus
Anna Bridge 186:707f6e361f3e 49 extern "C" {
Anna Bridge 186:707f6e361f3e 50 #endif
Anna Bridge 186:707f6e361f3e 51
Anna Bridge 186:707f6e361f3e 52 /**
Anna Bridge 186:707f6e361f3e 53 * @ingroup periphlibs
Anna Bridge 186:707f6e361f3e 54 * @defgroup pmuGroup Peripheral Management Unit
Anna Bridge 186:707f6e361f3e 55 * @brief Peripheral Management Unit (PMU) Interface.
Anna Bridge 186:707f6e361f3e 56 * @{
Anna Bridge 186:707f6e361f3e 57 */
Anna Bridge 186:707f6e361f3e 58
Anna Bridge 186:707f6e361f3e 59 /**
Anna Bridge 186:707f6e361f3e 60 * Enum type for the clock scale used for the PMU timeout clock.
Anna Bridge 186:707f6e361f3e 61 */
Anna Bridge 186:707f6e361f3e 62 typedef enum {
Anna Bridge 186:707f6e361f3e 63 PMU_PS_SEL_DISABLE = MXC_V_PMU_CFG_PS_SEL_DISABLE, /**< Timeout disabled */
Anna Bridge 186:707f6e361f3e 64 PMU_PS_SEL_DIV_2_8 = MXC_V_PMU_CFG_PS_SEL_DIV_2_8, /**< Timeout clk = PMU clock / 2^8 = 256 */
Anna Bridge 186:707f6e361f3e 65 PMU_PS_SEL_DIV_2_16 = MXC_V_PMU_CFG_PS_SEL_DIV_2_16, /**< Timeout clk = PMU clock / 2^16 = 65536 */
Anna Bridge 186:707f6e361f3e 66 PMU_PS_SEL_DIV_2_24 = MXC_V_PMU_CFG_PS_SEL_DIV_2_24 /**< Timeout clk = PMU clock / 2^24 = 16777216 */
Anna Bridge 186:707f6e361f3e 67 }pmu_ps_sel_t;
Anna Bridge 186:707f6e361f3e 68
Anna Bridge 186:707f6e361f3e 69 /**
Anna Bridge 186:707f6e361f3e 70 * Enumeration type for the number of clk ticks for the timeout duration.
Anna Bridge 186:707f6e361f3e 71 */
Anna Bridge 186:707f6e361f3e 72 typedef enum {
Anna Bridge 186:707f6e361f3e 73 PMU_TO_SEL_TICKS_4 = MXC_V_PMU_CFG_TO_SEL_TICKS_4, /**< timeout = 4 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 74 PMU_TO_SEL_TICKS_8 = MXC_V_PMU_CFG_TO_SEL_TICKS_8, /**< timeout = 8 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 75 PMU_TO_SEL_TICKS_16 = MXC_V_PMU_CFG_TO_SEL_TICKS_16, /**< timeout = 16 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 76 PMU_TO_SEL_TICKS_32 = MXC_V_PMU_CFG_TO_SEL_TICKS_32, /**< timeout = 32 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 77 PMU_TO_SEL_TICKS_64 = MXC_V_PMU_CFG_TO_SEL_TICKS_64, /**< timeout = 64 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 78 PMU_TO_SEL_TICKS_128 = MXC_V_PMU_CFG_TO_SEL_TICKS_128, /**< timeout = 128 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 79 PMU_TO_SEL_TICKS_256 = MXC_V_PMU_CFG_TO_SEL_TICKS_256, /**< timeout = 256 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 80 PMU_TO_SEL_TICKS_512 = MXC_V_PMU_CFG_TO_SEL_TICKS_512 /**< timeout = 512 * Timeout clk period */
Anna Bridge 186:707f6e361f3e 81 }pmu_to_sel_t;
Anna Bridge 186:707f6e361f3e 82
Anna Bridge 186:707f6e361f3e 83 /*
Anna Bridge 186:707f6e361f3e 84 * The macros like the one below are designed to help build static PMU programs
Anna Bridge 186:707f6e361f3e 85 * as arrays of 32bit words.
Anna Bridge 186:707f6e361f3e 86 */
Anna Bridge 186:707f6e361f3e 87 #define PMU_IS(interrupt, stop) ((!!interrupt) << PMU_INT_POS) | ((!!stop) << PMU_STOP_POS)
Anna Bridge 186:707f6e361f3e 88 /*
Anna Bridge 186:707f6e361f3e 89 * Structure type to build a PMU Move Op Code.
Anna Bridge 186:707f6e361f3e 90 */
Anna Bridge 186:707f6e361f3e 91 typedef struct pmu_move_des_t {
Anna Bridge 186:707f6e361f3e 92 uint32_t op_code : 3; /* 0x0 */
Anna Bridge 186:707f6e361f3e 93 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 94 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 95 uint32_t read_size : 2;
Anna Bridge 186:707f6e361f3e 96 uint32_t read_inc : 1;
Anna Bridge 186:707f6e361f3e 97 uint32_t write_size : 2;
Anna Bridge 186:707f6e361f3e 98 uint32_t write_inc : 1;
Anna Bridge 186:707f6e361f3e 99 uint32_t cont : 1;
Anna Bridge 186:707f6e361f3e 100 uint32_t length : 20;
Anna Bridge 186:707f6e361f3e 101
Anna Bridge 186:707f6e361f3e 102 uint32_t write_address;
Anna Bridge 186:707f6e361f3e 103 uint32_t read_address;
Anna Bridge 186:707f6e361f3e 104 } pmu_move_des_t;
Anna Bridge 186:707f6e361f3e 105 #define PMU_MOVE(i, s, rs, ri, ws, wi, c, length, wa, ra) \
Anna Bridge 186:707f6e361f3e 106 (PMU_MOVE_OP | PMU_IS(i,s) | ((rs & 3) << PMU_MOVE_READS_POS) | ((!!ri) << PMU_MOVE_READI_POS) | \
Anna Bridge 186:707f6e361f3e 107 ((ws & 3) << PMU_MOVE_WRITES_POS) | ((!!wi) << PMU_MOVE_WRITEI_POS) | ((!!c) << PMU_MOVE_CONT_POS) | ((length & 0xFFFFF) << PMU_MOVE_LEN_POS)), wa, ra
Anna Bridge 186:707f6e361f3e 108
Anna Bridge 186:707f6e361f3e 109 /* new_value = value | (old_value & ~ mask) */
Anna Bridge 186:707f6e361f3e 110 typedef struct pmu_write_des_t {
Anna Bridge 186:707f6e361f3e 111 uint32_t op_code : 3; /* 0x1 */
Anna Bridge 186:707f6e361f3e 112 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 113 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 114 uint32_t : 3;
Anna Bridge 186:707f6e361f3e 115 uint32_t write_method : 4;
Anna Bridge 186:707f6e361f3e 116 uint32_t : 20;
Anna Bridge 186:707f6e361f3e 117
Anna Bridge 186:707f6e361f3e 118 uint32_t write_address;
Anna Bridge 186:707f6e361f3e 119 uint32_t value;
Anna Bridge 186:707f6e361f3e 120 uint32_t mask;
Anna Bridge 186:707f6e361f3e 121 } pmu_write_des_t;
Anna Bridge 186:707f6e361f3e 122 #define PMU_WRITE(i, s, wm, a, v, m) (PMU_WRITE_OP | PMU_IS(i,s) | ((wm & 0xF) << PMU_WRITE_METHOD_POS)), a, v, m
Anna Bridge 186:707f6e361f3e 123
Anna Bridge 186:707f6e361f3e 124 typedef struct pmu_wait_des_t {
Anna Bridge 186:707f6e361f3e 125 uint32_t op_code : 3; /* 0x2 */
Anna Bridge 186:707f6e361f3e 126 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 127 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 128 uint32_t wait : 1;
Anna Bridge 186:707f6e361f3e 129 uint32_t sel : 1;
Anna Bridge 186:707f6e361f3e 130 uint32_t : 25;
Anna Bridge 186:707f6e361f3e 131
Anna Bridge 186:707f6e361f3e 132 uint32_t mask1;
Anna Bridge 186:707f6e361f3e 133 uint32_t mask2;
Anna Bridge 186:707f6e361f3e 134 uint32_t wait_count;
Anna Bridge 186:707f6e361f3e 135 } pmu_wait_des_t;
Anna Bridge 186:707f6e361f3e 136 #define PMU_WAIT(i, s, sel, m1, m2, cnt) (PMU_WAIT_OP | PMU_IS(i,s) | ((cnt>0)?(1<<PMU_WAIT_WAIT_POS):0) | ((!!sel) << PMU_WAIT_SEL_POS)), \
Anna Bridge 186:707f6e361f3e 137 m1, m2, cnt
Anna Bridge 186:707f6e361f3e 138
Anna Bridge 186:707f6e361f3e 139 typedef struct pmu_jump_des_t {
Anna Bridge 186:707f6e361f3e 140 uint32_t op_code : 3; /* 0x3 */
Anna Bridge 186:707f6e361f3e 141 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 142 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 143 uint32_t : 27;
Anna Bridge 186:707f6e361f3e 144
Anna Bridge 186:707f6e361f3e 145 uint32_t address;
Anna Bridge 186:707f6e361f3e 146 } pmu_jump_des_t;
Anna Bridge 186:707f6e361f3e 147 #define PMU_JUMP(i, s, a) (PMU_JUMP_OP | PMU_IS(i,s)), a
Anna Bridge 186:707f6e361f3e 148
Anna Bridge 186:707f6e361f3e 149 typedef struct pmu_loop_des_t {
Anna Bridge 186:707f6e361f3e 150 uint32_t op_code : 3; /* 0x4 */
Anna Bridge 186:707f6e361f3e 151 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 152 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 153 uint32_t sel_counter : 1;
Anna Bridge 186:707f6e361f3e 154 uint32_t : 26;
Anna Bridge 186:707f6e361f3e 155
Anna Bridge 186:707f6e361f3e 156 uint32_t address;
Anna Bridge 186:707f6e361f3e 157 } pmu_loop_des_t;
Anna Bridge 186:707f6e361f3e 158 #define PMU_LOOP(i, s, c, a) (PMU_LOOP_OP | PMU_IS(i,s) | ((!!c) << PMU_LOOP_SEL_COUNTER_POS)), a
Anna Bridge 186:707f6e361f3e 159
Anna Bridge 186:707f6e361f3e 160 typedef struct pmu_poll_des_t {
Anna Bridge 186:707f6e361f3e 161 uint32_t op_code : 3; /* 0x5 */
Anna Bridge 186:707f6e361f3e 162 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 163 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 164 uint32_t : 2;
Anna Bridge 186:707f6e361f3e 165 uint32_t and : 1;
Anna Bridge 186:707f6e361f3e 166 uint32_t : 24;
Anna Bridge 186:707f6e361f3e 167
Anna Bridge 186:707f6e361f3e 168 uint32_t poll_addr;
Anna Bridge 186:707f6e361f3e 169 uint32_t data;
Anna Bridge 186:707f6e361f3e 170 uint32_t mask;
Anna Bridge 186:707f6e361f3e 171 uint32_t poll_interval;
Anna Bridge 186:707f6e361f3e 172 } pmu_poll_des_t;
Anna Bridge 186:707f6e361f3e 173 #define PMU_POLL(i, s, a, adr, d, m, per) (PMU_POLL_OP | PMU_IS(i,s) | ((!!a) << PMU_POLL_AND_POS)), adr, d, m, per
Anna Bridge 186:707f6e361f3e 174
Anna Bridge 186:707f6e361f3e 175 typedef struct pmu_branch_des_t {
Anna Bridge 186:707f6e361f3e 176 uint32_t op_code : 3; /* 0x6 */
Anna Bridge 186:707f6e361f3e 177 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 178 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 179 uint32_t : 2;
Anna Bridge 186:707f6e361f3e 180 uint32_t and : 1;
Anna Bridge 186:707f6e361f3e 181 uint32_t type : 3;
Anna Bridge 186:707f6e361f3e 182 uint32_t : 21;
Anna Bridge 186:707f6e361f3e 183
Anna Bridge 186:707f6e361f3e 184 uint32_t poll_addr;
Anna Bridge 186:707f6e361f3e 185 uint32_t data;
Anna Bridge 186:707f6e361f3e 186 uint32_t mask;
Anna Bridge 186:707f6e361f3e 187 uint32_t address;
Anna Bridge 186:707f6e361f3e 188 } pmu_branch_des_t;
Anna Bridge 186:707f6e361f3e 189 #define PMU_BRANCH(i, s, a, t, adr, d, m, badr) \
Anna Bridge 186:707f6e361f3e 190 (PMU_BRANCH_OP | PMU_IS(i,s) | ((!!a) << PMU_BRANCH_AND_POS)| ((t & 7) << PMU_BRANCH_TYPE_POS)), adr, d, m, badr
Anna Bridge 186:707f6e361f3e 191
Anna Bridge 186:707f6e361f3e 192 typedef struct pmu_transfer_des_t {
Anna Bridge 186:707f6e361f3e 193 uint32_t op_code : 3; /* 0x7 */
Anna Bridge 186:707f6e361f3e 194 uint32_t interrupt : 1;
Anna Bridge 186:707f6e361f3e 195 uint32_t stop : 1;
Anna Bridge 186:707f6e361f3e 196 uint32_t read_size : 2;
Anna Bridge 186:707f6e361f3e 197 uint32_t read_inc : 1;
Anna Bridge 186:707f6e361f3e 198 uint32_t write_size : 2;
Anna Bridge 186:707f6e361f3e 199 uint32_t write_inc : 1;
Anna Bridge 186:707f6e361f3e 200 uint32_t : 1;
Anna Bridge 186:707f6e361f3e 201 uint32_t tx_length : 20;
Anna Bridge 186:707f6e361f3e 202
Anna Bridge 186:707f6e361f3e 203 uint32_t write_address;
Anna Bridge 186:707f6e361f3e 204 uint32_t read_address;
Anna Bridge 186:707f6e361f3e 205
Anna Bridge 186:707f6e361f3e 206 uint32_t int_mask : 25; /* valid int_mask is from 0 - 24 */
Anna Bridge 186:707f6e361f3e 207 uint32_t : 1;
Anna Bridge 186:707f6e361f3e 208 uint32_t burst_size : 6;
Anna Bridge 186:707f6e361f3e 209 } pmu_transfer_des_t;
Anna Bridge 186:707f6e361f3e 210 #define PMU_TRANSFER(i, s, rs, ri, ws, wi, l, wa, ra, imsk, b) \
Anna Bridge 186:707f6e361f3e 211 (PMU_TRANSFER_OP | PMU_IS(i,s) | ((rs & 3) << PMU_TX_READS_POS) | ((!!ri) << PMU_TX_READI_POS) | \
Anna Bridge 186:707f6e361f3e 212 ((ws & 3) << PMU_TX_WRITES_POS) | ((!!wi) << PMU_TX_WRITEI_POS) | ((l & 0xFFFFF) << PMU_TX_LEN_POS)), wa, ra, \
Anna Bridge 186:707f6e361f3e 213 ((imsk) | ((b & 0x3F) << PMU_TX_BS_POS))
Anna Bridge 186:707f6e361f3e 214 /**
Anna Bridge 186:707f6e361f3e 215 * Callback function type for the PMU.
Anna Bridge 186:707f6e361f3e 216 * @details The callback function signature is:
Anna Bridge 186:707f6e361f3e 217 * @code
Anna Bridge 186:707f6e361f3e 218 * void callback(int status);
Anna Bridge 186:707f6e361f3e 219 * @endcode
Anna Bridge 186:707f6e361f3e 220 * @p pmu_status - The callback function argument is a status bit
Anna Bridge 186:707f6e361f3e 221 * indicating the status of the PMU program. The callback function
Anna Bridge 186:707f6e361f3e 222 * will be called for every opcode that has the interrupt bit set.
Anna Bridge 186:707f6e361f3e 223 * If NULL, the channel interrupt will not be enabled.
Anna Bridge 186:707f6e361f3e 224 */
Anna Bridge 186:707f6e361f3e 225 typedef void (*pmu_callback)(int pmu_status);
Anna Bridge 186:707f6e361f3e 226
Anna Bridge 186:707f6e361f3e 227 /**
Anna Bridge 186:707f6e361f3e 228 * @brief Start a PMU program on a channel
Anna Bridge 186:707f6e361f3e 229 *
Anna Bridge 186:707f6e361f3e 230 * @param[in] channel The channel number to start the PMU program.
Anna Bridge 186:707f6e361f3e 231 * @param[in] program_address A pointer to the first opcode of the PMU program.
Anna Bridge 186:707f6e361f3e 232 * @param[in] callback A pointer to the callback function or NULL. See pmu_callback() for details.
Anna Bridge 186:707f6e361f3e 233 *
Anna Bridge 186:707f6e361f3e 234 * @return #E_NO_ERROR if everything is successful, error if unsuccessful.
Anna Bridge 186:707f6e361f3e 235 */
Anna Bridge 186:707f6e361f3e 236 int PMU_Start(unsigned int channel, const void *program_address, pmu_callback callback);
Anna Bridge 186:707f6e361f3e 237
Anna Bridge 186:707f6e361f3e 238 /**
Anna Bridge 186:707f6e361f3e 239 * @brief Set a loop counter value on a channel
Anna Bridge 186:707f6e361f3e 240 * @param channel Channel number to set the value on
Anna Bridge 186:707f6e361f3e 241 * @param counter_num Counter number for the channel (0 or 1)
Anna Bridge 186:707f6e361f3e 242 * @param value Loop count value
Anna Bridge 186:707f6e361f3e 243 * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
Anna Bridge 186:707f6e361f3e 244 */
Anna Bridge 186:707f6e361f3e 245 int PMU_SetCounter(unsigned int channel, unsigned int counter_num, uint16_t value);
Anna Bridge 186:707f6e361f3e 246
Anna Bridge 186:707f6e361f3e 247 /**
Anna Bridge 186:707f6e361f3e 248 * @brief Stop a running channel. This will clear the enable bit on the channel
Anna Bridge 186:707f6e361f3e 249 * and stop the running PMU program at the current opcode. The callback
Anna Bridge 186:707f6e361f3e 250 * function is not called.
Anna Bridge 186:707f6e361f3e 251 * @param channel Channel to stop
Anna Bridge 186:707f6e361f3e 252 */
Anna Bridge 186:707f6e361f3e 253 void PMU_Stop(unsigned int channel);
Anna Bridge 186:707f6e361f3e 254
Anna Bridge 186:707f6e361f3e 255 /**
Anna Bridge 186:707f6e361f3e 256 * @brief Function to handle PMU interrupts. This function can be called from
Anna Bridge 186:707f6e361f3e 257 * the PMU interrupt service routine, or periodically from the
Anna Bridge 186:707f6e361f3e 258 * application if interrupts are not enabled.
Anna Bridge 186:707f6e361f3e 259 */
Anna Bridge 186:707f6e361f3e 260 void PMU_Handler(void);
Anna Bridge 186:707f6e361f3e 261
Anna Bridge 186:707f6e361f3e 262 /**
Anna Bridge 186:707f6e361f3e 263 * @brief Set the AHB bus operation timeout on a channel
Anna Bridge 186:707f6e361f3e 264 * @param channel Selected PMU channel
Anna Bridge 186:707f6e361f3e 265 * @param timeoutClkScale Clk scale use for timeout clk
Anna Bridge 186:707f6e361f3e 266 * @param timeoutTicks Number of ticks for timeout duration
Anna Bridge 186:707f6e361f3e 267 * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
Anna Bridge 186:707f6e361f3e 268 */
Anna Bridge 186:707f6e361f3e 269 int PMU_SetTimeout(unsigned int channel, pmu_ps_sel_t timeoutClkScale, pmu_to_sel_t timeoutTicks);
Anna Bridge 186:707f6e361f3e 270
Anna Bridge 186:707f6e361f3e 271 /**
Anna Bridge 186:707f6e361f3e 272 * @brief Gets the PMU channel's flags
Anna Bridge 186:707f6e361f3e 273 * @param channel Selected PMU channel
Anna Bridge 186:707f6e361f3e 274 * @return 0 = flags not set, non-zero = flags
Anna Bridge 186:707f6e361f3e 275 */
Anna Bridge 186:707f6e361f3e 276 uint32_t PMU_GetFlags(unsigned int channel);
Anna Bridge 186:707f6e361f3e 277
Anna Bridge 186:707f6e361f3e 278 /**
Anna Bridge 186:707f6e361f3e 279 * @brief Clear the PMU channel's flags based on the mask
Anna Bridge 186:707f6e361f3e 280 * @param channel Selected PMU channel
Anna Bridge 186:707f6e361f3e 281 * @param mask bits of the flags to clear
Anna Bridge 186:707f6e361f3e 282 */
Anna Bridge 186:707f6e361f3e 283 void PMU_ClearFlags(unsigned int channel, unsigned int mask);
Anna Bridge 186:707f6e361f3e 284
Anna Bridge 186:707f6e361f3e 285 /**
Anna Bridge 186:707f6e361f3e 286 * @brief Determines if the PMU channel is running
Anna Bridge 186:707f6e361f3e 287 * @param channel Selected PMU channel
Anna Bridge 186:707f6e361f3e 288 * @return 0 - channel is off
Anna Bridge 186:707f6e361f3e 289 * @return non-zero = channel is running
Anna Bridge 186:707f6e361f3e 290 */
Anna Bridge 186:707f6e361f3e 291 uint32_t PMU_IsActive(unsigned int channel);
Anna Bridge 186:707f6e361f3e 292
Anna Bridge 186:707f6e361f3e 293 /**@} end of group pmuGroup*/
Anna Bridge 186:707f6e361f3e 294
Anna Bridge 186:707f6e361f3e 295 #ifdef __cplusplus
Anna Bridge 186:707f6e361f3e 296 }
Anna Bridge 186:707f6e361f3e 297 #endif
Anna Bridge 186:707f6e361f3e 298
Anna Bridge 186:707f6e361f3e 299 #endif /* _PMU_H_ */