1.2.22.4 1.9.20.4 1.22.26.4 1.23.24.4 SQIx_XIPSetup Function

C

void SQIx_XIPSetup(uint32_t sqiXcon1Val, uint32_t sqiXcon2Val); // x - Instance of the SQI peripheral

Summary

Sets up SQI peripheral to XIP mode.

Description

This function can be used to configure SQI peripheral to XIP mode at run-time.

Precondition

SQIx_Initialize must have been called for the associated SQI instance.

Parameters

Param Description
sqiXcon1Val Holds the value to be written to SQI XIP Control Register 1
sqiXcon2Val Holds the value to be written to SQI XIP Control Register 2

Returns

None

Example

#define SST26VF_HS_READ 0x0B

#define XIP_UNCACHED_ADDR_MASK 0xF0000000

uint8_t readData[512];

APP_XIPRead()
{
    uint32_t address = 0x1000;
    uint32_t *sqiXipAddr = (uint32_t *)(address | XIP_UNCACHED_ADDR_MASK);
    uint32_t *readBuffer = (uint32_t *)readData;
    uint32_t sqiXcon1Val = 0;
    uint32_t sqiXcon2Val = 0;
    uint32_t i;
    
    sqiXcon1Val = SQI_XCON1_TYPECMD_VAL(QUAD_MODE) | SQI_XCON1_TYPEADDR_VAL(QUAD_MODE) |
    SQI_XCON1_TYPEMODE_VAL(QUAD_MODE) | SQI_XCON1_TYPEDUMMY_VAL(QUAD_MODE) |
    SQI_XCON1_TYPEDATA_VAL(QUAD_MODE) | SQI_XCON1_READOPCODE_VAL(SST26VF_HS_READ) |
    SQI_XCON1_ADDRBYTES_VAL(THREE_ADDR_BYTES) | SQI_XCON1_DUMMYBYTES_VAL(3);
    
    sqiXcon2Val = SQI_XCON2_MODEBYTES_VAL(0) | SQI_XCON2_DEVSEL_VAL(DEVICE_1);
    
    SQI1_XIP_Setup(sqiXcon1Val, sqiXcon2Val);
    
    for (i = 0; i < (512/4); i++)
    {
        *readBuffer++ = *sqiXipAddr++;
    }
}