Presentation is loading. Please wait.

Presentation is loading. Please wait.

INITIALISATION – WORKING 8-bit transfers Spi_Params spiParams; Spi_DataParam dataparam; GIO_Handle spiHandle = NULL; GIO_AppCallback spi_dma_callback;

Similar presentations


Presentation on theme: "INITIALISATION – WORKING 8-bit transfers Spi_Params spiParams; Spi_DataParam dataparam; GIO_Handle spiHandle = NULL; GIO_AppCallback spi_dma_callback;"— Presentation transcript:

1 INITIALISATION – WORKING 8-bit transfers Spi_Params spiParams; Spi_DataParam dataparam; GIO_Handle spiHandle = NULL; GIO_AppCallback spi_dma_callback; #DEFINE SPI_FRAME_SIZE (1*1024) #pragma DATA_ALIGN(loopWrite, 128); Uint8 loopWrite[SPI_FRAME_SIZE]; #pragma DATA_ALIGN(loopRead, 128); Uint8 loopRead[SPI_FRAME_SIZE]; spi_initParams() - called from *.tcf SPI1 device driver { spiParams = Spi_PARAMS; spiParams.loopbackEnabled = FALSE; spiParams.hwiNumber = 8; spiParams.spiHWCfgData.intrLevel = TRUE; spiParams.opMode = Spi_OpMode_DMAINTERRUPT; spiParams.spiHWCfgData.pinOpModes = Spi_PinOpMode_SPISCS_4PIN; spiParams.spiHWCfgData.configDatafmt[0].waitEnable = FALSE; spiParams.spiHWCfgData.enableHighZ = TRUE; spiParams.edmaHandle = NULL; spiParams.outputClkFreq = 29184000; spiParams.spiHWCfgData.configDatafmt[0].charLength = 8; ****** 8-BIT TRANSFER spiParams.spiHWCfgData.configDatafmt[0].clkHigh = FALSE; spiParams.spiHWCfgData.configDatafmt[0].lsbFirst = FALSE; spiParams.spiHWCfgData.configDatafmt[0].oddParity = FALSE; spiParams.spiHWCfgData.configDatafmt[0].parityEnable = FALSE; spiParams.spiHWCfgData.configDatafmt[0].phaseIn = FALSE; spiParams.spiHWCfgData.configDatafmt[0].wDelay = 0x00; /* Delays and power dependencies set also */ }

2 INITIALISATION – WORKING 8-bit transfers spiThreadInit() { GIO_Attrs gioAttrs = GIO_ATTRS; Spi_ChanParams chanParams; chanParams.hEdma = hEdma[0]; configureSpi(); spiHandle = GIO_create("/Spi1",IOM_INOUT,NULL,&chanParams,&gioAttrs); return; } prdDataGenInit() { memset(loopRead, 0x00, sizeof(loopRead)); memset(loopWrite, 0x00, sizeof(loopWrite)); /*loopWrite is filled with a pattern 0 - 512*/ memset(&dataparam,0x00, sizeof(Spi_DataParam)); dataparam.chipSelect = SPI1_SCS1; dataparam.bufLen = sizeof(loopWrite); dataparam.flags = FALSE; dataparam.dataFormat = Spi_DataFormat_0; dataparam.outBuffer = (Uint8*)loopWrite; dataparam.inBuffer = (Uint8*)loopRead; /*Callback fun*/ spi_dma_callback.fxn = spi_dma_callback_fn; spi_dma_callback.arg = &loopRead[0]; }

3 Run Time Transfer void fpgaInputIsr(Ptr gp0_10_Interrupt) { status = GIO_submit(spiHandle, IOM_WRITE, &dataparam, &(dataparam.bufLen), &spi_dma_callback); return; }

4 Modifications For 16 Bit Transfer #DEFINE SPI_FRAME_SIZE (1*512) #pragma DATA_ALIGN(loopWrite, 128); Uint16 loopWrite[SPI_FRAME_SIZE]; #pragma DATA_ALIGN(loopRead, 128); Uint16 loopRead[SPI_FRAME_SIZE]; spiParams.spiHWCfgData.configDatafmt[0].charLength = 16; dataparam.bufLen = sizeof(loopWrite)/2;

5 16-Bit SPI Transfer CLK SIMO Word 0Word 1Word 2 SCS 0 1 2 : 512 loopWrite 16-bit array 0 1 2 : 512 16-bit array 0 1 2 : 512 16-bit array Word 0Word 1Word 2Word 0Word 1Word 2Word 0Word 1


Download ppt "INITIALISATION – WORKING 8-bit transfers Spi_Params spiParams; Spi_DataParam dataparam; GIO_Handle spiHandle = NULL; GIO_AppCallback spi_dma_callback;"

Similar presentations


Ads by Google