The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

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