mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

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

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
507:d4fc7603a669
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 507:d4fc7603a669 1 /*******************************************************************************
mbed_official 507:d4fc7603a669 2 * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
mbed_official 507:d4fc7603a669 3 *
mbed_official 507:d4fc7603a669 4 * Permission is hereby granted, free of charge, to any person obtaining a
mbed_official 507:d4fc7603a669 5 * copy of this software and associated documentation files (the "Software"),
mbed_official 507:d4fc7603a669 6 * to deal in the Software without restriction, including without limitation
mbed_official 507:d4fc7603a669 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
mbed_official 507:d4fc7603a669 8 * and/or sell copies of the Software, and to permit persons to whom the
mbed_official 507:d4fc7603a669 9 * Software is furnished to do so, subject to the following conditions:
mbed_official 507:d4fc7603a669 10 *
mbed_official 507:d4fc7603a669 11 * The above copyright notice and this permission notice shall be included
mbed_official 507:d4fc7603a669 12 * in all copies or substantial portions of the Software.
mbed_official 507:d4fc7603a669 13 *
mbed_official 507:d4fc7603a669 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
mbed_official 507:d4fc7603a669 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
mbed_official 507:d4fc7603a669 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
mbed_official 507:d4fc7603a669 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
mbed_official 507:d4fc7603a669 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
mbed_official 507:d4fc7603a669 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
mbed_official 507:d4fc7603a669 20 * OTHER DEALINGS IN THE SOFTWARE.
mbed_official 507:d4fc7603a669 21 *
mbed_official 507:d4fc7603a669 22 * Except as contained in this notice, the name of Maxim Integrated
mbed_official 507:d4fc7603a669 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
mbed_official 507:d4fc7603a669 24 * Products, Inc. Branding Policy.
mbed_official 507:d4fc7603a669 25 *
mbed_official 507:d4fc7603a669 26 * The mere transfer of this software does not imply any licenses
mbed_official 507:d4fc7603a669 27 * of trade secrets, proprietary technology, copyrights, patents,
mbed_official 507:d4fc7603a669 28 * trademarks, maskwork rights, or any other form of intellectual
mbed_official 507:d4fc7603a669 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
mbed_official 507:d4fc7603a669 30 * ownership rights.
mbed_official 507:d4fc7603a669 31 *******************************************************************************
mbed_official 507:d4fc7603a669 32 */
mbed_official 507:d4fc7603a669 33
mbed_official 507:d4fc7603a669 34 #ifndef _MXC_TMR_REGS_H
mbed_official 507:d4fc7603a669 35 #define _MXC_TMR_REGS_H
mbed_official 507:d4fc7603a669 36
mbed_official 507:d4fc7603a669 37 #ifdef __cplusplus
mbed_official 507:d4fc7603a669 38 extern "C" {
mbed_official 507:d4fc7603a669 39 #endif
mbed_official 507:d4fc7603a669 40
mbed_official 507:d4fc7603a669 41 #include <stdint.h>
mbed_official 507:d4fc7603a669 42
mbed_official 507:d4fc7603a669 43 /**
mbed_official 507:d4fc7603a669 44 * @file tmr_regs.h
mbed_official 507:d4fc7603a669 45 * @addtogroup tmr TMR
mbed_official 507:d4fc7603a669 46 * @{
mbed_official 507:d4fc7603a669 47 */
mbed_official 507:d4fc7603a669 48
mbed_official 507:d4fc7603a669 49 /**
mbed_official 507:d4fc7603a669 50 * @brief Defines timer modes for 16 and 32-bit timers
mbed_official 507:d4fc7603a669 51 */
mbed_official 507:d4fc7603a669 52 typedef enum {
mbed_official 507:d4fc7603a669 53 /** 32-bit or 16-bit timer one-shot mode */
mbed_official 507:d4fc7603a669 54 MXC_E_TMR_MODE_ONE_SHOT = 0,
mbed_official 507:d4fc7603a669 55 /** 32-bit or 16-bit timer one-shot mode */
mbed_official 507:d4fc7603a669 56 MXC_E_TMR_MODE_CONTINUOUS,
mbed_official 507:d4fc7603a669 57 /** 32-bit timer counter mode */
mbed_official 507:d4fc7603a669 58 MXC_E_TMR_MODE_COUNTER,
mbed_official 507:d4fc7603a669 59 /** 32-bit timer pulse width modulation mode */
mbed_official 507:d4fc7603a669 60 MXC_E_TMR_MODE_PWM,
mbed_official 507:d4fc7603a669 61 /** 32-bit timer capture mode */
mbed_official 507:d4fc7603a669 62 MXC_E_TMR_MODE_CAPTURE,
mbed_official 507:d4fc7603a669 63 /** 32-bit timer compare mode */
mbed_official 507:d4fc7603a669 64 MXC_E_TMR_MODE_COMPARE,
mbed_official 507:d4fc7603a669 65 /** 32-bit timer gated mode */
mbed_official 507:d4fc7603a669 66 MXC_E_TMR_MODE_GATED,
mbed_official 507:d4fc7603a669 67 /** 32-bit timer measure mode */
mbed_official 507:d4fc7603a669 68 MXC_E_TMR_MODE_MEASURE
mbed_official 507:d4fc7603a669 69 } mxc_tmr_mode_t;
mbed_official 507:d4fc7603a669 70
mbed_official 507:d4fc7603a669 71 /* Offset Register Description
mbed_official 507:d4fc7603a669 72 ====== ============================================== */
mbed_official 507:d4fc7603a669 73 typedef struct {
mbed_official 507:d4fc7603a669 74 __IO uint32_t ctrl; /* 0x0000 Timer Control Register */
mbed_official 507:d4fc7603a669 75 __IO uint32_t count32; /* 0x0004 [32 bit] Current Count Value */
mbed_official 507:d4fc7603a669 76 __IO uint32_t term_cnt32; /* 0x0008 [32 bit] Terminal Count Setting */
mbed_official 507:d4fc7603a669 77 __IO uint32_t pwm_cap32; /* 0x000C [32 bit] PWM Compare Setting or Capture/Measure Value */
mbed_official 507:d4fc7603a669 78 __IO uint32_t count16_0; /* 0x0010 [16 bit] Current Count Value, 16-bit Timer0 */
mbed_official 507:d4fc7603a669 79 __IO uint32_t term_cnt16_0; /* 0x0014 [16 bit] Terminal Count Setting, 16-bit Timer0 */
mbed_official 507:d4fc7603a669 80 __IO uint32_t count16_1; /* 0x0018 [16 bit] Current Count Value, 16-bit Timer1 */
mbed_official 507:d4fc7603a669 81 __IO uint32_t term_cnt16_1; /* 0x001C [16 bit] Terminal Count Setting, 16-bit Timer1 */
mbed_official 507:d4fc7603a669 82 __IO uint32_t intfl; /* 0x0020 Timer Module Interrupt Flags */
mbed_official 507:d4fc7603a669 83 __IO uint32_t inten; /* 0x0024 Timer Module Interrupt Enable/Disable Settings */
mbed_official 507:d4fc7603a669 84 } mxc_tmr_regs_t;
mbed_official 507:d4fc7603a669 85
mbed_official 507:d4fc7603a669 86 /*
mbed_official 507:d4fc7603a669 87 Register offsets for module TMR.
mbed_official 507:d4fc7603a669 88 */
mbed_official 507:d4fc7603a669 89 #define MXC_R_TMR_OFFS_CTRL ((uint32_t)0x00000000UL)
mbed_official 507:d4fc7603a669 90 #define MXC_R_TMR_OFFS_COUNT32 ((uint32_t)0x00000004UL)
mbed_official 507:d4fc7603a669 91 #define MXC_R_TMR_OFFS_TERM_CNT32 ((uint32_t)0x00000008UL)
mbed_official 507:d4fc7603a669 92 #define MXC_R_TMR_OFFS_PWM_CAP32 ((uint32_t)0x0000000CUL)
mbed_official 507:d4fc7603a669 93 #define MXC_R_TMR_OFFS_COUNT16_0 ((uint32_t)0x00000010UL)
mbed_official 507:d4fc7603a669 94 #define MXC_R_TMR_OFFS_TERM_CNT16_0 ((uint32_t)0x00000014UL)
mbed_official 507:d4fc7603a669 95 #define MXC_R_TMR_OFFS_COUNT16_1 ((uint32_t)0x00000018UL)
mbed_official 507:d4fc7603a669 96 #define MXC_R_TMR_OFFS_TERM_CNT16_1 ((uint32_t)0x0000001CUL)
mbed_official 507:d4fc7603a669 97 #define MXC_R_TMR_OFFS_INTFL ((uint32_t)0x00000020UL)
mbed_official 507:d4fc7603a669 98 #define MXC_R_TMR_OFFS_INTEN ((uint32_t)0x00000024UL)
mbed_official 507:d4fc7603a669 99
mbed_official 507:d4fc7603a669 100 /*
mbed_official 507:d4fc7603a669 101 Field positions and masks for module TMR.
mbed_official 507:d4fc7603a669 102 */
mbed_official 507:d4fc7603a669 103 #define MXC_F_TMR_CTRL_MODE_POS 0
mbed_official 507:d4fc7603a669 104 #define MXC_F_TMR_CTRL_MODE ((uint32_t)(0x00000007UL << MXC_F_TMR_CTRL_MODE_POS))
mbed_official 507:d4fc7603a669 105 #define MXC_F_TMR_CTRL_TMR2X16_POS 3
mbed_official 507:d4fc7603a669 106 #define MXC_F_TMR_CTRL_TMR2X16 ((uint32_t)(0x00000001UL << MXC_F_TMR_CTRL_TMR2X16_POS))
mbed_official 507:d4fc7603a669 107 #define MXC_F_TMR_CTRL_PRESCALE_POS 4
mbed_official 507:d4fc7603a669 108 #define MXC_F_TMR_CTRL_PRESCALE ((uint32_t)(0x0000000FUL << MXC_F_TMR_CTRL_PRESCALE_POS))
mbed_official 507:d4fc7603a669 109 #define MXC_F_TMR_CTRL_POLARITY_POS 8
mbed_official 507:d4fc7603a669 110 #define MXC_F_TMR_CTRL_POLARITY ((uint32_t)(0x00000001UL << MXC_F_TMR_CTRL_POLARITY_POS))
mbed_official 507:d4fc7603a669 111 #define MXC_F_TMR_CTRL_ENABLE0_POS 12
mbed_official 507:d4fc7603a669 112 #define MXC_F_TMR_CTRL_ENABLE0 ((uint32_t)(0x00000001UL << MXC_F_TMR_CTRL_ENABLE0_POS))
mbed_official 507:d4fc7603a669 113 #define MXC_F_TMR_CTRL_ENABLE1_POS 13
mbed_official 507:d4fc7603a669 114 #define MXC_F_TMR_CTRL_ENABLE1 ((uint32_t)(0x00000001UL << MXC_F_TMR_CTRL_ENABLE1_POS))
mbed_official 507:d4fc7603a669 115
mbed_official 507:d4fc7603a669 116 #define MXC_F_TMR_COUNT16_0_VALUE_POS 0
mbed_official 507:d4fc7603a669 117 #define MXC_F_TMR_COUNT16_0_VALUE ((uint32_t)(0x0000FFFFUL << MXC_F_TMR_COUNT16_0_VALUE_POS))
mbed_official 507:d4fc7603a669 118
mbed_official 507:d4fc7603a669 119 #define MXC_F_TMR_TERM_CNT16_0_TERM_COUNT_POS 0
mbed_official 507:d4fc7603a669 120 #define MXC_F_TMR_TERM_CNT16_0_TERM_COUNT ((uint32_t)(0x0000FFFFUL << MXC_F_TMR_TERM_CNT16_0_TERM_COUNT_POS))
mbed_official 507:d4fc7603a669 121
mbed_official 507:d4fc7603a669 122 #define MXC_F_TMR_COUNT16_1_VALUE_POS 0
mbed_official 507:d4fc7603a669 123 #define MXC_F_TMR_COUNT16_1_VALUE ((uint32_t)(0x0000FFFFUL << MXC_F_TMR_COUNT16_1_VALUE_POS))
mbed_official 507:d4fc7603a669 124
mbed_official 507:d4fc7603a669 125 #define MXC_F_TMR_TERM_CNT16_1_TERM_COUNT_POS 0
mbed_official 507:d4fc7603a669 126 #define MXC_F_TMR_TERM_CNT16_1_TERM_COUNT ((uint32_t)(0x0000FFFFUL << MXC_F_TMR_TERM_CNT16_1_TERM_COUNT_POS))
mbed_official 507:d4fc7603a669 127
mbed_official 507:d4fc7603a669 128 #define MXC_F_TMR_INTFL_TIMER0_POS 0
mbed_official 507:d4fc7603a669 129 #define MXC_F_TMR_INTFL_TIMER0 ((uint32_t)(0x00000001UL << MXC_F_TMR_INTFL_TIMER0_POS))
mbed_official 507:d4fc7603a669 130 #define MXC_F_TMR_INTFL_TIMER1_POS 1
mbed_official 507:d4fc7603a669 131 #define MXC_F_TMR_INTFL_TIMER1 ((uint32_t)(0x00000001UL << MXC_F_TMR_INTFL_TIMER1_POS))
mbed_official 507:d4fc7603a669 132
mbed_official 507:d4fc7603a669 133 #define MXC_F_TMR_INTEN_TIMER0_POS 0
mbed_official 507:d4fc7603a669 134 #define MXC_F_TMR_INTEN_TIMER0 ((uint32_t)(0x00000001UL << MXC_F_TMR_INTEN_TIMER0_POS))
mbed_official 507:d4fc7603a669 135 #define MXC_F_TMR_INTEN_TIMER1_POS 1
mbed_official 507:d4fc7603a669 136 #define MXC_F_TMR_INTEN_TIMER1 ((uint32_t)(0x00000001UL << MXC_F_TMR_INTEN_TIMER1_POS))
mbed_official 507:d4fc7603a669 137
mbed_official 507:d4fc7603a669 138 #ifdef __cplusplus
mbed_official 507:d4fc7603a669 139 }
mbed_official 507:d4fc7603a669 140 #endif
mbed_official 507:d4fc7603a669 141
mbed_official 507:d4fc7603a669 142 /**
mbed_official 507:d4fc7603a669 143 * @}
mbed_official 507:d4fc7603a669 144 */
mbed_official 507:d4fc7603a669 145
mbed_official 507:d4fc7603a669 146 #endif /* _MXC_TMR_REGS_H */