Skip to content

Commit

Permalink
Merge pull request ARMmbed#31 from yennster/uart-debug
Browse files Browse the repository at this point in the history
UART IRQ Handler Implementation
  • Loading branch information
Jenny Plunkett authored Jul 19, 2018
2 parents 395b41d + a65fa1a commit 2b55078
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ typedef struct
union {
__I uint32_t RSR; /*!< Receive Status, Address offset : 0x04 */
__O uint32_t ECR; /*!< Error Clear, Address offset : 0x04 */
} STATUS;
};
uint32_t RESERVED0[4];
__IO uint32_t FR; /*!< Flags, Address offset : 0x18 */
uint32_t RESERVED1[1];
__IO uint32_t ILPR; /*!< IrDA Low-power Counter, Address offset : 0x20 */
__IO uint32_t IBRD; /*!< Integer Baud Rate, Address offset : 0x24 */
__IO uint32_t FBRD; /*!< Fractional Baud Rate, Address offset : 0x28 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <ti/devices/cc32xx/driverlib/timer.h>
#include <ti/devices/cc32xx/driverlib/uart.h>
#include <ti/devices/cc32xx/driverlib/udma.h>
#include <ti/devices/cc32xx/driverlib/interrupt.h>
#include <ti/devices/cc32xx/driverlib/wdt.h>

#include "CC3220SF_LAUNCHXL.h"
Expand All @@ -67,6 +68,8 @@
*/
void CC3220SF_LAUNCHXL_initGeneral(void)
{
MAP_IntMasterEnable();
//MAP_IntEnable(FAULT_SYSTICK);
PRCMCC3200MCUInit();
}

Expand Down
24 changes: 7 additions & 17 deletions targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/gpio_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include <ti/devices/cc32xx/inc/hw_ints.h>
#include <ti/devices/cc32xx/driverlib/prcm.h>



static const unsigned long g_ulPinToGPIOPinBit[64] =
{
GPIO_PIN_2,GPIO_PIN_3,GPIO_PIN_4,GPIO_PIN_5,GPIO_PIN_6,GPIO_PIN_7,GPIO_PIN_0,GPIO_PIN_1,255,255,GPIO_PIN_2,
Expand All @@ -45,7 +43,6 @@ const uint16_t PinTypes [] = {
PIN_TYPE_ANALOG
};


static const PinMap PinMap_GPIO[] = {
{PIN_50, CC3220SF_GPIOA0_BASE, 0}, //GPIO_00 (PM/Dig Mux)
{PIN_55, CC3220SF_GPIOA0_BASE, 0}, //GPIO_01
Expand Down Expand Up @@ -76,7 +73,7 @@ static const PinMap PinMap_GPIO[] = {

{PIN_17, CC3220SF_GPIOA3_BASE, 0}, //GPIO_24
{PIN_21, CC3220SF_GPIOA3_BASE, 0}, //GPIO_25
//{PIN_RESERVED, CC3220SF_GPIOA3_BASE, 0}, //GPIO_26 (Restricted Use; Antenna Selection 1 Only) No package pin associate with this GPIO
//{PIN_RESERVED, CC3220SF_GPIOA3_BASE, 0}, //GPIO_26 (Restricted Use; Antenna Selection 1 Only) No package pin associate with this GPIO
//{PIN_RESERVED, CC3220SF_GPIOA3_BASE, 0}, //GPIO_27 (Restricted Use; Antenna Selection 1 Only) No package pin associate with this GPIO
{PIN_18, CC3220SF_GPIOA3_BASE, 0}, //GPIO_28
{PIN_20, CC3220SF_GPIOA3_BASE, 0}, //GPIO_29
Expand All @@ -101,45 +98,38 @@ void gpio_init(gpio_t *obj, PinName pin)
obj->gpio_port_base_addr = gpio_base;
obj->pin = pin;


//figuring out PRCM GPIO CLOCK Index

// determine PRCM GPIO CLOCK index
unsigned short prcm_peripheral;
switch (gpio_base)
{
case CC3220SF_GPIOA0_BASE:
prcm_peripheral = PRCM_GPIOA0;
break;

case CC3220SF_GPIOA1_BASE:
prcm_peripheral = PRCM_GPIOA1;
break;

case CC3220SF_GPIOA2_BASE:
prcm_peripheral = PRCM_GPIOA2;
break;

case CC3220SF_GPIOA3_BASE:
prcm_peripheral = PRCM_GPIOA3;
break;
break;
default:
break;
}

//initialize GPIO PORT clock
// initialize GPIO PORT clock
PRCMPeripheralClkEnable(prcm_peripheral, PRCM_RUN_MODE_CLK || PRCM_SLP_MODE_CLK);

//wait until gpio clock settle
while(!PRCMPeripheralStatusGet(prcm_peripheral)){}

// wait for gpio clock to settle
while(!PRCMPeripheralStatusGet(prcm_peripheral));
}

void gpio_mode(gpio_t *obj, PinMode mode)
{
obj->mode = mode;

PinModeSet(obj->pin, PinTypes[mode]);
pin_mode(obj->pin, mode);
pin_mode(obj->pin, mode);
}

void gpio_dir(gpio_t *obj, PinDirection direction)
Expand Down
17 changes: 8 additions & 9 deletions targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/pinmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ void pin_mode(PinName pin, PinMode mode)
{
MBED_ASSERT(pin != (PinName)NC);
switch(mode) {
case PullNone: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD); break;
case PullUp: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD_PU); break;
case PullDown: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD_PD); break;
case OpenDrain: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_OD); break;
case OpenDrainPullUp: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_OD_PU); break;
case OpenDrainPullDown: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_OD_PD); break;
case Analog: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_ANALOG); break;
default: PinConfigSet(pin, PIN_STRENGTH_2MA|PIN_STRENGTH_4MA, PIN_TYPE_STD); break;
case PullNone: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_STD); break;
case PullUp: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_STD_PU); break;
case PullDown: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_STD_PD); break;
case OpenDrain: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_OD); break;
case OpenDrainPullUp: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_OD_PU); break;
case OpenDrainPullDown: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_OD_PD); break;
case Analog: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_ANALOG); break;
default: PinConfigSet(pin, PIN_STRENGTH_2MA, PIN_TYPE_STD); break;
}

}
Loading

0 comments on commit 2b55078

Please sign in to comment.