我的项目使用 TI TM4C129ENCPDTI3 MCU,使用 Code Composer Studio 版本 9.0.1.00004,TivaWare_C_Series-2.2.0.295、bios_6_83_00_18 和 xdctools_3_32_00_06_core 在 Windows 上运行。
我正在开展一个项目,该项目要求我尽可能高效地一次写入 8 位 GPIO 端口。我一直在寻找并找不到直接端口写入或读取功能;当然,我忽略了显而易见的事情。这是我曾经使用过的每个 IDE/MCU 的基本功能。我觉得问的很蠢,但我很难过。
需要完成以下方面的事情:
uint8_t outByte = 0x55;
GPIO_PORTA = outByte; // 我需要一个语句,将 0x55 数据并行写入端口引脚,而不必求助于按位反汇编 outByte 并一次发送一位。
这是我试过的代码:
#include <ti/sysbios/BIOS.h>
#include <stdbool.h>
#include "pinout.h"
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/rom_map.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/interrupt.h"
#include "Lan.h"
#include "UdpServer.h"
#include "RIB_IO.h"
/* XDC module Headers */
#include <xdc/std.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
/* BIOS module Headers */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
.
.
.
Int main()
{
SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
//
// Set the clocking to run directly from the crystal at 120MHz.
//
g_SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
PinoutSet();
.
.
.
// Write PORT Test Data (A,D,K,L)
*(volatile unsigned long *)0x400043FC = 0x55;
}
PINOUT.C
//*****************************************************************************
//
// Configure the device pins for different signals
//
// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//*****************************************************************************
// This file was automatically generated on 1/12/2021 at 4:57:49 PM
// by TI PinMux version 1.6.0+1543
//
//*****************************************************************************
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "pinout.h"
//*****************************************************************************
//
//! \addtogroup pinout_api
//! @{
//
//*****************************************************************************
//*****************************************************************************
//
//! Configures the device pins for the customer specific usage.
//!
//! \return None.
//
//*****************************************************************************
void
PinoutSet(void)
{
//
// Enable Peripheral Clocks
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
//
// Configure the GPIO Pin Mux for PF0
// for EN0LED0
//
MAP_GPIOPinConfigure(GPIO_PF0_EN0LED0);
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PF4
// for EN0LED1
//
MAP_GPIOPinConfigure(GPIO_PF4_EN0LED1);
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_4);
//
// Configure the GPIO Pin Mux for PG0
// for EN0PPS
//
MAP_GPIOPinConfigure(GPIO_PG0_EN0PPS);
GPIOPinTypeEthernetMII(GPIO_PORTG_BASE, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PF1
// for EN0LED2
//
MAP_GPIOPinConfigure(GPIO_PF1_EN0LED2);
GPIOPinTypeEthernetLED(GPIO_PORTF_BASE, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PA0
// for GPIO_PA0
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_0);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_0, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PA1
// for GPIO_PA1
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_1);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_1, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PA2
// for GPIO_PA2
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_2, GPIO_PIN_2);
//
// Configure the GPIO Pin Mux for PA3
// for GPIO_PA3
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_PIN_3);
//
// Configure the GPIO Pin Mux for PA4
// for GPIO_PA4
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_4);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_4, GPIO_PIN_4);
//
// Configure the GPIO Pin Mux for PA5
// for GPIO_PA5
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_5);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_5, GPIO_PIN_5);
//
// Configure the GPIO Pin Mux for PA6
// for GPIO_PA6
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_6);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, GPIO_PIN_6);
//
// Configure the GPIO Pin Mux for PA7
// for GPIO_PA7
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7);
MAP_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7, GPIO_PIN_7);
//
// Configure the GPIO Pin Mux for PD0
// for GPIO_PD0
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PD1
// for GPIO_PD1
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_1);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PD2
// for GPIO_PD2
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_2);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_2, GPIO_PIN_2);
//
// Configure the GPIO Pin Mux for PD3
// for GPIO_PD3
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_3);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_3, GPIO_PIN_3);
//
// Configure the GPIO Pin Mux for PD4
// for GPIO_PD4
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_4);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_4, GPIO_PIN_4);
//
// Configure the GPIO Pin Mux for PD5
// for GPIO_PD5
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_5);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_5, GPIO_PIN_5);
//
// Configure the GPIO Pin Mux for PD6
// for GPIO_PD6
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_6);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_6, GPIO_PIN_6);
//
// Unlock the Port Pin and Set the Commit Bit
//
HWREG(GPIO_PORTD_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(GPIO_PORTD_BASE+GPIO_O_CR) |= GPIO_PIN_7;
HWREG(GPIO_PORTD_BASE+GPIO_O_LOCK) = 0x0;
//
// Configure the GPIO Pin Mux for PD7
// for GPIO_PD7
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_7);
MAP_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_7, GPIO_PIN_7);
//
// Configure the GPIO Pin Mux for PK0
// for GPIO_PK0
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_0);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_0, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PK1
// for GPIO_PK1
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_1);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_1, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PK2
// for GPIO_PK2
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_2);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_2, GPIO_PIN_2);
//
// Configure the GPIO Pin Mux for PK3
// for GPIO_PK3
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_3);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_3, GPIO_PIN_3);
//
// Configure the GPIO Pin Mux for PK4
// for GPIO_PK4
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_4);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_4, GPIO_PIN_4);
//
// Configure the GPIO Pin Mux for PK5
// for GPIO_PK5
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_5);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_5, GPIO_PIN_5);
//
// Configure the GPIO Pin Mux for PK6
// for GPIO_PK6
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_6);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_6, GPIO_PIN_6);
//
// Configure the GPIO Pin Mux for PK7
// for GPIO_PK7
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_7);
MAP_GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_7, GPIO_PIN_7);
//
// Configure the GPIO Pin Mux for PL0
// for GPIO_PL0
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_0);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_0, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PL1
// for GPIO_PL1
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_1);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_1, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PL2
// for GPIO_PL2
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_2);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_2, GPIO_PIN_2);
//
// Configure the GPIO Pin Mux for PL3
// for GPIO_PL3
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_3);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_3, GPIO_PIN_3);
//
// Configure the GPIO Pin Mux for PL4
// for GPIO_PL4
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_4);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_4, GPIO_PIN_4);
//
// Configure the GPIO Pin Mux for PL5
// for GPIO_PL5
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_5);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_5, GPIO_PIN_5);
//
// Configure the GPIO Pin Mux for PL6
// for GPIO_PL6
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_6);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_6, GPIO_PIN_6);
//
// Configure the GPIO Pin Mux for PL7
// for GPIO_PL7
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_7);
MAP_GPIOPinWrite(GPIO_PORTL_BASE, GPIO_PIN_7, GPIO_PIN_7);
//
// Configure the GPIO Pin Mux for PM0
// for GPIO_PM0
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_0);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PM1
// for GPIO_PM1
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_1);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PM2
// for GPIO_PM2
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_2);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_2, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PM3
// for GPIO_PM3
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_3);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PM4
// for GPIO_PM4
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_4);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_4, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PM5
// for GPIO_PM5
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_5);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_5, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PM6
// for GPIO_PM6
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_6);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_6, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PM7
// for GPIO_PM7
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, GPIO_PIN_7);
MAP_GPIOPadConfigSet(GPIO_PORTM_BASE, GPIO_PIN_7, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PQ4
// for GPIO_PQ4
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_4);
//
// Configure the GPIO Pin Mux for PQ3
// for GPIO_PQ3
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_3);
MAP_GPIOPadConfigSet(GPIO_PORTQ_BASE, GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PQ2
// for GPIO_PQ2
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_2);
MAP_GPIOPadConfigSet(GPIO_PORTQ_BASE, GPIO_PIN_2, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO Pin Mux for PQ1
// for GPIO_PQ1
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PQ0
// for GPIO_PQ0
//
MAP_GPIOPinTypeGPIOInput(GPIO_PORTQ_BASE, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PN5
// for GPIO_PN5
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_5);
//
// Configure the GPIO Pin Mux for PN4
// for GPIO_PN4
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_4);
MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_4, GPIO_PIN_4);
//
// Configure the GPIO Pin Mux for PN3
// for GPIO_PN3
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_3);
MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_3, GPIO_PIN_3);
//
// Configure the GPIO Pin Mux for PN2
// for GPIO_PN2
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_2);
//
// Configure the GPIO Pin Mux for PN1
// for GPIO_PN1
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PN0
// for GPIO_PN0
//
MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0);
MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, 0x0);
//
// Configure the GPIO Pin Mux for PB2
// for I2C0SCL
//
MAP_GPIOPinConfigure(GPIO_PB2_I2C0SCL);
MAP_GPIOPinTypeI2CSCL(GPIO_PORTB_BASE, GPIO_PIN_2);
//
// Configure the GPIO Pin Mux for PB3
// for I2C0SDA
//
MAP_GPIOPinConfigure(GPIO_PB3_I2C0SDA);
MAP_GPIOPinTypeI2C(GPIO_PORTB_BASE, GPIO_PIN_3);
//
// Configure the GPIO Pin Mux for PJ0
// for U3RX
//
MAP_GPIOPinConfigure(GPIO_PJ0_U3RX);
MAP_GPIOPinTypeUART(GPIO_PORTJ_BASE, GPIO_PIN_0);
//
// Configure the GPIO Pin Mux for PJ1
// for U3TX
//
MAP_GPIOPinConfigure(GPIO_PJ1_U3TX);
MAP_GPIOPinTypeUART(GPIO_PORTJ_BASE, GPIO_PIN_1);
//
// Configure the GPIO Pin Mux for PP5
// for U3CTS
//
MAP_GPIOPinConfigure(GPIO_PP5_U3CTS);
MAP_GPIOPinTypeUART(GPIO_PORTP_BASE, GPIO_PIN_5);
//
// Configure the GPIO Pin Mux for PP4
// for U3RTS
//
MAP_GPIOPinConfigure(GPIO_PP4_U3RTS);
MAP_GPIOPinTypeUART(GPIO_PORTP_BASE, GPIO_PIN_4);
}
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
PINOUT.H
//*****************************************************************************
// pinout.h
//
// configure the device pins for different signals
//
// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//*****************************************************************************
// This file was automatically generated on 1/12/2021 at 4:57:49 PM
// by TI PinMux version 1.6.0+1543
//
//*****************************************************************************
#ifndef __DRIVERS_PINOUT_H__
#define __DRIVERS_PINOUT_H__
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
//*****************************************************************************
//
// Prototypes.
//
//*****************************************************************************
extern void PinoutSet(void);
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif
#endif // __DRIVERS_PINOUT_H__
答案 0 :(得分:0)
由 TI e2e 论坛回答。事实证明 GPIOPinWrite 函数使用引脚掩码来确定要写入的引脚。如果掩码设置为所有引脚,则写入的数据将更改所有 8 个引脚状态。
还可以绕过 TivaWare 并通过 HWREG MACRO 使用直接端口访问,这似乎执行得更快。
#include "driverlib/gpio.h"
#include "inc/hw_gpio.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
uint32_t PortA = GPIO_PORTA_BASE + (GPIO_O_DATA + (0xFF << 2));
uint32_t DebugPin = GPIO_PORTQ_BASE + (GPIO_O_DATA + (GPIO_PIN_4 << 2));
//toggle debug pin
HWREG(DebugPin) = GPIO_PIN_4;