微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > LM3S9B96的EPI总线的HB8模式配置

LM3S9B96的EPI总线的HB8模式配置

时间:11-11 来源:互联网 点击:
下面是EPI的HB8模式的例子:

/* Includes -----------------------------------------*/

#include"inc/hw_memmap.h"

#include"inc/hw_types.h"

#include"driverlib/gpio.h"

#include"driverlib/sysctl.h"

#include"driverlib/epi.h"

/* Private variables ------------------------------*/

unsignedchartemp;

/*********************************************

*

* Use the following to specify the GPIO pins used by the HB8 EPI bus.

*

***********************************************/

#defineEPI_PORTC_PINS(GPIO_PIN_7|GPIO_PIN_6|GPIO_PIN_5|GPIO_PIN_4)

#defineEPI_PORTD_PINS(GPIO_PIN_3|GPIO_PIN_2)

#defineEPI_PORTE_PINS(GPIO_PIN_1|GPIO_PIN_0)

#defineEPI_PORTF_PINS(GPIO_PIN_5|GPIO_PIN_4)

#defineEPI_PORTG_PINS(GPIO_PIN_7|GPIO_PIN_1|GPIO_PIN_0)

#defineEPI_PORTH_PINS(GPIO_PIN_5|GPIO_PIN_4|GPIO_PIN_3|GPIO_PIN_2|\

GPIO_PIN_1|GPIO_PIN_0)

#defineEPI_PORTJ_PINS(GPIO_PIN_6|GPIO_PIN_5|GPIO_PIN_4|GPIO_PIN_3|\

GPIO_PIN_2|GPIO_PIN_1|GPIO_PIN_0)

/********************************************************

*

* A pointer to the EPI Peripheral. Note that g_pusEPIPER is declared

* as volatile so the compiler should not optimize reads out of the image.

*

**********************************************************/

staticvolatileunsignedshort*g_pusEPIPER;

/**********************************************************

* Function Name : main

* Description : Main program.

* Input : None

* Output : None

* Return : None

***********************************************************/

intmain(void)

{

// Set the clocking to run directly from the external crystal/oscillator

SysCtlClockSet(SYSCTL_SYSdiv_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |

SYSCTL_XTAL_16MHZ);

// The EPI0 peripheral must be enabled for use

SysCtlPeripheralEnable(SYSCTL_PERIPH_EPI0);

// For this example EPI0 is used with multiple pins on PortC, E, F, G, H, and J

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);

// configures the internal pin muxes to set the EPI pins for use with EPI

GPIOPinConfigure(GPIO_PH3_EPI0S0);

GPIOPinConfigure(GPIO_PH2_EPI0S1);

GPIOPinConfigure(GPIO_PC4_EPI0S2);

GPIOPinConfigure(GPIO_PC5_EPI0S3);

GPIOPinConfigure(GPIO_PC6_EPI0S4);

GPIOPinConfigure(GPIO_PC7_EPI0S5);

GPIOPinConfigure(GPIO_PH0_EPI0S6);

GPIOPinConfigure(GPIO_PH1_EPI0S7);

GPIOPinConfigure(GPIO_PE0_EPI0S8);

GPIOPinConfigure(GPIO_PE1_EPI0S9);

GPIOPinConfigure(GPIO_PH4_EPI0S10);

GPIOPinConfigure(GPIO_PH5_EPI0S11);

GPIOPinConfigure(GPIO_PF4_EPI0S12);

GPIOPinConfigure(GPIO_PG0_EPI0S13);

GPIOPinConfigure(GPIO_PG1_EPI0S14);

GPIOPinConfigure(GPIO_PF5_EPI0S15);

GPIOPinConfigure(GPIO_PJ0_EPI0S16);

GPIOPinConfigure(GPIO_PJ1_EPI0S17);

GPIOPinConfigure(GPIO_PJ2_EPI0S18);

GPIOPinConfigure(GPIO_PJ3_EPI0S19);

// GPIOPinConfigure(GPIO_PD2_EPI0S20);

// GPIOPinConfigure(GPIO_PD3_EPI0S21);

// GPIOPinConfigure(GPIO_PB5_EPI0S22);

// GPIOPinConfigure(GPIO_PB4_EPI0S23);

GPIOPinConfigure(GPIO_PE2_EPI0S24);

GPIOPinConfigure(GPIO_PE3_EPI0S25);

GPIOPinConfigure(GPIO_PJ4_EPI0S28);

GPIOPinConfigure(GPIO_PJ5_EPI0S29);

GPIOPinConfigure(GPIO_PJ6_EPI0S30);

GPIOPinConfigure(GPIO_PG7_EPI0S31);

// Configure the GPIO pins for EPI mode

GPIOPinTypeEPI(GPIO_PORTC_BASE, EPI_PORTC_PINS);

GPIOPinTypeEPI(GPIO_PORTE_BASE, EPI_PORTE_PINS);

GPIOPinTypeEPI(GPIO_PORTF_BASE, EPI_PORTF_PINS);

GPIOPinTypeEPI(GPIO_PORTG_BASE, EPI_PORTG_PINS);

GPIOPinTypeEPI(GPIO_PORTH_BASE, EPI_PORTH_PINS);

GPIOPinTypeEPI(GPIO_PORTJ_BASE, EPI_PORTJ_PINS);

// Sets the clock divider for the EPI

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top