/* This function make QSPI module be ready to transfer.  */
uint32_t QSPI_Open(QSPI_T *qspi, uint32_t u32MasterSlave, uint32_t u32QSPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
/* This function make QSPI module be ready to transfer.  */
uint32_t QSPI_Open(QSPI_T *qspi, uint32_t u32MasterSlave, uint32_t u32QSPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
{
    uint32_t u32RetValue = 0U;
    if (u32DataWidth == 32U)
    {
        u32DataWidth = 0U;
    }
    if (u32MasterSlave == QSPI_MASTER)
    {
        qspi->SSCTL = QSPI_SS_ACTIVE_LOW;
        qspi->CTL = u32MasterSlave | (u32DataWidth << QSPI_CTL_DWIDTH_Pos) | (u32QSPIMode) | QSPI_CTL_QSPIEN_Msk;
        qspi->CLKDIV = ((150000000U / u32BusClock) - 1U);
    }
    else
    {
        qspi->SSCTL = QSPI_SS_ACTIVE_LOW;
        qspi->CTL = u32MasterSlave | (u32DataWidth << QSPI_CTL_DWIDTH_Pos) | (u32QSPIMode) | QSPI_CTL_QSPIEN_Msk;
        qspi->CLKDIV = 0U;
    }
    return u32RetValue;
}