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:
Thu Jul 02 16:15:09 2015 +0100
Revision:
580:3c14cb9b87c5
Synchronized with git revision 213caf296f26963a7bea129b8ec4f33bbd1e6588

Full URL: https://github.com/mbedmicro/mbed/commit/213caf296f26963a7bea129b8ec4f33bbd1e6588/

commit of mps2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 580:3c14cb9b87c5 1 /* MPS2 CMSIS Library
mbed_official 580:3c14cb9b87c5 2 *
mbed_official 580:3c14cb9b87c5 3 * Copyright (c) 2006-2015 ARM Limited
mbed_official 580:3c14cb9b87c5 4 * All rights reserved.
mbed_official 580:3c14cb9b87c5 5 *
mbed_official 580:3c14cb9b87c5 6 * Redistribution and use in source and binary forms, with or without
mbed_official 580:3c14cb9b87c5 7 * modification, are permitted provided that the following conditions are met:
mbed_official 580:3c14cb9b87c5 8 *
mbed_official 580:3c14cb9b87c5 9 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 580:3c14cb9b87c5 10 * this list of conditions and the following disclaimer.
mbed_official 580:3c14cb9b87c5 11 *
mbed_official 580:3c14cb9b87c5 12 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 580:3c14cb9b87c5 13 * this list of conditions and the following disclaimer in the documentation
mbed_official 580:3c14cb9b87c5 14 * and/or other materials provided with the distribution.
mbed_official 580:3c14cb9b87c5 15 *
mbed_official 580:3c14cb9b87c5 16 * 3. Neither the name of the copyright holder nor the names of its contributors
mbed_official 580:3c14cb9b87c5 17 * may be used to endorse or promote products derived from this software without
mbed_official 580:3c14cb9b87c5 18 * specific prior written permission.
mbed_official 580:3c14cb9b87c5 19 *
mbed_official 580:3c14cb9b87c5 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 580:3c14cb9b87c5 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 580:3c14cb9b87c5 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
mbed_official 580:3c14cb9b87c5 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
mbed_official 580:3c14cb9b87c5 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
mbed_official 580:3c14cb9b87c5 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
mbed_official 580:3c14cb9b87c5 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 580:3c14cb9b87c5 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 580:3c14cb9b87c5 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
mbed_official 580:3c14cb9b87c5 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 580:3c14cb9b87c5 30 * POSSIBILITY OF SUCH DAMAGE.
mbed_official 580:3c14cb9b87c5 31 *******************************************************************************
mbed_official 580:3c14cb9b87c5 32 * File: smm_mps2.h
mbed_official 580:3c14cb9b87c5 33 * Release: Version 1.0
mbed_official 580:3c14cb9b87c5 34 *******************************************************************************/
mbed_official 580:3c14cb9b87c5 35
mbed_official 580:3c14cb9b87c5 36 #ifndef __SMM_MPS2_H
mbed_official 580:3c14cb9b87c5 37 #define __SMM_MPS2_H
mbed_official 580:3c14cb9b87c5 38
mbed_official 580:3c14cb9b87c5 39 #include "peripherallink.h" /* device specific header file */
mbed_official 580:3c14cb9b87c5 40
mbed_official 580:3c14cb9b87c5 41 #if defined ( __CC_ARM )
mbed_official 580:3c14cb9b87c5 42 #pragma anon_unions
mbed_official 580:3c14cb9b87c5 43 #endif
mbed_official 580:3c14cb9b87c5 44
mbed_official 580:3c14cb9b87c5 45 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 46 /* FPGA System Register declaration */
mbed_official 580:3c14cb9b87c5 47 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 48
mbed_official 580:3c14cb9b87c5 49 typedef struct
mbed_official 580:3c14cb9b87c5 50 {
mbed_official 580:3c14cb9b87c5 51 __IO uint32_t LED; // Offset: 0x000 (R/W) LED connections
mbed_official 580:3c14cb9b87c5 52 // [31:2] : Reserved
mbed_official 580:3c14cb9b87c5 53 // [1:0] : LEDs
mbed_official 580:3c14cb9b87c5 54 uint32_t RESERVED1[1];
mbed_official 580:3c14cb9b87c5 55 __IO uint32_t BUTTON; // Offset: 0x008 (R/W) Buttons
mbed_official 580:3c14cb9b87c5 56 // [31:2] : Reserved
mbed_official 580:3c14cb9b87c5 57 // [1:0] : Buttons
mbed_official 580:3c14cb9b87c5 58 uint32_t RESERVED2[1];
mbed_official 580:3c14cb9b87c5 59 __IO uint32_t CLK1HZ; // Offset: 0x010 (R/W) 1Hz up counter
mbed_official 580:3c14cb9b87c5 60 __IO uint32_t CLK100HZ; // Offset: 0x014 (R/W) 100Hz up counter
mbed_official 580:3c14cb9b87c5 61 __IO uint32_t COUNTER; // Offset: 0x018 (R/W) Cycle Up Counter
mbed_official 580:3c14cb9b87c5 62 // Increments when 32-bit prescale counter reach zero
mbed_official 580:3c14cb9b87c5 63 uint32_t RESERVED3[1];
mbed_official 580:3c14cb9b87c5 64 __IO uint32_t PRESCALE; // Offset: 0x020 (R/W) Prescaler
mbed_official 580:3c14cb9b87c5 65 // Bit[31:0] : reload value for prescale counter
mbed_official 580:3c14cb9b87c5 66 __IO uint32_t PSCNTR; // Offset: 0x024 (R/W) 32-bit Prescale counter
mbed_official 580:3c14cb9b87c5 67 // current value of the pre-scaler counter
mbed_official 580:3c14cb9b87c5 68 // The Cycle Up Counter increment when the prescale down counter reach 0
mbed_official 580:3c14cb9b87c5 69 // The pre-scaler counter is reloaded with PRESCALE after reaching 0.
mbed_official 580:3c14cb9b87c5 70 uint32_t RESERVED4[9];
mbed_official 580:3c14cb9b87c5 71 __IO uint32_t MISC; // Offset: 0x04C (R/W) Misc control */
mbed_official 580:3c14cb9b87c5 72 // [31:7] : Reserved
mbed_official 580:3c14cb9b87c5 73 // [6] : CLCD_BL_CTRL
mbed_official 580:3c14cb9b87c5 74 // [5] : CLCD_RD
mbed_official 580:3c14cb9b87c5 75 // [4] : CLCD_RS
mbed_official 580:3c14cb9b87c5 76 // [3] : CLCD_RESET
mbed_official 580:3c14cb9b87c5 77 // [2] : RESERVED
mbed_official 580:3c14cb9b87c5 78 // [1] : SPI_nSS
mbed_official 580:3c14cb9b87c5 79 // [0] : CLCD_CS
mbed_official 580:3c14cb9b87c5 80 } MPS2_FPGAIO_TypeDef;
mbed_official 580:3c14cb9b87c5 81
mbed_official 580:3c14cb9b87c5 82 // MISC register bit definitions
mbed_official 580:3c14cb9b87c5 83
mbed_official 580:3c14cb9b87c5 84 #define CLCD_CS_Pos 0
mbed_official 580:3c14cb9b87c5 85 #define CLCD_CS_Msk (1UL<<CLCD_CS_Pos)
mbed_official 580:3c14cb9b87c5 86 #define SPI_nSS_Pos 1
mbed_official 580:3c14cb9b87c5 87 #define SPI_nSS_Msk (1UL<<SPI_nSS_Pos)
mbed_official 580:3c14cb9b87c5 88 #define CLCD_RESET_Pos 3
mbed_official 580:3c14cb9b87c5 89 #define CLCD_RESET_Msk (1UL<<CLCD_RESET_Pos)
mbed_official 580:3c14cb9b87c5 90 #define CLCD_RS_Pos 4
mbed_official 580:3c14cb9b87c5 91 #define CLCD_RS_Msk (1UL<<CLCD_RS_Pos)
mbed_official 580:3c14cb9b87c5 92 #define CLCD_RD_Pos 5
mbed_official 580:3c14cb9b87c5 93 #define CLCD_RD_Msk (1UL<<CLCD_RD_Pos)
mbed_official 580:3c14cb9b87c5 94 #define CLCD_BL_Pos 6
mbed_official 580:3c14cb9b87c5 95 #define CLCD_BL_Msk (1UL<<CLCD_BL_Pos)
mbed_official 580:3c14cb9b87c5 96
mbed_official 580:3c14cb9b87c5 97 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 98 /* SCC Register declaration */
mbed_official 580:3c14cb9b87c5 99 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 100
mbed_official 580:3c14cb9b87c5 101 typedef struct //
mbed_official 580:3c14cb9b87c5 102 {
mbed_official 580:3c14cb9b87c5 103 __IO uint32_t CFG_REG0; // Offset: 0x000 (R/W) Remaps block RAM to ZBT
mbed_official 580:3c14cb9b87c5 104 // [31:1] : Reserved
mbed_official 580:3c14cb9b87c5 105 // [0] 1 : REMAP BlockRam to ZBT
mbed_official 580:3c14cb9b87c5 106 __IO uint32_t LEDS; // Offset: 0x004 (R/W) Controls the MCC user LEDs
mbed_official 580:3c14cb9b87c5 107 // [31:8] : Reserved
mbed_official 580:3c14cb9b87c5 108 // [7:0] : MCC LEDs
mbed_official 580:3c14cb9b87c5 109 uint32_t RESERVED0[1];
mbed_official 580:3c14cb9b87c5 110 __I uint32_t SWITCHES; // Offset: 0x00C (R/ ) Denotes the state of the MCC user switches
mbed_official 580:3c14cb9b87c5 111 // [31:8] : Reserved
mbed_official 580:3c14cb9b87c5 112 // [7:0] : These bits indicate state of the MCC switches
mbed_official 580:3c14cb9b87c5 113 __I uint32_t CFG_REG4; // Offset: 0x010 (R/ ) Denotes the board revision
mbed_official 580:3c14cb9b87c5 114 // [31:4] : Reserved
mbed_official 580:3c14cb9b87c5 115 // [3:0] : Used by the MCC to pass PCB revision. 0 = A 1 = B
mbed_official 580:3c14cb9b87c5 116 uint32_t RESERVED1[35];
mbed_official 580:3c14cb9b87c5 117 __IO uint32_t SYS_CFGDATA_RTN; // Offset: 0x0A0 (R/W) User data register
mbed_official 580:3c14cb9b87c5 118 // [31:0] : Data
mbed_official 580:3c14cb9b87c5 119 __IO uint32_t SYS_CFGDATA_OUT; // Offset: 0x0A4 (R/W) User data register
mbed_official 580:3c14cb9b87c5 120 // [31:0] : Data
mbed_official 580:3c14cb9b87c5 121 __IO uint32_t SYS_CFGCTRL; // Offset: 0x0A8 (R/W) Control register
mbed_official 580:3c14cb9b87c5 122 // [31] : Start (generates interrupt on write to this bit)
mbed_official 580:3c14cb9b87c5 123 // [30] : R/W access
mbed_official 580:3c14cb9b87c5 124 // [29:26] : Reserved
mbed_official 580:3c14cb9b87c5 125 // [25:20] : Function value
mbed_official 580:3c14cb9b87c5 126 // [19:12] : Reserved
mbed_official 580:3c14cb9b87c5 127 // [11:0] : Device (value of 0/1/2 for supported clocks)
mbed_official 580:3c14cb9b87c5 128 __IO uint32_t SYS_CFGSTAT; // Offset: 0x0AC (R/W) Contains status information
mbed_official 580:3c14cb9b87c5 129 // [31:2] : Reserved
mbed_official 580:3c14cb9b87c5 130 // [1] : Error
mbed_official 580:3c14cb9b87c5 131 // [0] : Complete
mbed_official 580:3c14cb9b87c5 132 __IO uint32_t RESERVED2[20];
mbed_official 580:3c14cb9b87c5 133 __IO uint32_t SCC_DLL; // Offset: 0x100 (R/W) DLL Lock Register
mbed_official 580:3c14cb9b87c5 134 // [31:24] : DLL LOCK MASK[7:0] - Indicate if the DLL locked is masked
mbed_official 580:3c14cb9b87c5 135 // [23:16] : DLL LOCK MASK[7:0] - Indicate if the DLLs are locked or unlocked
mbed_official 580:3c14cb9b87c5 136 // [15:1] : Reserved
mbed_official 580:3c14cb9b87c5 137 // [0] : This bit indicates if all enabled DLLs are locked
mbed_official 580:3c14cb9b87c5 138 uint32_t RESERVED3[957];
mbed_official 580:3c14cb9b87c5 139 __I uint32_t SCC_AID; // Offset: 0xFF8 (R/ ) SCC AID Register
mbed_official 580:3c14cb9b87c5 140 // [31:24] : FPGA build number
mbed_official 580:3c14cb9b87c5 141 // [23:20] : V2M-MPS2 target board revision (A = 0, B = 1)
mbed_official 580:3c14cb9b87c5 142 // [19:11] : Reserved
mbed_official 580:3c14cb9b87c5 143 // [10] : if “1” SCC_SW register has been implemented
mbed_official 580:3c14cb9b87c5 144 // [9] : if “1” SCC_LED register has been implemented
mbed_official 580:3c14cb9b87c5 145 // [8] : if “1” DLL lock register has been implemented
mbed_official 580:3c14cb9b87c5 146 // [7:0] : number of SCC configuration register
mbed_official 580:3c14cb9b87c5 147 __I uint32_t SCC_ID; // Offset: 0xFFC (R/ ) Contains information about the FPGA image
mbed_official 580:3c14cb9b87c5 148 // [31:24] : Implementer ID: 0x41 = ARM
mbed_official 580:3c14cb9b87c5 149 // [23:20] : Application note IP variant number
mbed_official 580:3c14cb9b87c5 150 // [19:16] : IP Architecture: 0x4 =AHB
mbed_official 580:3c14cb9b87c5 151 // [15:4] : Primary part number: 386 = AN386
mbed_official 580:3c14cb9b87c5 152 // [3:0] : Application note IP revision number
mbed_official 580:3c14cb9b87c5 153 } MPS2_SCC_TypeDef;
mbed_official 580:3c14cb9b87c5 154
mbed_official 580:3c14cb9b87c5 155
mbed_official 580:3c14cb9b87c5 156 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 157 /* SSP Peripheral declaration */
mbed_official 580:3c14cb9b87c5 158 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 159
mbed_official 580:3c14cb9b87c5 160 typedef struct // Document DDI0194G_ssp_pl022_r1p3_trm.pdf
mbed_official 580:3c14cb9b87c5 161 {
mbed_official 580:3c14cb9b87c5 162 __IO uint32_t CR0; // Offset: 0x000 (R/W) Control register 0
mbed_official 580:3c14cb9b87c5 163 // [31:16] : Reserved
mbed_official 580:3c14cb9b87c5 164 // [15:8] : Serial clock rate
mbed_official 580:3c14cb9b87c5 165 // [7] : SSPCLKOUT phase, applicable to Motorola SPI frame format only
mbed_official 580:3c14cb9b87c5 166 // [6] : SSPCLKOUT polarity, applicable to Motorola SPI frame format only
mbed_official 580:3c14cb9b87c5 167 // [5:4] : Frame format
mbed_official 580:3c14cb9b87c5 168 // [3:0] : Data Size Select
mbed_official 580:3c14cb9b87c5 169 __IO uint32_t CR1; // Offset: 0x004 (R/W) Control register 1
mbed_official 580:3c14cb9b87c5 170 // [31:4] : Reserved
mbed_official 580:3c14cb9b87c5 171 // [3] : Slave-mode output disable
mbed_official 580:3c14cb9b87c5 172 // [2] : Master or slave mode select
mbed_official 580:3c14cb9b87c5 173 // [1] : Synchronous serial port enable
mbed_official 580:3c14cb9b87c5 174 // [0] : Loop back mode
mbed_official 580:3c14cb9b87c5 175 __IO uint32_t DR; // Offset: 0x008 (R/W) Data register
mbed_official 580:3c14cb9b87c5 176 // [31:16] : Reserved
mbed_official 580:3c14cb9b87c5 177 // [15:0] : Transmit/Receive FIFO
mbed_official 580:3c14cb9b87c5 178 __I uint32_t SR; // Offset: 0x00C (R/ ) Status register
mbed_official 580:3c14cb9b87c5 179 // [31:5] : Reserved
mbed_official 580:3c14cb9b87c5 180 // [4] : PrimeCell SSP busy flag
mbed_official 580:3c14cb9b87c5 181 // [3] : Receive FIFO full
mbed_official 580:3c14cb9b87c5 182 // [2] : Receive FIFO not empty
mbed_official 580:3c14cb9b87c5 183 // [1] : Transmit FIFO not full
mbed_official 580:3c14cb9b87c5 184 // [0] : Transmit FIFO empty
mbed_official 580:3c14cb9b87c5 185 __IO uint32_t CPSR; // Offset: 0x010 (R/W) Clock prescale register
mbed_official 580:3c14cb9b87c5 186 // [31:8] : Reserved
mbed_official 580:3c14cb9b87c5 187 // [8:0] : Clock prescale divisor
mbed_official 580:3c14cb9b87c5 188 __IO uint32_t IMSC; // Offset: 0x014 (R/W) Interrupt mask set or clear register
mbed_official 580:3c14cb9b87c5 189 // [31:4] : Reserved
mbed_official 580:3c14cb9b87c5 190 // [3] : Transmit FIFO interrupt mask
mbed_official 580:3c14cb9b87c5 191 // [2] : Receive FIFO interrupt mask
mbed_official 580:3c14cb9b87c5 192 // [1] : Receive timeout interrupt mask
mbed_official 580:3c14cb9b87c5 193 // [0] : Receive overrun interrupt mask
mbed_official 580:3c14cb9b87c5 194 __I uint32_t RIS; // Offset: 0x018 (R/ ) Raw interrupt status register
mbed_official 580:3c14cb9b87c5 195 // [31:4] : Reserved
mbed_official 580:3c14cb9b87c5 196 // [3] : raw interrupt state, prior to masking, of the SSPTXINTR interrupt
mbed_official 580:3c14cb9b87c5 197 // [2] : raw interrupt state, prior to masking, of the SSPRXINTR interrupt
mbed_official 580:3c14cb9b87c5 198 // [1] : raw interrupt state, prior to masking, of the SSPRTINTR interrupt
mbed_official 580:3c14cb9b87c5 199 // [0] : raw interrupt state, prior to masking, of the SSPRORINTR interrupt
mbed_official 580:3c14cb9b87c5 200 __I uint32_t MIS; // Offset: 0x01C (R/ ) Masked interrupt status register
mbed_official 580:3c14cb9b87c5 201 // [31:4] : Reserved
mbed_official 580:3c14cb9b87c5 202 // [3] : transmit FIFO masked interrupt state, after masking, of the SSPTXINTR interrupt
mbed_official 580:3c14cb9b87c5 203 // [2] : receive FIFO masked interrupt state, after masking, of the SSPRXINTR interrupt
mbed_official 580:3c14cb9b87c5 204 // [1] : receive timeout masked interrupt state, after masking, of the SSPRTINTR interrupt
mbed_official 580:3c14cb9b87c5 205 // [0] : receive over run masked interrupt status, after masking, of the SSPRORINTR interrupt
mbed_official 580:3c14cb9b87c5 206 __O uint32_t ICR; // Offset: 0x020 ( /W) Interrupt clear register
mbed_official 580:3c14cb9b87c5 207 // [31:2] : Reserved
mbed_official 580:3c14cb9b87c5 208 // [1] : Clears the SSPRTINTR interrupt
mbed_official 580:3c14cb9b87c5 209 // [0] : Clears the SSPRORINTR interrupt
mbed_official 580:3c14cb9b87c5 210 __IO uint32_t DMACR; // Offset: 0x024 (R/W) DMA control register
mbed_official 580:3c14cb9b87c5 211 // [31:2] : Reserved
mbed_official 580:3c14cb9b87c5 212 // [1] : Transmit DMA Enable
mbed_official 580:3c14cb9b87c5 213 // [0] : Receive DMA Enable
mbed_official 580:3c14cb9b87c5 214 } MPS2_SSP_TypeDef;
mbed_official 580:3c14cb9b87c5 215
mbed_official 580:3c14cb9b87c5 216
mbed_official 580:3c14cb9b87c5 217 // SSP_CR0 Control register 0
mbed_official 580:3c14cb9b87c5 218 #define SSP_CR0_DSS_Pos 0 // Data Size Select
mbed_official 580:3c14cb9b87c5 219 #define SSP_CR0_DSS_Msk (0xF<<SSP_CR0_DSS_Pos)
mbed_official 580:3c14cb9b87c5 220 #define SSP_CR0_FRF_Pos 4 // Frame Format Select
mbed_official 580:3c14cb9b87c5 221 #define SSP_CR0_FRF_Msk (3UL<<SSP_CR0_FRM_Pos)
mbed_official 580:3c14cb9b87c5 222 #define SSP_CR0_SPO_Pos 6 // SSPCLKOUT polarity
mbed_official 580:3c14cb9b87c5 223 #define SSP_CR0_SPO_Msk (1UL<<SSP_CR0_SPO_Pos)
mbed_official 580:3c14cb9b87c5 224 #define SSP_CR0_SPH_Pos 7 // SSPCLKOUT phase
mbed_official 580:3c14cb9b87c5 225 #define SSP_CR0_SPH_Msk (1UL<<SSP_CR0_SPH_Pos)
mbed_official 580:3c14cb9b87c5 226 #define SSP_CR0_SCR_Pos 8 // Serial Clock Rate (divide)
mbed_official 580:3c14cb9b87c5 227 #define SSP_CR0_SCR_Msk (0xFF<<SSP_CR0_SCR_Pos)
mbed_official 580:3c14cb9b87c5 228
mbed_official 580:3c14cb9b87c5 229 #define SSP_CR0_SCR_DFLT 0x0300 // Serial Clock Rate (divide), default set at 3
mbed_official 580:3c14cb9b87c5 230 #define SSP_CR0_FRF_MOT 0x0000 // Frame format, Motorola
mbed_official 580:3c14cb9b87c5 231 #define SSP_CR0_DSS_8 0x0007 // Data packet size, 8bits
mbed_official 580:3c14cb9b87c5 232 #define SSP_CR0_DSS_16 0x000F // Data packet size, 16bits
mbed_official 580:3c14cb9b87c5 233
mbed_official 580:3c14cb9b87c5 234 // SSP_CR1 Control register 1
mbed_official 580:3c14cb9b87c5 235 #define SSP_CR1_LBM_Pos 0 // Loop Back Mode
mbed_official 580:3c14cb9b87c5 236 #define SSP_CR1_LBM_Msk (1UL<<SSP_CR1_LBM_Pos)
mbed_official 580:3c14cb9b87c5 237 #define SSP_CR1_SSE_Pos 1 // Serial port enable
mbed_official 580:3c14cb9b87c5 238 #define SSP_CR1_SSE_Msk (1UL<<SSP_CR1_SSE_Pos)
mbed_official 580:3c14cb9b87c5 239 #define SSP_CR1_MS_Pos 2 // Master or Slave mode
mbed_official 580:3c14cb9b87c5 240 #define SSP_CR1_MS_Msk (1UL<<SSP_CR1_MS_Pos)
mbed_official 580:3c14cb9b87c5 241 #define SSP_CR1_SOD_Pos 3 // Slave Output mode Disable
mbed_official 580:3c14cb9b87c5 242 #define SSP_CR1_SOD_Msk (1UL<<SSP_CR1_SOD_Pos)
mbed_official 580:3c14cb9b87c5 243
mbed_official 580:3c14cb9b87c5 244 // SSP_SR Status register
mbed_official 580:3c14cb9b87c5 245 #define SSP_SR_TFE_Pos 0 // Transmit FIFO empty
mbed_official 580:3c14cb9b87c5 246 #define SSP_SR_TFE_Msk (1UL<<SSP_SR_TFE_Pos)
mbed_official 580:3c14cb9b87c5 247 #define SSP_SR_TNF_Pos 1 // Transmit FIFO not full
mbed_official 580:3c14cb9b87c5 248 #define SSP_SR_TNF_Msk (1UL<<SSP_SR_TNF_Pos)
mbed_official 580:3c14cb9b87c5 249 #define SSP_SR_RNE_Pos 2 // Receive FIFO not empty
mbed_official 580:3c14cb9b87c5 250 #define SSP_SR_RNE_Msk (1UL<<SSP_SR_RNE_Pos)
mbed_official 580:3c14cb9b87c5 251 #define SSP_SR_RFF_Pos 3 // Receive FIFO full
mbed_official 580:3c14cb9b87c5 252 #define SSP_SR_RFF_Msk (1UL<<SSP_SR_RFF_Pos)
mbed_official 580:3c14cb9b87c5 253 #define SSP_SR_BSY_Pos 4 // Busy
mbed_official 580:3c14cb9b87c5 254 #define SSP_SR_BSY_Msk (1UL<<SSP_SR_BSY_Pos)
mbed_official 580:3c14cb9b87c5 255
mbed_official 580:3c14cb9b87c5 256 // SSP_CPSR Clock prescale register
mbed_official 580:3c14cb9b87c5 257 #define SSP_CPSR_CPD_Pos 0 // Clock prescale divisor
mbed_official 580:3c14cb9b87c5 258 #define SSP_CPSR_CPD_Msk (0xFF<<SSP_CPSR_CDP_Pos)
mbed_official 580:3c14cb9b87c5 259
mbed_official 580:3c14cb9b87c5 260 #define SSP_CPSR_DFLT 0x0008 // Clock prescale (use with SCR), default set at 8
mbed_official 580:3c14cb9b87c5 261
mbed_official 580:3c14cb9b87c5 262 // SSPIMSC Interrupt mask set and clear register
mbed_official 580:3c14cb9b87c5 263 #define SSP_IMSC_RORIM_Pos 0 // Receive overrun not Masked
mbed_official 580:3c14cb9b87c5 264 #define SSP_IMSC_RORIM_Msk (1UL<<SSP_IMSC_RORIM_Pos)
mbed_official 580:3c14cb9b87c5 265 #define SSP_IMSC_RTIM_Pos 1 // Receive timeout not Masked
mbed_official 580:3c14cb9b87c5 266 #define SSP_IMSC_RTIM_Msk (1UL<<SSP_IMSC_RTIM_Pos)
mbed_official 580:3c14cb9b87c5 267 #define SSP_IMSC_RXIM_Pos 2 // Receive FIFO not Masked
mbed_official 580:3c14cb9b87c5 268 #define SSP_IMSC_RXIM_Msk (1UL<<SSP_IMSC_RXIM_Pos)
mbed_official 580:3c14cb9b87c5 269 #define SSP_IMSC_TXIM_Pos 3 // Transmit FIFO not Masked
mbed_official 580:3c14cb9b87c5 270 #define SSP_IMSC_TXIM_Msk (1UL<<SSP_IMSC_TXIM_Pos)
mbed_official 580:3c14cb9b87c5 271
mbed_official 580:3c14cb9b87c5 272 // SSPRIS Raw interrupt status register
mbed_official 580:3c14cb9b87c5 273 #define SSP_RIS_RORRIS_Pos 0 // Raw Overrun interrupt flag
mbed_official 580:3c14cb9b87c5 274 #define SSP_RIS_RORRIS_Msk (1UL<<SSP_RIS_RORRIS_Pos)
mbed_official 580:3c14cb9b87c5 275 #define SSP_RIS_RTRIS_Pos 1 // Raw Timemout interrupt flag
mbed_official 580:3c14cb9b87c5 276 #define SSP_RIS_RTRIS_Msk (1UL<<SSP_RIS_RTRIS_Pos)
mbed_official 580:3c14cb9b87c5 277 #define SSP_RIS_RXRIS_Pos 2 // Raw Receive interrupt flag
mbed_official 580:3c14cb9b87c5 278 #define SSP_RIS_RXRIS_Msk (1UL<<SSP_RIS_RXRIS_Pos)
mbed_official 580:3c14cb9b87c5 279 #define SSP_RIS_TXRIS_Pos 3 // Raw Transmit interrupt flag
mbed_official 580:3c14cb9b87c5 280 #define SSP_RIS_TXRIS_Msk (1UL<<SSP_RIS_TXRIS_Pos)
mbed_official 580:3c14cb9b87c5 281
mbed_official 580:3c14cb9b87c5 282 // SSPMIS Masked interrupt status register
mbed_official 580:3c14cb9b87c5 283 #define SSP_MIS_RORMIS_Pos 0 // Masked Overrun interrupt flag
mbed_official 580:3c14cb9b87c5 284 #define SSP_MIS_RORMIS_Msk (1UL<<SSP_MIS_RORMIS_Pos)
mbed_official 580:3c14cb9b87c5 285 #define SSP_MIS_RTMIS_Pos 1 // Masked Timemout interrupt flag
mbed_official 580:3c14cb9b87c5 286 #define SSP_MIS_RTMIS_Msk (1UL<<SSP_MIS_RTMIS_Pos)
mbed_official 580:3c14cb9b87c5 287 #define SSP_MIS_RXMIS_Pos 2 // Masked Receive interrupt flag
mbed_official 580:3c14cb9b87c5 288 #define SSP_MIS_RXMIS_Msk (1UL<<SSP_MIS_RXMIS_Pos)
mbed_official 580:3c14cb9b87c5 289 #define SSP_MIS_TXMIS_Pos 3 // Masked Transmit interrupt flag
mbed_official 580:3c14cb9b87c5 290 #define SSP_MIS_TXMIS_Msk (1UL<<SSP_MIS_TXMIS_Pos)
mbed_official 580:3c14cb9b87c5 291
mbed_official 580:3c14cb9b87c5 292 // SSPICR Interrupt clear register
mbed_official 580:3c14cb9b87c5 293 #define SSP_ICR_RORIC_Pos 0 // Clears Overrun interrupt flag
mbed_official 580:3c14cb9b87c5 294 #define SSP_ICR_RORIC_Msk (1UL<<SSP_ICR_RORIC_Pos)
mbed_official 580:3c14cb9b87c5 295 #define SSP_ICR_RTIC_Pos 1 // Clears Timemout interrupt flag
mbed_official 580:3c14cb9b87c5 296 #define SSP_ICR_RTIC_Msk (1UL<<SSP_ICR_RTIC_Pos)
mbed_official 580:3c14cb9b87c5 297
mbed_official 580:3c14cb9b87c5 298 // SSPDMACR DMA control register
mbed_official 580:3c14cb9b87c5 299 #define SSP_DMACR_RXDMAE_Pos 0 // Enable Receive FIFO DMA
mbed_official 580:3c14cb9b87c5 300 #define SSP_DMACR_RXDMAE_Msk (1UL<<SSP_DMACR_RXDMAE_Pos)
mbed_official 580:3c14cb9b87c5 301 #define SSP_DMACR_TXDMAE_Pos 1 // Enable Transmit FIFO DMA
mbed_official 580:3c14cb9b87c5 302 #define SSP_DMACR_TXDMAE_Msk (1UL<<SSP_DMACR_TXDMAE_Pos)
mbed_official 580:3c14cb9b87c5 303
mbed_official 580:3c14cb9b87c5 304 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 305 /* Audio and Touch Screen (I2C) Peripheral declaration */
mbed_official 580:3c14cb9b87c5 306 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 307
mbed_official 580:3c14cb9b87c5 308 typedef struct
mbed_official 580:3c14cb9b87c5 309 {
mbed_official 580:3c14cb9b87c5 310 union {
mbed_official 580:3c14cb9b87c5 311 __O uint32_t CONTROLS; // Offset: 0x000 CONTROL Set Register ( /W)
mbed_official 580:3c14cb9b87c5 312 __I uint32_t CONTROL; // Offset: 0x000 CONTROL Status Register (R/ )
mbed_official 580:3c14cb9b87c5 313 };
mbed_official 580:3c14cb9b87c5 314 __O uint32_t CONTROLC; // Offset: 0x004 CONTROL Clear Register ( /W)
mbed_official 580:3c14cb9b87c5 315 } MPS2_I2C_TypeDef;
mbed_official 580:3c14cb9b87c5 316
mbed_official 580:3c14cb9b87c5 317 #define SDA 1 << 1
mbed_official 580:3c14cb9b87c5 318 #define SCL 1 << 0
mbed_official 580:3c14cb9b87c5 319
mbed_official 580:3c14cb9b87c5 320
mbed_official 580:3c14cb9b87c5 321 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 322 /* Audio I2S Peripheral declaration */
mbed_official 580:3c14cb9b87c5 323 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 324
mbed_official 580:3c14cb9b87c5 325 typedef struct
mbed_official 580:3c14cb9b87c5 326 {
mbed_official 580:3c14cb9b87c5 327 /*!< Offset: 0x000 CONTROL Register (R/W) */
mbed_official 580:3c14cb9b87c5 328 __IO uint32_t CONTROL; // <h> CONTROL </h>
mbed_official 580:3c14cb9b87c5 329 // <o.0> TX Enable
mbed_official 580:3c14cb9b87c5 330 // <0=> TX disabled
mbed_official 580:3c14cb9b87c5 331 // <1=> TX enabled
mbed_official 580:3c14cb9b87c5 332 // <o.1> TX IRQ Enable
mbed_official 580:3c14cb9b87c5 333 // <0=> TX IRQ disabled
mbed_official 580:3c14cb9b87c5 334 // <1=> TX IRQ enabled
mbed_official 580:3c14cb9b87c5 335 // <o.2> RX Enable
mbed_official 580:3c14cb9b87c5 336 // <0=> RX disabled
mbed_official 580:3c14cb9b87c5 337 // <1=> RX enabled
mbed_official 580:3c14cb9b87c5 338 // <o.3> RX IRQ Enable
mbed_official 580:3c14cb9b87c5 339 // <0=> RX IRQ disabled
mbed_official 580:3c14cb9b87c5 340 // <1=> RX IRQ enabled
mbed_official 580:3c14cb9b87c5 341 // <o.10..8> TX Buffer Water Level
mbed_official 580:3c14cb9b87c5 342 // <0=> / IRQ triggers when any space available
mbed_official 580:3c14cb9b87c5 343 // <1=> / IRQ triggers when more than 1 space available
mbed_official 580:3c14cb9b87c5 344 // <2=> / IRQ triggers when more than 2 space available
mbed_official 580:3c14cb9b87c5 345 // <3=> / IRQ triggers when more than 3 space available
mbed_official 580:3c14cb9b87c5 346 // <4=> Undefined!
mbed_official 580:3c14cb9b87c5 347 // <5=> Undefined!
mbed_official 580:3c14cb9b87c5 348 // <6=> Undefined!
mbed_official 580:3c14cb9b87c5 349 // <7=> Undefined!
mbed_official 580:3c14cb9b87c5 350 // <o.14..12> RX Buffer Water Level
mbed_official 580:3c14cb9b87c5 351 // <0=> Undefined!
mbed_official 580:3c14cb9b87c5 352 // <1=> / IRQ triggers when less than 1 space available
mbed_official 580:3c14cb9b87c5 353 // <2=> / IRQ triggers when less than 2 space available
mbed_official 580:3c14cb9b87c5 354 // <3=> / IRQ triggers when less than 3 space available
mbed_official 580:3c14cb9b87c5 355 // <4=> / IRQ triggers when less than 4 space available
mbed_official 580:3c14cb9b87c5 356 // <5=> Undefined!
mbed_official 580:3c14cb9b87c5 357 // <6=> Undefined!
mbed_official 580:3c14cb9b87c5 358 // <7=> Undefined!
mbed_official 580:3c14cb9b87c5 359 // <o.16> FIFO reset
mbed_official 580:3c14cb9b87c5 360 // <0=> Normal operation
mbed_official 580:3c14cb9b87c5 361 // <1=> FIFO reset
mbed_official 580:3c14cb9b87c5 362 // <o.17> Audio Codec reset
mbed_official 580:3c14cb9b87c5 363 // <0=> Normal operation
mbed_official 580:3c14cb9b87c5 364 // <1=> Assert audio Codec reset
mbed_official 580:3c14cb9b87c5 365 /*!< Offset: 0x004 STATUS Register (R/ ) */
mbed_official 580:3c14cb9b87c5 366 __I uint32_t STATUS; // <h> STATUS </h>
mbed_official 580:3c14cb9b87c5 367 // <o.0> TX Buffer alert
mbed_official 580:3c14cb9b87c5 368 // <0=> TX buffer don't need service yet
mbed_official 580:3c14cb9b87c5 369 // <1=> TX buffer need service
mbed_official 580:3c14cb9b87c5 370 // <o.1> RX Buffer alert
mbed_official 580:3c14cb9b87c5 371 // <0=> RX buffer don't need service yet
mbed_official 580:3c14cb9b87c5 372 // <1=> RX buffer need service
mbed_official 580:3c14cb9b87c5 373 // <o.2> TX Buffer Empty
mbed_official 580:3c14cb9b87c5 374 // <0=> TX buffer have data
mbed_official 580:3c14cb9b87c5 375 // <1=> TX buffer empty
mbed_official 580:3c14cb9b87c5 376 // <o.3> TX Buffer Full
mbed_official 580:3c14cb9b87c5 377 // <0=> TX buffer not full
mbed_official 580:3c14cb9b87c5 378 // <1=> TX buffer full
mbed_official 580:3c14cb9b87c5 379 // <o.4> RX Buffer Empty
mbed_official 580:3c14cb9b87c5 380 // <0=> RX buffer have data
mbed_official 580:3c14cb9b87c5 381 // <1=> RX buffer empty
mbed_official 580:3c14cb9b87c5 382 // <o.5> RX Buffer Full
mbed_official 580:3c14cb9b87c5 383 // <0=> RX buffer not full
mbed_official 580:3c14cb9b87c5 384 // <1=> RX buffer full
mbed_official 580:3c14cb9b87c5 385 union {
mbed_official 580:3c14cb9b87c5 386 /*!< Offset: 0x008 Error Status Register (R/ ) */
mbed_official 580:3c14cb9b87c5 387 __I uint32_t ERROR; // <h> ERROR </h>
mbed_official 580:3c14cb9b87c5 388 // <o.0> TX error
mbed_official 580:3c14cb9b87c5 389 // <0=> Okay
mbed_official 580:3c14cb9b87c5 390 // <1=> TX overrun/underrun
mbed_official 580:3c14cb9b87c5 391 // <o.1> RX error
mbed_official 580:3c14cb9b87c5 392 // <0=> Okay
mbed_official 580:3c14cb9b87c5 393 // <1=> RX overrun/underrun
mbed_official 580:3c14cb9b87c5 394 /*!< Offset: 0x008 Error Clear Register ( /W) */
mbed_official 580:3c14cb9b87c5 395 __O uint32_t ERRORCLR; // <h> ERRORCLR </h>
mbed_official 580:3c14cb9b87c5 396 // <o.0> TX error
mbed_official 580:3c14cb9b87c5 397 // <0=> Okay
mbed_official 580:3c14cb9b87c5 398 // <1=> Clear TX error
mbed_official 580:3c14cb9b87c5 399 // <o.1> RX error
mbed_official 580:3c14cb9b87c5 400 // <0=> Okay
mbed_official 580:3c14cb9b87c5 401 // <1=> Clear RX error
mbed_official 580:3c14cb9b87c5 402 };
mbed_official 580:3c14cb9b87c5 403 /*!< Offset: 0x00C Divide ratio Register (R/W) */
mbed_official 580:3c14cb9b87c5 404 __IO uint32_t DIVIDE; // <h> Divide ratio for Left/Right clock </h>
mbed_official 580:3c14cb9b87c5 405 // <o.9..0> TX error (default 0x80)
mbed_official 580:3c14cb9b87c5 406 /*!< Offset: 0x010 Transmit Buffer ( /W) */
mbed_official 580:3c14cb9b87c5 407 __O uint32_t TXBUF; // <h> Transmit buffer </h>
mbed_official 580:3c14cb9b87c5 408 // <o.15..0> Right channel
mbed_official 580:3c14cb9b87c5 409 // <o.31..16> Left channel
mbed_official 580:3c14cb9b87c5 410 /*!< Offset: 0x014 Receive Buffer (R/ ) */
mbed_official 580:3c14cb9b87c5 411 __I uint32_t RXBUF; // <h> Receive buffer </h>
mbed_official 580:3c14cb9b87c5 412 // <o.15..0> Right channel
mbed_official 580:3c14cb9b87c5 413 // <o.31..16> Left channel
mbed_official 580:3c14cb9b87c5 414 uint32_t RESERVED1[186];
mbed_official 580:3c14cb9b87c5 415 __IO uint32_t ITCR; // <h> Integration Test Control Register </h>
mbed_official 580:3c14cb9b87c5 416 // <o.0> ITEN
mbed_official 580:3c14cb9b87c5 417 // <0=> Normal operation
mbed_official 580:3c14cb9b87c5 418 // <1=> Integration Test mode enable
mbed_official 580:3c14cb9b87c5 419 __O uint32_t ITIP1; // <h> Integration Test Input Register 1</h>
mbed_official 580:3c14cb9b87c5 420 // <o.0> SDIN
mbed_official 580:3c14cb9b87c5 421 __O uint32_t ITOP1; // <h> Integration Test Output Register 1</h>
mbed_official 580:3c14cb9b87c5 422 // <o.0> SDOUT
mbed_official 580:3c14cb9b87c5 423 // <o.1> SCLK
mbed_official 580:3c14cb9b87c5 424 // <o.2> LRCK
mbed_official 580:3c14cb9b87c5 425 // <o.3> IRQOUT
mbed_official 580:3c14cb9b87c5 426 } MPS2_I2S_TypeDef;
mbed_official 580:3c14cb9b87c5 427
mbed_official 580:3c14cb9b87c5 428 #define I2S_CONTROL_TXEN_Pos 0
mbed_official 580:3c14cb9b87c5 429 #define I2S_CONTROL_TXEN_Msk (1UL<<I2S_CONTROL_TXEN_Pos)
mbed_official 580:3c14cb9b87c5 430
mbed_official 580:3c14cb9b87c5 431 #define I2S_CONTROL_TXIRQEN_Pos 1
mbed_official 580:3c14cb9b87c5 432 #define I2S_CONTROL_TXIRQEN_Msk (1UL<<I2S_CONTROL_TXIRQEN_Pos)
mbed_official 580:3c14cb9b87c5 433
mbed_official 580:3c14cb9b87c5 434 #define I2S_CONTROL_RXEN_Pos 2
mbed_official 580:3c14cb9b87c5 435 #define I2S_CONTROL_RXEN_Msk (1UL<<I2S_CONTROL_RXEN_Pos)
mbed_official 580:3c14cb9b87c5 436
mbed_official 580:3c14cb9b87c5 437 #define I2S_CONTROL_RXIRQEN_Pos 3
mbed_official 580:3c14cb9b87c5 438 #define I2S_CONTROL_RXIRQEN_Msk (1UL<<I2S_CONTROL_RXIRQEN_Pos)
mbed_official 580:3c14cb9b87c5 439
mbed_official 580:3c14cb9b87c5 440 #define I2S_CONTROL_TXWLVL_Pos 8
mbed_official 580:3c14cb9b87c5 441 #define I2S_CONTROL_TXWLVL_Msk (7UL<<I2S_CONTROL_TXWLVL_Pos)
mbed_official 580:3c14cb9b87c5 442
mbed_official 580:3c14cb9b87c5 443 #define I2S_CONTROL_RXWLVL_Pos 12
mbed_official 580:3c14cb9b87c5 444 #define I2S_CONTROL_RXWLVL_Msk (7UL<<I2S_CONTROL_RXWLVL_Pos)
mbed_official 580:3c14cb9b87c5 445 /* FIFO reset*/
mbed_official 580:3c14cb9b87c5 446 #define I2S_CONTROL_FIFORST_Pos 16
mbed_official 580:3c14cb9b87c5 447 #define I2S_CONTROL_FIFORST_Msk (1UL<<I2S_CONTROL_FIFORST_Pos)
mbed_official 580:3c14cb9b87c5 448 /* Codec reset*/
mbed_official 580:3c14cb9b87c5 449 #define I2S_CONTROL_CODECRST_Pos 17
mbed_official 580:3c14cb9b87c5 450 #define I2S_CONTROL_CODECRST_Msk (1UL<<I2S_CONTROL_CODECRST_Pos)
mbed_official 580:3c14cb9b87c5 451
mbed_official 580:3c14cb9b87c5 452 #define I2S_STATUS_TXIRQ_Pos 0
mbed_official 580:3c14cb9b87c5 453 #define I2S_STATUS_TXIRQ_Msk (1UL<<I2S_STATUS_TXIRQ_Pos)
mbed_official 580:3c14cb9b87c5 454
mbed_official 580:3c14cb9b87c5 455 #define I2S_STATUS_RXIRQ_Pos 1
mbed_official 580:3c14cb9b87c5 456 #define I2S_STATUS_RXIRQ_Msk (1UL<<I2S_STATUS_RXIRQ_Pos)
mbed_official 580:3c14cb9b87c5 457
mbed_official 580:3c14cb9b87c5 458 #define I2S_STATUS_TXEmpty_Pos 2
mbed_official 580:3c14cb9b87c5 459 #define I2S_STATUS_TXEmpty_Msk (1UL<<I2S_STATUS_TXEmpty_Pos)
mbed_official 580:3c14cb9b87c5 460
mbed_official 580:3c14cb9b87c5 461 #define I2S_STATUS_TXFull_Pos 3
mbed_official 580:3c14cb9b87c5 462 #define I2S_STATUS_TXFull_Msk (1UL<<I2S_STATUS_TXFull_Pos)
mbed_official 580:3c14cb9b87c5 463
mbed_official 580:3c14cb9b87c5 464 #define I2S_STATUS_RXEmpty_Pos 4
mbed_official 580:3c14cb9b87c5 465 #define I2S_STATUS_RXEmpty_Msk (1UL<<I2S_STATUS_RXEmpty_Pos)
mbed_official 580:3c14cb9b87c5 466
mbed_official 580:3c14cb9b87c5 467 #define I2S_STATUS_RXFull_Pos 5
mbed_official 580:3c14cb9b87c5 468 #define I2S_STATUS_RXFull_Msk (1UL<<I2S_STATUS_RXFull_Pos)
mbed_official 580:3c14cb9b87c5 469
mbed_official 580:3c14cb9b87c5 470 #define I2S_ERROR_TXERR_Pos 0
mbed_official 580:3c14cb9b87c5 471 #define I2S_ERROR_TXERR_Msk (1UL<<I2S_ERROR_TXERR_Pos)
mbed_official 580:3c14cb9b87c5 472
mbed_official 580:3c14cb9b87c5 473 #define I2S_ERROR_RXERR_Pos 1
mbed_official 580:3c14cb9b87c5 474 #define I2S_ERROR_RXERR_Msk (1UL<<I2S_ERROR_RXERR_Pos)
mbed_official 580:3c14cb9b87c5 475
mbed_official 580:3c14cb9b87c5 476 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 477 /* SMSC9220 Register Definitions */
mbed_official 580:3c14cb9b87c5 478 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 479
mbed_official 580:3c14cb9b87c5 480 typedef struct // SMSC LAN9220
mbed_official 580:3c14cb9b87c5 481 {
mbed_official 580:3c14cb9b87c5 482 __I uint32_t RX_DATA_PORT; // Receive FIFO Ports (offset 0x0)
mbed_official 580:3c14cb9b87c5 483 uint32_t RESERVED1[0x7];
mbed_official 580:3c14cb9b87c5 484 __O uint32_t TX_DATA_PORT; // Transmit FIFO Ports (offset 0x20)
mbed_official 580:3c14cb9b87c5 485 uint32_t RESERVED2[0x7];
mbed_official 580:3c14cb9b87c5 486
mbed_official 580:3c14cb9b87c5 487 __I uint32_t RX_STAT_PORT; // Receive FIFO status port (offset 0x40)
mbed_official 580:3c14cb9b87c5 488 __I uint32_t RX_STAT_PEEK; // Receive FIFO status peek (offset 0x44)
mbed_official 580:3c14cb9b87c5 489 __I uint32_t TX_STAT_PORT; // Transmit FIFO status port (offset 0x48)
mbed_official 580:3c14cb9b87c5 490 __I uint32_t TX_STAT_PEEK; // Transmit FIFO status peek (offset 0x4C)
mbed_official 580:3c14cb9b87c5 491
mbed_official 580:3c14cb9b87c5 492 __I uint32_t ID_REV; // Chip ID and Revision (offset 0x50)
mbed_official 580:3c14cb9b87c5 493 __IO uint32_t IRQ_CFG; // Main Interrupt Configuration (offset 0x54)
mbed_official 580:3c14cb9b87c5 494 __IO uint32_t INT_STS; // Interrupt Status (offset 0x58)
mbed_official 580:3c14cb9b87c5 495 __IO uint32_t INT_EN; // Interrupt Enable Register (offset 0x5C)
mbed_official 580:3c14cb9b87c5 496 uint32_t RESERVED3; // Reserved for future use (offset 0x60)
mbed_official 580:3c14cb9b87c5 497 __I uint32_t BYTE_TEST; // Read-only byte order testing register 87654321h (offset 0x64)
mbed_official 580:3c14cb9b87c5 498 __IO uint32_t FIFO_INT; // FIFO Level Interrupts (offset 0x68)
mbed_official 580:3c14cb9b87c5 499 __IO uint32_t RX_CFG; // Receive Configuration (offset 0x6C)
mbed_official 580:3c14cb9b87c5 500 __IO uint32_t TX_CFG; // Transmit Configuration (offset 0x70)
mbed_official 580:3c14cb9b87c5 501 __IO uint32_t HW_CFG; // Hardware Configuration (offset 0x74)
mbed_official 580:3c14cb9b87c5 502 __IO uint32_t RX_DP_CTL; // RX Datapath Control (offset 0x78)
mbed_official 580:3c14cb9b87c5 503 __I uint32_t RX_FIFO_INF; // Receive FIFO Information (offset 0x7C)
mbed_official 580:3c14cb9b87c5 504 __I uint32_t TX_FIFO_INF; // Transmit FIFO Information (offset 0x80)
mbed_official 580:3c14cb9b87c5 505 __IO uint32_t PMT_CTRL; // Power Management Control (offset 0x84)
mbed_official 580:3c14cb9b87c5 506 __IO uint32_t GPIO_CFG; // General Purpose IO Configuration (offset 0x88)
mbed_official 580:3c14cb9b87c5 507 __IO uint32_t GPT_CFG; // General Purpose Timer Configuration (offset 0x8C)
mbed_official 580:3c14cb9b87c5 508 __I uint32_t GPT_CNT; // General Purpose Timer Count (offset 0x90)
mbed_official 580:3c14cb9b87c5 509 uint32_t RESERVED4; // Reserved for future use (offset 0x94)
mbed_official 580:3c14cb9b87c5 510 __IO uint32_t ENDIAN; // WORD SWAP Register (offset 0x98)
mbed_official 580:3c14cb9b87c5 511 __I uint32_t FREE_RUN; // Free Run Counter (offset 0x9C)
mbed_official 580:3c14cb9b87c5 512 __I uint32_t RX_DROP; // RX Dropped Frames Counter (offset 0xA0)
mbed_official 580:3c14cb9b87c5 513 __IO uint32_t MAC_CSR_CMD; // MAC CSR Synchronizer Command (offset 0xA4)
mbed_official 580:3c14cb9b87c5 514 __IO uint32_t MAC_CSR_DATA; // MAC CSR Synchronizer Data (offset 0xA8)
mbed_official 580:3c14cb9b87c5 515 __IO uint32_t AFC_CFG; // Automatic Flow Control Configuration (offset 0xAC)
mbed_official 580:3c14cb9b87c5 516 __IO uint32_t E2P_CMD; // EEPROM Command (offset 0xB0)
mbed_official 580:3c14cb9b87c5 517 __IO uint32_t E2P_DATA; // EEPROM Data (offset 0xB4)
mbed_official 580:3c14cb9b87c5 518
mbed_official 580:3c14cb9b87c5 519 } SMSC9220_TypeDef;
mbed_official 580:3c14cb9b87c5 520
mbed_official 580:3c14cb9b87c5 521 // SMSC9220 MAC Registers Indices
mbed_official 580:3c14cb9b87c5 522 #define SMSC9220_MAC_CR 0x1
mbed_official 580:3c14cb9b87c5 523 #define SMSC9220_MAC_ADDRH 0x2
mbed_official 580:3c14cb9b87c5 524 #define SMSC9220_MAC_ADDRL 0x3
mbed_official 580:3c14cb9b87c5 525 #define SMSC9220_MAC_HASHH 0x4
mbed_official 580:3c14cb9b87c5 526 #define SMSC9220_MAC_HASHL 0x5
mbed_official 580:3c14cb9b87c5 527 #define SMSC9220_MAC_MII_ACC 0x6
mbed_official 580:3c14cb9b87c5 528 #define SMSC9220_MAC_MII_DATA 0x7
mbed_official 580:3c14cb9b87c5 529 #define SMSC9220_MAC_FLOW 0x8
mbed_official 580:3c14cb9b87c5 530 #define SMSC9220_MAC_VLAN1 0x9
mbed_official 580:3c14cb9b87c5 531 #define SMSC9220_MAC_VLAN2 0xA
mbed_official 580:3c14cb9b87c5 532 #define SMSC9220_MAC_WUFF 0xB
mbed_official 580:3c14cb9b87c5 533 #define SMSC9220_MAC_WUCSR 0xC
mbed_official 580:3c14cb9b87c5 534
mbed_official 580:3c14cb9b87c5 535 // SMSC9220 PHY Registers Indices
mbed_official 580:3c14cb9b87c5 536 #define SMSC9220_PHY_BCONTROL 0x0
mbed_official 580:3c14cb9b87c5 537 #define SMSC9220_PHY_BSTATUS 0x1
mbed_official 580:3c14cb9b87c5 538 #define SMSC9220_PHY_ID1 0x2
mbed_official 580:3c14cb9b87c5 539 #define SMSC9220_PHY_ID2 0x3
mbed_official 580:3c14cb9b87c5 540 #define SMSC9220_PHY_ANEG_ADV 0x4
mbed_official 580:3c14cb9b87c5 541 #define SMSC9220_PHY_ANEG_LPA 0x5
mbed_official 580:3c14cb9b87c5 542 #define SMSC9220_PHY_ANEG_EXP 0x6
mbed_official 580:3c14cb9b87c5 543 #define SMSC9220_PHY_MCONTROL 0x17
mbed_official 580:3c14cb9b87c5 544 #define SMSC9220_PHY_MSTATUS 0x18
mbed_official 580:3c14cb9b87c5 545 #define SMSC9220_PHY_CSINDICATE 0x27
mbed_official 580:3c14cb9b87c5 546 #define SMSC9220_PHY_INTSRC 0x29
mbed_official 580:3c14cb9b87c5 547 #define SMSC9220_PHY_INTMASK 0x30
mbed_official 580:3c14cb9b87c5 548 #define SMSC9220_PHY_CS 0x31
mbed_official 580:3c14cb9b87c5 549
mbed_official 580:3c14cb9b87c5 550 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 551 /* Peripheral memory map */
mbed_official 580:3c14cb9b87c5 552 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 553
mbed_official 580:3c14cb9b87c5 554 #define MPS2_SSP1_BASE (0x40020000ul) /* User SSP Base Address */
mbed_official 580:3c14cb9b87c5 555 #define MPS2_SSP0_BASE (0x40021000ul) /* CLCD SSP Base Address */
mbed_official 580:3c14cb9b87c5 556 #define MPS2_TSC_I2C_BASE (0x40022000ul) /* Touch Screen I2C Base Address */
mbed_official 580:3c14cb9b87c5 557 #define MPS2_AAIC_I2C_BASE (0x40023000ul) /* Audio Interface I2C Base Address */
mbed_official 580:3c14cb9b87c5 558 #define MPS2_AAIC_I2S_BASE (0x40024000ul) /* Audio Interface I2S Base Address */
mbed_official 580:3c14cb9b87c5 559 #define MPS2_FPGAIO_BASE (0x40028000ul) /* FPGAIO Base Address */
mbed_official 580:3c14cb9b87c5 560 #define MPS2_SCC_BASE (0x4002F000ul) /* SCC Base Address */
mbed_official 580:3c14cb9b87c5 561
mbed_official 580:3c14cb9b87c5 562 #ifdef CORTEX_M7
mbed_official 580:3c14cb9b87c5 563 #define SMSC9220_BASE (0xA0000000ul) /* Ethernet SMSC9220 Base Address */
mbed_official 580:3c14cb9b87c5 564 #else
mbed_official 580:3c14cb9b87c5 565 #define SMSC9220_BASE (0x40200000ul) /* Ethernet SMSC9220 Base Address */
mbed_official 580:3c14cb9b87c5 566 #endif
mbed_official 580:3c14cb9b87c5 567
mbed_official 580:3c14cb9b87c5 568 #define MPS2_VGA_BUFFER (0x41100000ul) /* VGA Buffer Base Address */
mbed_official 580:3c14cb9b87c5 569 #define MPS2_VGA_TEXT_BUFFER (0x41000000ul) /* VGA Text Buffer Address */
mbed_official 580:3c14cb9b87c5 570
mbed_official 580:3c14cb9b87c5 571 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 572 /* Peripheral declaration */
mbed_official 580:3c14cb9b87c5 573 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 574
mbed_official 580:3c14cb9b87c5 575 #define SMSC9220 ((SMSC9220_TypeDef *) SMSC9220_BASE )
mbed_official 580:3c14cb9b87c5 576 #define MPS2_TS_I2C ((MPS2_I2C_TypeDef *) MPS2_TSC_I2C_BASE )
mbed_official 580:3c14cb9b87c5 577 #define MPS2_AAIC_I2C ((MPS2_I2C_TypeDef *) MPS2_AAIC_I2C_BASE )
mbed_official 580:3c14cb9b87c5 578 #define MPS2_AAIC_I2S ((MPS2_I2S_TypeDef *) MPS2_AAIC_I2S_BASE )
mbed_official 580:3c14cb9b87c5 579 #define MPS2_FPGAIO ((MPS2_FPGAIO_TypeDef *) MPS2_FPGAIO_BASE )
mbed_official 580:3c14cb9b87c5 580 #define MPS2_SCC ((MPS2_SCC_TypeDef *) MPS2_SCC_BASE )
mbed_official 580:3c14cb9b87c5 581 #define MPS2_SSP0 ((MPS2_SSP_TypeDef *) MPS2_SSP0_BASE )
mbed_official 580:3c14cb9b87c5 582 #define MPS2_SSP1 ((MPS2_SSP_TypeDef *) MPS2_SSP1_BASE )
mbed_official 580:3c14cb9b87c5 583
mbed_official 580:3c14cb9b87c5 584 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 585 /* General Function Definitions */
mbed_official 580:3c14cb9b87c5 586 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 587
mbed_official 580:3c14cb9b87c5 588
mbed_official 580:3c14cb9b87c5 589 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 590 /* General MACRO Definitions */
mbed_official 580:3c14cb9b87c5 591 /******************************************************************************/
mbed_official 580:3c14cb9b87c5 592
mbed_official 580:3c14cb9b87c5 593
mbed_official 580:3c14cb9b87c5 594
mbed_official 580:3c14cb9b87c5 595 #endif /* __SMM_MPS2_H */