Skip to content

Commit ac017e8

Browse files
author
Jenny Plunkett
authored
Merge pull request ARMmbed#27 from yennster/uart-debug
UART is working (no IRQ handler)
2 parents fc98068 + 779c20b commit ac017e8

File tree

8 files changed

+307
-132
lines changed

8 files changed

+307
-132
lines changed

targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/PinNames.h

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -28,43 +28,43 @@ typedef enum {
2828
} PinDirection;
2929

3030
typedef enum {
31-
P01 = 0x00,
32-
P02 = 0x01,
33-
P03 = 0x02,
34-
P04 = 0x03,
35-
P05 = 0x04,
36-
P06 = 0x05,
37-
P07 = 0x06,
38-
P08 = 0x07,
39-
P11 = 0x0A,
40-
P12 = 0x0B,
41-
P13 = 0x0C,
42-
P14 = 0x0D,
43-
P15 = 0x0E,
44-
P16 = 0x0F,
45-
P17 = 0x10,
46-
P18 = 0x11,
47-
P19 = 0x12,
48-
P20 = 0x13,
49-
P21 = 0x14,
50-
P45 = 0x2C,
51-
P46 = 0x2D,
52-
P47 = 0x2E,
53-
P48 = 0x2F,
54-
P49 = 0x30,
55-
P50 = 0x31,
56-
P52 = 0x33,
57-
P53 = 0x34,
58-
P55 = 0x36,
59-
P56 = 0x37,
60-
P57 = 0x38,
61-
P58 = 0x39,
62-
P59 = 0x3A,
63-
P60 = 0x3B,
64-
P61 = 0x3C,
65-
P62 = 0x3D,
66-
P63 = 0x3E,
67-
P64 = 0x3F,
31+
P01 = 0x00000000,
32+
P02 = 0x00000001,
33+
P03 = 0x00000002,
34+
P04 = 0x00000003,
35+
P05 = 0x00000004,
36+
P06 = 0x00000005,
37+
P07 = 0x00000006,
38+
P08 = 0x00000007,
39+
P11 = 0x0000000A,
40+
P12 = 0x0000000B,
41+
P13 = 0x0000000C,
42+
P14 = 0x0000000D,
43+
P15 = 0x0000000E,
44+
P16 = 0x0000000F,
45+
P17 = 0x00000010,
46+
P18 = 0x00000011,
47+
P19 = 0x00000012,
48+
P20 = 0x00000013,
49+
P21 = 0x00000014,
50+
P45 = 0x0000002C,
51+
P46 = 0x0000002D,
52+
P47 = 0x0000002E,
53+
P48 = 0x0000002F,
54+
P49 = 0x00000030,
55+
P50 = 0x00000031,
56+
P52 = 0x00000033,
57+
P53 = 0x00000034,
58+
P55 = 0x00000036,
59+
P56 = 0x00000037,
60+
P57 = 0x00000038,
61+
P58 = 0x00000039,
62+
P59 = 0x0000003A,
63+
P60 = 0x0000003B,
64+
P61 = 0x0000003C,
65+
P62 = 0x0000003D,
66+
P63 = 0x0000003E,
67+
P64 = 0x0000003F,
6868

6969
PIN_01 = P01,
7070
PIN_02 = P02,
@@ -117,12 +117,15 @@ typedef enum {
117117
NC = (int)0xFFFFFFFF
118118
} PinName;
119119

120-
121120
typedef enum {
122121
PullNone = 0,
123-
PullDown = 1,
124-
PullUp = 2,
125-
PullDefault = PullUp
122+
PullUp = 1,
123+
PullDown = 2,
124+
OpenDrain = 3,
125+
OpenDrainPullUp = 4,
126+
OpenDrainPullDown = 5,
127+
Analog = 6,
128+
PullDefault = PullDown
126129
} PinMode;
127130

128131
#ifdef __cplusplus

targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/device/CC3220SF.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,14 @@ typedef enum IRQn
148148
/* ================ UART ================ */
149149
/* =========================================================================================================================== */
150150

151+
151152
/**
152153
* @brief UART
153154
*/
154155
typedef struct
155156
{
156157
__IO uint32_t DR; /*!< Data, Address offset : 0x00 */
157-
union {
158+
union {
158159
__I uint32_t RSR; /*!< Receive Status, Address offset : 0x04 */
159160
__O uint32_t ECR; /*!< Error Clear, Address offset : 0x04 */
160161
} STATUS;
@@ -171,7 +172,7 @@ typedef struct
171172
__IO uint32_t MIS; /*!< Masked Interrupt Status , Address offset : 0x40 */
172173
__O uint32_t ICR; /*!< Interrupt Clear, Address offset : 0x44 */
173174
__IO uint32_t DMACTL; /*!< DMA Control, Address offset : 0x48 */
174-
uint32_t RESERVED1[6];
175+
//uint32_t RESERVED1[6];
175176
//__IO uint32_t LCTL; /*!< Address offset : 0x90 */
176177
//__IO uint32_t LSS; /*!< Address offset : 0x94 */
177178
//__IO uint32_t LTIM; /*!< Address offset : 0x98 */
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2018 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_GPIO_OBJECT_H
17+
#define MBED_GPIO_OBJECT_H
18+
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
23+
typedef struct {
24+
PinName pin;
25+
} gpio_t;
26+
27+
static inline int gpio_is_connected(const gpio_t *obj)
28+
{
29+
return obj->pin != (PinName)NC;
30+
}
31+
32+
#ifdef __cplusplus
33+
}
34+
#endif
35+
36+
#endif

targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/objects.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "PortNames.h"
2121
#include "PeripheralNames.h"
2222
#include "PinNames.h"
23+
#include "serial_object.h"
2324

2425
#ifdef __cplusplus
2526
extern "C" {
@@ -46,6 +47,10 @@ struct serial_s {
4647
PinName ctsPin; /*! UART clear to send (CTS) pin assignment */
4748
PinName rtsPin; /*! UART request to send (RTS) pin assignment */
4849
unsigned int powerMgrId; /* Determined from base address */
50+
unsigned long peripheralId; /* Value that can be passed to PRCM functions */
51+
UART_LEN dataLength; /* Data length for UART */
52+
UART_STOP stopBits; /* Stop bits for UART */
53+
UART_PAR parityType; /* Parity bit type for UART */
4954
};
5055

5156
#ifdef __cplusplus

targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/pinmap.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,34 @@
1717
#include "pinmap.h"
1818
#include "mbed_error.h"
1919

20+
#include <ti/devices/cc32xx/inc/hw_types.h>
21+
#include <ti/devices/cc32xx/inc/hw_memmap.h>
22+
#include <ti/devices/cc32xx/inc/hw_ocp_shared.h>
23+
#include <ti/devices/cc32xx/driverlib/pin.h>
2024

25+
/**
26+
* Configure pin (mode, speed, output type and pull-up/pull-down)
27+
*/
2128
void pin_function(PinName pin, int function)
2229
{
2330
MBED_ASSERT(pin != (PinName)NC);
24-
2531
}
2632

33+
/**
34+
* Configure pin pull-up/pull-down
35+
*/
2736
void pin_mode(PinName pin, PinMode mode)
2837
{
2938
MBED_ASSERT(pin != (PinName)NC);
39+
switch(mode) {
40+
case PullNone: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD); break;
41+
case PullUp: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD_PU); break;
42+
case PullDown: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD_PD); break;
43+
case OpenDrain: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_OD); break;
44+
case OpenDrainPullUp: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_OD_PU); break;
45+
case OpenDrainPullDown: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_OD_PD); break;
46+
case Analog: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_ANALOG); break;
47+
default: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD); break;
48+
}
49+
3050
}

0 commit comments

Comments
 (0)