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
Anna Bridge 169:a7c7b631e539 33 #ifndef _MXC_MAA_REGS_H_
Anna Bridge 169:a7c7b631e539 34 #define _MXC_MAA_REGS_H_
Anna Bridge 169:a7c7b631e539 35
Anna Bridge 169:a7c7b631e539 36 #ifdef __cplusplus
Anna Bridge 169:a7c7b631e539 37 extern "C" {
Anna Bridge 169:a7c7b631e539 38 #endif
Anna Bridge 169:a7c7b631e539 39
Anna Bridge 169:a7c7b631e539 40 #include <stdint.h>
Anna Bridge 169:a7c7b631e539 41 #include "mxc_device.h"
Anna Bridge 169:a7c7b631e539 42
Anna Bridge 169:a7c7b631e539 43 /*
Anna Bridge 169:a7c7b631e539 44 If types are not defined elsewhere (CMSIS) define them here
Anna Bridge 169:a7c7b631e539 45 */
Anna Bridge 169:a7c7b631e539 46 #ifndef __IO
Anna Bridge 169:a7c7b631e539 47 #define __IO volatile
Anna Bridge 169:a7c7b631e539 48 #endif
Anna Bridge 169:a7c7b631e539 49 #ifndef __I
Anna Bridge 169:a7c7b631e539 50 #define __I volatile const
Anna Bridge 169:a7c7b631e539 51 #endif
Anna Bridge 169:a7c7b631e539 52 #ifndef __O
Anna Bridge 169:a7c7b631e539 53 #define __O volatile
Anna Bridge 169:a7c7b631e539 54 #endif
Anna Bridge 169:a7c7b631e539 55
Anna Bridge 169:a7c7b631e539 56
Anna Bridge 169:a7c7b631e539 57 /*
Anna Bridge 169:a7c7b631e539 58 Typedefed structure(s) for module registers (per instance or section) with direct 32-bit
Anna Bridge 169:a7c7b631e539 59 access to each register in module.
Anna Bridge 169:a7c7b631e539 60 */
Anna Bridge 169:a7c7b631e539 61
Anna Bridge 169:a7c7b631e539 62 /* Offset Register Description
Anna Bridge 169:a7c7b631e539 63 ============= ============================================================================ */
Anna Bridge 169:a7c7b631e539 64 typedef struct {
Anna Bridge 169:a7c7b631e539 65 __IO uint32_t ctrl; /* 0x0000 MAA Control, Configuration and Status */
Anna Bridge 169:a7c7b631e539 66 __IO uint32_t maws; /* 0x0004 MAA Word (Operand) Size, Big/Little Endian Mode Select */
Anna Bridge 169:a7c7b631e539 67 } mxc_maa_regs_t;
Anna Bridge 169:a7c7b631e539 68
Anna Bridge 169:a7c7b631e539 69
Anna Bridge 169:a7c7b631e539 70 /* Offset Register Description
Anna Bridge 169:a7c7b631e539 71 ============= ============================================================================ */
Anna Bridge 169:a7c7b631e539 72 typedef struct {
Anna Bridge 169:a7c7b631e539 73 __IO uint32_t seg0[32]; /* 0x0000-0x007C [128 bytes] MAA Memory Segment 0 */
Anna Bridge 169:a7c7b631e539 74 __IO uint32_t seg1[32]; /* 0x0080-0x00FC [128 bytes] MAA Memory Segment 1 */
Anna Bridge 169:a7c7b631e539 75 __IO uint32_t seg2[32]; /* 0x0100-0x017C [128 bytes] MAA Memory Segment 2 */
Anna Bridge 169:a7c7b631e539 76 __IO uint32_t seg3[32]; /* 0x0180-0x01FC [128 bytes] MAA Memory Segment 3 */
Anna Bridge 169:a7c7b631e539 77 __IO uint32_t seg4[32]; /* 0x0200-0x027C [128 bytes] MAA Memory Segment 4 */
Anna Bridge 169:a7c7b631e539 78 __IO uint32_t seg5[32]; /* 0x0280-0x02FC [128 bytes] MAA Memory Segment 5 */
Anna Bridge 169:a7c7b631e539 79 } mxc_maa_mem_regs_t;
Anna Bridge 169:a7c7b631e539 80
Anna Bridge 169:a7c7b631e539 81
Anna Bridge 169:a7c7b631e539 82 /*
Anna Bridge 169:a7c7b631e539 83 Register offsets for module MAA.
Anna Bridge 169:a7c7b631e539 84 */
Anna Bridge 169:a7c7b631e539 85
Anna Bridge 169:a7c7b631e539 86 #define MXC_R_MAA_OFFS_CTRL ((uint32_t)0x00000000UL)
Anna Bridge 169:a7c7b631e539 87 #define MXC_R_MAA_OFFS_MAWS ((uint32_t)0x00000004UL)
Anna Bridge 169:a7c7b631e539 88 #define MXC_R_MAA_MEM_OFFS_SEG0 ((uint32_t)0x00000000UL)
Anna Bridge 169:a7c7b631e539 89 #define MXC_R_MAA_MEM_OFFS_SEG1 ((uint32_t)0x00000080UL)
Anna Bridge 169:a7c7b631e539 90 #define MXC_R_MAA_MEM_OFFS_SEG2 ((uint32_t)0x00000100UL)
Anna Bridge 169:a7c7b631e539 91 #define MXC_R_MAA_MEM_OFFS_SEG3 ((uint32_t)0x00000180UL)
Anna Bridge 169:a7c7b631e539 92 #define MXC_R_MAA_MEM_OFFS_SEG4 ((uint32_t)0x00000200UL)
Anna Bridge 169:a7c7b631e539 93 #define MXC_R_MAA_MEM_OFFS_SEG5 ((uint32_t)0x00000280UL)
Anna Bridge 169:a7c7b631e539 94
Anna Bridge 169:a7c7b631e539 95
Anna Bridge 169:a7c7b631e539 96 /*
Anna Bridge 169:a7c7b631e539 97 Field positions and masks for module MAA.
Anna Bridge 169:a7c7b631e539 98 */
Anna Bridge 169:a7c7b631e539 99
Anna Bridge 169:a7c7b631e539 100 #define MXC_F_MAA_CTRL_START_POS 0
Anna Bridge 169:a7c7b631e539 101 #define MXC_F_MAA_CTRL_START ((uint32_t)(0x00000001UL << MXC_F_MAA_CTRL_START_POS))
Anna Bridge 169:a7c7b631e539 102 #define MXC_F_MAA_CTRL_OPSEL_POS 1
Anna Bridge 169:a7c7b631e539 103 #define MXC_F_MAA_CTRL_OPSEL ((uint32_t)(0x00000007UL << MXC_F_MAA_CTRL_OPSEL_POS))
Anna Bridge 169:a7c7b631e539 104 #define MXC_F_MAA_CTRL_OCALC_POS 4
Anna Bridge 169:a7c7b631e539 105 #define MXC_F_MAA_CTRL_OCALC ((uint32_t)(0x00000001UL << MXC_F_MAA_CTRL_OCALC_POS))
Anna Bridge 169:a7c7b631e539 106 #define MXC_F_MAA_CTRL_IF_DONE_POS 5
Anna Bridge 169:a7c7b631e539 107 #define MXC_F_MAA_CTRL_IF_DONE ((uint32_t)(0x00000001UL << MXC_F_MAA_CTRL_IF_DONE_POS))
Anna Bridge 169:a7c7b631e539 108 #define MXC_F_MAA_CTRL_INTEN_POS 6
Anna Bridge 169:a7c7b631e539 109 #define MXC_F_MAA_CTRL_INTEN ((uint32_t)(0x00000001UL << MXC_F_MAA_CTRL_INTEN_POS))
Anna Bridge 169:a7c7b631e539 110 #define MXC_F_MAA_CTRL_IF_ERROR_POS 7
Anna Bridge 169:a7c7b631e539 111 #define MXC_F_MAA_CTRL_IF_ERROR ((uint32_t)(0x00000001UL << MXC_F_MAA_CTRL_IF_ERROR_POS))
Anna Bridge 169:a7c7b631e539 112 #define MXC_F_MAA_CTRL_OFS_A_POS 8
Anna Bridge 169:a7c7b631e539 113 #define MXC_F_MAA_CTRL_OFS_A ((uint32_t)(0x00000003UL << MXC_F_MAA_CTRL_OFS_A_POS))
Anna Bridge 169:a7c7b631e539 114 #define MXC_F_MAA_CTRL_OFS_B_POS 10
Anna Bridge 169:a7c7b631e539 115 #define MXC_F_MAA_CTRL_OFS_B ((uint32_t)(0x00000003UL << MXC_F_MAA_CTRL_OFS_B_POS))
Anna Bridge 169:a7c7b631e539 116 #define MXC_F_MAA_CTRL_OFS_EXP_POS 12
Anna Bridge 169:a7c7b631e539 117 #define MXC_F_MAA_CTRL_OFS_EXP ((uint32_t)(0x00000003UL << MXC_F_MAA_CTRL_OFS_EXP_POS))
Anna Bridge 169:a7c7b631e539 118 #define MXC_F_MAA_CTRL_OFS_MOD_POS 14
Anna Bridge 169:a7c7b631e539 119 #define MXC_F_MAA_CTRL_OFS_MOD ((uint32_t)(0x00000003UL << MXC_F_MAA_CTRL_OFS_MOD_POS))
Anna Bridge 169:a7c7b631e539 120 #define MXC_F_MAA_CTRL_SEG_A_POS 16
Anna Bridge 169:a7c7b631e539 121 #define MXC_F_MAA_CTRL_SEG_A ((uint32_t)(0x0000000FUL << MXC_F_MAA_CTRL_SEG_A_POS))
Anna Bridge 169:a7c7b631e539 122 #define MXC_F_MAA_CTRL_SEG_B_POS 20
Anna Bridge 169:a7c7b631e539 123 #define MXC_F_MAA_CTRL_SEG_B ((uint32_t)(0x0000000FUL << MXC_F_MAA_CTRL_SEG_B_POS))
Anna Bridge 169:a7c7b631e539 124 #define MXC_F_MAA_CTRL_SEG_RES_POS 24
Anna Bridge 169:a7c7b631e539 125 #define MXC_F_MAA_CTRL_SEG_RES ((uint32_t)(0x0000000FUL << MXC_F_MAA_CTRL_SEG_RES_POS))
Anna Bridge 169:a7c7b631e539 126 #define MXC_F_MAA_CTRL_SEG_TMP_POS 28
Anna Bridge 169:a7c7b631e539 127 #define MXC_F_MAA_CTRL_SEG_TMP ((uint32_t)(0x0000000FUL << MXC_F_MAA_CTRL_SEG_TMP_POS))
Anna Bridge 169:a7c7b631e539 128
Anna Bridge 169:a7c7b631e539 129 #define MXC_F_MAA_MAWS_MODLEN_POS 0
Anna Bridge 169:a7c7b631e539 130 #define MXC_F_MAA_MAWS_MODLEN ((uint32_t)(0x000007FFUL << MXC_F_MAA_MAWS_MODLEN_POS))
Anna Bridge 169:a7c7b631e539 131 #define MXC_F_MAA_MAWS_BYTESWAP_POS 15
Anna Bridge 169:a7c7b631e539 132 #define MXC_F_MAA_MAWS_BYTESWAP ((uint32_t)(0x00000001UL << MXC_F_MAA_MAWS_BYTESWAP_POS))
Anna Bridge 169:a7c7b631e539 133
Anna Bridge 169:a7c7b631e539 134
Anna Bridge 169:a7c7b631e539 135
Anna Bridge 169:a7c7b631e539 136 /*
Anna Bridge 169:a7c7b631e539 137 Field values and shifted values for module MAA.
Anna Bridge 169:a7c7b631e539 138 */
Anna Bridge 169:a7c7b631e539 139
Anna Bridge 169:a7c7b631e539 140 #define MXC_V_MAA_OPSEL_EXP ((uint32_t)(0x00000000UL))
Anna Bridge 169:a7c7b631e539 141 #define MXC_V_MAA_OPSEL_SQR ((uint32_t)(0x00000001UL))
Anna Bridge 169:a7c7b631e539 142 #define MXC_V_MAA_OPSEL_MUL ((uint32_t)(0x00000002UL))
Anna Bridge 169:a7c7b631e539 143 #define MXC_V_MAA_OPSEL_SQRMUL ((uint32_t)(0x00000003UL))
Anna Bridge 169:a7c7b631e539 144 #define MXC_V_MAA_OPSEL_ADD ((uint32_t)(0x00000004UL))
Anna Bridge 169:a7c7b631e539 145 #define MXC_V_MAA_OPSEL_SUB ((uint32_t)(0x00000005UL))
Anna Bridge 169:a7c7b631e539 146
Anna Bridge 169:a7c7b631e539 147 #define MXC_S_MAA_OPSEL_EXP ((uint32_t)(MXC_V_MAA_OPSEL_EXP << MXC_F_MAA_CTRL_OPSEL_POS))
Anna Bridge 169:a7c7b631e539 148 #define MXC_S_MAA_OPSEL_SQR ((uint32_t)(MXC_V_MAA_OPSEL_SQR << MXC_F_MAA_CTRL_OPSEL_POS))
Anna Bridge 169:a7c7b631e539 149 #define MXC_S_MAA_OPSEL_MUL ((uint32_t)(MXC_V_MAA_OPSEL_MUL << MXC_F_MAA_CTRL_OPSEL_POS))
Anna Bridge 169:a7c7b631e539 150 #define MXC_S_MAA_OPSEL_SQRMUL ((uint32_t)(MXC_V_MAA_OPSEL_SQRMUL << MXC_F_MAA_CTRL_OPSEL_POS))
Anna Bridge 169:a7c7b631e539 151 #define MXC_S_MAA_OPSEL_ADD ((uint32_t)(MXC_V_MAA_OPSEL_ADD << MXC_F_MAA_CTRL_OPSEL_POS))
Anna Bridge 169:a7c7b631e539 152 #define MXC_S_MAA_OPSEL_SUB ((uint32_t)(MXC_V_MAA_OPSEL_SUB << MXC_F_MAA_CTRL_OPSEL_POS))
Anna Bridge 169:a7c7b631e539 153
Anna Bridge 169:a7c7b631e539 154
Anna Bridge 169:a7c7b631e539 155
Anna Bridge 169:a7c7b631e539 156 #ifdef __cplusplus
Anna Bridge 169:a7c7b631e539 157 }
Anna Bridge 169:a7c7b631e539 158 #endif
Anna Bridge 169:a7c7b631e539 159
Anna Bridge 169:a7c7b631e539 160 #endif /* _MXC_MAA_REGS_H_ */
Anna Bridge 169:a7c7b631e539 161