Hello,
Can anyone tell me what is the function of the code statements marked in red in the below code section. This code section is used to define the SD SPI mode of communication.
-
#if TI_DRIVERS_SDSPI_INCLUDED
#include <ti/drivers/SDSPI.h>
#include <ti/drivers/sdspi/SDSPITiva.h>
/* SDSPI objects */
SDSPITiva_Object sdspiTivaobjects[EK_TM4C1294XL_SDSPICOUNT];
/* SDSPI configuration structure, describing which pins are to be used */
const SDSPITiva_HWAttrs sdspiTivaHWattrs[EK_TM4C1294XL_SDSPICOUNT] = {
{
SSI2_BASE, /* SPI base address */
GPIO_PORTD_BASE, /* The GPIO port used for the SPI pins */
GPIO_PIN_3, /* SCK */
GPIO_PIN_0, /* MISO */
GPIO_PIN_1, /* MOSI */
GPIO_PORTC_BASE, /* Chip select port */
GPIO_PIN_7, /* Chip select pin */
GPIO_PORTB_BASE, /* GPIO TX port */
GPIO_PIN_1, /* GPIO TX pin */
},
{
SSI3_BASE, /* SPI base address */
GPIO_PORTQ_BASE, /* The GPIO port used for the SPI pins */
GPIO_PIN_0, /* SCK */
GPIO_PIN_3, /* MISO */
GPIO_PIN_2, /* MOSI */
GPIO_PORTP_BASE, /* Chip select port */
GPIO_PIN_4, /* Chip select pin */
GPIO_PORTQ_BASE, /* GPIO TX port */
GPIO_PIN_2, /* GPIO TX pin */
}
};
const SDSPI_Config SDSPI_config[] = {
{&SDSPITiva_fxnTable, &sdspiTivaobjects[0], &sdspiTivaHWattrs[0]},
{&SDSPITiva_fxnTable, &sdspiTivaobjects[1], &sdspiTivaHWattrs[1]},
{NULL, NULL, NULL}
};
/*
* ======== EK_TM4C1294XL_initSDSPI ========
*/
void EK_TM4C1294XL_initSDSPI(void)
{
/* SDSPI0 configuration */
/* Enable the peripherals used by the SD Card */
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
/* Configure pad settings */
GPIOPadConfigSet(GPIO_PORTD_BASE,
GPIO_PIN_3 | GPIO_PIN_1,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTD_BASE,
GPIO_PIN_0,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(GPIO_PORTC_BASE,
GPIO_PIN_7,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
GPIOPinConfigure(GPIO_PD3_SSI2CLK);
GPIOPinConfigure(GPIO_PD0_SSI2XDAT1);
GPIOPinConfigure(GPIO_PD1_SSI2XDAT0);
/* SDSPI1 configuration */
/* Enable the peripherals used by the SD Card */
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
/* Configure pad settings */
GPIOPadConfigSet(GPIO_PORTQ_BASE,
GPIO_PIN_0 | GPIO_PIN_2,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
GPIOPadConfigSet(GPIO_PORTQ_BASE,
GPIO_PIN_3,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(GPIO_PORTP_BASE,
GPIO_PIN_4,
GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD);
GPIOPinConfigure(GPIO_PQ0_SSI3CLK);
GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1);
GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0);
/*
* These GPIOs are connected to PA2 and PA3 and need to be brought into a
* GPIO input state so they don't interfere with SPI communications.
*/
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_2);
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_3);
SDSPI_init();
}
#endif /* TI_DRIVERS_SDSPI_INCLUDED */
-
Thanks
Regards
Soumyajit