I don't know

Dependents:   MX106-finaltest

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Sep 25 14:15:10 2015 +0100
Revision:
627:4fa1328d9c60
Parent:
593:78ee8643776a
Synchronized with git revision fe238a91ab7a4d1d72c4cab9da04967c619d54ad

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

Silicon Labs - Add support for low-power async Serial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 627:4fa1328d9c60 1 /***************************************************************************//**
mbed_official 627:4fa1328d9c60 2 * @file objects.h
mbed_official 627:4fa1328d9c60 3 *******************************************************************************
mbed_official 627:4fa1328d9c60 4 * @section License
mbed_official 627:4fa1328d9c60 5 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
mbed_official 627:4fa1328d9c60 6 *******************************************************************************
mbed_official 525:c320967f86b9 7 *
mbed_official 627:4fa1328d9c60 8 * Permission is granted to anyone to use this software for any purpose,
mbed_official 627:4fa1328d9c60 9 * including commercial applications, and to alter it and redistribute it
mbed_official 627:4fa1328d9c60 10 * freely, subject to the following restrictions:
mbed_official 525:c320967f86b9 11 *
mbed_official 627:4fa1328d9c60 12 * 1. The origin of this software must not be misrepresented; you must not
mbed_official 627:4fa1328d9c60 13 * claim that you wrote the original software.
mbed_official 627:4fa1328d9c60 14 * 2. Altered source versions must be plainly marked as such, and must not be
mbed_official 627:4fa1328d9c60 15 * misrepresented as being the original software.
mbed_official 627:4fa1328d9c60 16 * 3. This notice may not be removed or altered from any source distribution.
mbed_official 525:c320967f86b9 17 *
mbed_official 627:4fa1328d9c60 18 * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
mbed_official 627:4fa1328d9c60 19 * obligation to support this Software. Silicon Labs is providing the
mbed_official 627:4fa1328d9c60 20 * Software "AS IS", with no express or implied warranties of any kind,
mbed_official 627:4fa1328d9c60 21 * including, but not limited to, any implied warranties of merchantability
mbed_official 627:4fa1328d9c60 22 * or fitness for any particular purpose or warranties against infringement
mbed_official 627:4fa1328d9c60 23 * of any proprietary rights of a third party.
mbed_official 627:4fa1328d9c60 24 *
mbed_official 627:4fa1328d9c60 25 * Silicon Labs will not be liable for any consequential, incidental, or
mbed_official 627:4fa1328d9c60 26 * special damages, or any other relief, or for any claim by any third party,
mbed_official 627:4fa1328d9c60 27 * arising from your use of this Software.
mbed_official 627:4fa1328d9c60 28 *
mbed_official 627:4fa1328d9c60 29 ******************************************************************************/
mbed_official 627:4fa1328d9c60 30
mbed_official 525:c320967f86b9 31 #ifndef MBED_OBJECTS_H
mbed_official 525:c320967f86b9 32 #define MBED_OBJECTS_H
mbed_official 525:c320967f86b9 33
mbed_official 525:c320967f86b9 34 #include "PinNames.h"
mbed_official 525:c320967f86b9 35 #include "PeripheralNames.h"
mbed_official 525:c320967f86b9 36 #include "PortNames.h"
mbed_official 525:c320967f86b9 37 #include "em_i2c.h"
mbed_official 525:c320967f86b9 38 #include "em_dma.h"
mbed_official 525:c320967f86b9 39 #include "em_cmu.h"
mbed_official 525:c320967f86b9 40 #include "dma_api_HAL.h"
mbed_official 525:c320967f86b9 41
mbed_official 525:c320967f86b9 42 #ifdef __cplusplus
mbed_official 525:c320967f86b9 43 extern "C" {
mbed_official 525:c320967f86b9 44 #endif
mbed_official 525:c320967f86b9 45
mbed_official 593:78ee8643776a 46 typedef struct {
mbed_official 593:78ee8643776a 47 PinName pin:8;
mbed_official 593:78ee8643776a 48 PinMode mode:6;
mbed_official 593:78ee8643776a 49 PinDirection dir:2;
mbed_official 593:78ee8643776a 50 } gpio_t;
mbed_official 593:78ee8643776a 51
mbed_official 525:c320967f86b9 52 #if DEVICE_ANALOGIN
mbed_official 525:c320967f86b9 53 struct analogin_s {
mbed_official 525:c320967f86b9 54 ADC_TypeDef *adc;
mbed_official 525:c320967f86b9 55 uint32_t channel;
mbed_official 525:c320967f86b9 56 };
mbed_official 525:c320967f86b9 57 #endif
mbed_official 525:c320967f86b9 58
mbed_official 525:c320967f86b9 59 #if DEVICE_ANALOGOUT
mbed_official 525:c320967f86b9 60 struct dac_s {
mbed_official 525:c320967f86b9 61 DAC_TypeDef *dac;
mbed_official 525:c320967f86b9 62 uint32_t channel;
mbed_official 525:c320967f86b9 63 };
mbed_official 525:c320967f86b9 64 #endif
mbed_official 525:c320967f86b9 65
mbed_official 525:c320967f86b9 66 #if DEVICE_I2C
mbed_official 525:c320967f86b9 67 struct i2c_s {
mbed_official 525:c320967f86b9 68 I2C_TypeDef *i2c;
mbed_official 525:c320967f86b9 69 int loc;
mbed_official 525:c320967f86b9 70 uint8_t index;
mbed_official 525:c320967f86b9 71 PinName sda;
mbed_official 525:c320967f86b9 72 PinName scl;
mbed_official 525:c320967f86b9 73 uint32_t clock;
mbed_official 525:c320967f86b9 74 #if DEVICE_I2C_ASYNCH
mbed_official 525:c320967f86b9 75 uint32_t events;
mbed_official 525:c320967f86b9 76 I2C_TransferSeq_TypeDef xfer;
mbed_official 525:c320967f86b9 77 #endif
mbed_official 525:c320967f86b9 78 };
mbed_official 525:c320967f86b9 79 #endif
mbed_official 525:c320967f86b9 80
mbed_official 525:c320967f86b9 81 #if DEVICE_PORTOUT
mbed_official 525:c320967f86b9 82 struct port_s {
mbed_official 525:c320967f86b9 83 PortName port;
mbed_official 525:c320967f86b9 84 uint32_t mask;
mbed_official 525:c320967f86b9 85 PinDirection dir;
mbed_official 525:c320967f86b9 86 };
mbed_official 525:c320967f86b9 87 #endif
mbed_official 525:c320967f86b9 88
mbed_official 525:c320967f86b9 89 #if DEVICE_PWMOUT
mbed_official 525:c320967f86b9 90 struct pwmout_s {
mbed_official 525:c320967f86b9 91 //The period of the pulse in clock cycles
mbed_official 556:a217bc785985 92 uint16_t period_cycles;
mbed_official 525:c320967f86b9 93 //The width of the pulse in clock cycles
mbed_official 556:a217bc785985 94 uint16_t width_cycles;
mbed_official 525:c320967f86b9 95 //Channel on TIMER
mbed_official 525:c320967f86b9 96 uint32_t channel;
mbed_official 525:c320967f86b9 97 PinName pin;
mbed_official 525:c320967f86b9 98 };
mbed_official 525:c320967f86b9 99 #endif
mbed_official 525:c320967f86b9 100
mbed_official 525:c320967f86b9 101 #if DEVICE_INTERRUPTIN
mbed_official 525:c320967f86b9 102 struct gpio_irq_s {
mbed_official 593:78ee8643776a 103 PinName pin:8; // Pin number 4 least significant bits, port number 4 most significant bits
mbed_official 593:78ee8643776a 104 uint32_t risingEdge:1;
mbed_official 593:78ee8643776a 105 uint32_t fallingEdge:1;
mbed_official 525:c320967f86b9 106 };
mbed_official 525:c320967f86b9 107 #endif
mbed_official 525:c320967f86b9 108
mbed_official 525:c320967f86b9 109 #if DEVICE_SERIAL
mbed_official 525:c320967f86b9 110 #define SERIAL_NUM_UARTS (7)
mbed_official 525:c320967f86b9 111
mbed_official 525:c320967f86b9 112 struct serial_s {
mbed_official 525:c320967f86b9 113 union {
mbed_official 525:c320967f86b9 114 USART_TypeDef *uart;
mbed_official 525:c320967f86b9 115 LEUART_TypeDef *leuart;
mbed_official 525:c320967f86b9 116 } periph;
mbed_official 525:c320967f86b9 117 uint32_t location;
mbed_official 525:c320967f86b9 118 PinName rx_pin;
mbed_official 525:c320967f86b9 119 PinName tx_pin;
mbed_official 525:c320967f86b9 120 #if DEVICE_SERIAL_ASYNCH
mbed_official 525:c320967f86b9 121 uint32_t events;
mbed_official 525:c320967f86b9 122 DMA_OPTIONS_t dmaOptionsTX;
mbed_official 525:c320967f86b9 123 DMA_OPTIONS_t dmaOptionsRX;
mbed_official 525:c320967f86b9 124 #endif
mbed_official 525:c320967f86b9 125 };
mbed_official 525:c320967f86b9 126 #endif
mbed_official 525:c320967f86b9 127
mbed_official 525:c320967f86b9 128 #if DEVICE_SPI
mbed_official 525:c320967f86b9 129 struct spi_s {
mbed_official 525:c320967f86b9 130 USART_TypeDef *spi;
mbed_official 525:c320967f86b9 131 int location;
mbed_official 525:c320967f86b9 132 uint8_t bits;
mbed_official 525:c320967f86b9 133 uint8_t master;
mbed_official 525:c320967f86b9 134 #if DEVICE_SPI_ASYNCH
mbed_official 525:c320967f86b9 135 uint32_t event;
mbed_official 525:c320967f86b9 136 DMA_OPTIONS_t dmaOptionsTX;
mbed_official 525:c320967f86b9 137 DMA_OPTIONS_t dmaOptionsRX;
mbed_official 525:c320967f86b9 138 #endif
mbed_official 525:c320967f86b9 139 };
mbed_official 525:c320967f86b9 140 #endif
mbed_official 525:c320967f86b9 141
mbed_official 525:c320967f86b9 142 #if DEVICE_RTC
mbed_official 525:c320967f86b9 143 struct lp_timer_s {
mbed_official 525:c320967f86b9 144 uint32_t start;
mbed_official 525:c320967f86b9 145 uint32_t stop;
mbed_official 525:c320967f86b9 146 };
mbed_official 525:c320967f86b9 147 #endif
mbed_official 525:c320967f86b9 148
mbed_official 525:c320967f86b9 149 #if DEVICE_SLEEP
mbed_official 525:c320967f86b9 150 #define NUM_SLEEP_MODES 5
mbed_official 525:c320967f86b9 151 typedef enum {
mbed_official 548:1abac31e188e 152 EM0 = 0,
mbed_official 548:1abac31e188e 153 EM1 = 1,
mbed_official 548:1abac31e188e 154 EM2 = 2,
mbed_official 548:1abac31e188e 155 EM3 = 3,
mbed_official 548:1abac31e188e 156 EM4 = 4
mbed_official 525:c320967f86b9 157 } sleepstate_enum;
mbed_official 525:c320967f86b9 158 #endif
mbed_official 525:c320967f86b9 159
mbed_official 525:c320967f86b9 160
mbed_official 525:c320967f86b9 161 #ifdef __cplusplus
mbed_official 525:c320967f86b9 162 }
mbed_official 525:c320967f86b9 163 #endif
mbed_official 525:c320967f86b9 164
mbed_official 525:c320967f86b9 165 #endif