Ask how to write data using GpifToStorage example file?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
kiyo_1490531
Level 1
Level 1

I designed GPIF as an Async SRAM interface.

No PACKET-related pins were assigned.

GPIF is a 16-bit data interface.

How should I write 8-bit data below?

if rqtCode = 0x01, Params[0] = 0x02,  Params[1] = 0x03, Params[2] = 0x04, Params[3] = 0x05, Params[4] = 0x06, Params[5] = 0x07, Params[6] = 0x08,

Is it correct to write 16-bit Data in the first 0x0102, second 0x0304, Third 0x0506, fourth 0x0708 order?

Does the s-port automatically save to memory when 8 data are entered?

Enter 0x06 in rqtCode,

and aaa[0] to [7] should be insert data to store in eMMC memory?

The eMMC memory has no response from the Clock and Data pins.

    /* Break the request data into bytes. */

    rqtCode   = CY_U3P_DWORD_GET_BYTE3 (fxAppMbox.w0);  /* The request code is the MSB of w0. */

    params[0] = CY_U3P_DWORD_GET_BYTE2 (fxAppMbox.w0);

    params[1] = CY_U3P_DWORD_GET_BYTE1 (fxAppMbox.w0);

    params[2] = CY_U3P_DWORD_GET_BYTE0 (fxAppMbox.w0);

    params[3] = CY_U3P_DWORD_GET_BYTE3 (fxAppMbox.w1);

    params[4] = CY_U3P_DWORD_GET_BYTE2 (fxAppMbox.w1);

    params[5] = CY_U3P_DWORD_GET_BYTE1 (fxAppMbox.w1);

    params[6] = CY_U3P_DWORD_GET_BYTE0 (fxAppMbox.w1);

case CYFXSTORRQT_QUERYDEV:

        {

            CyU3PSibDevInfo_t devInfo;

            status = CyU3PSibQueryDevice (params[0], &devInfo);

            if (status == CY_U3P_SUCCESS)

            {

                /* Only some of the device info fields are being returned here, so as to restrict the

                   response to 8 bytes. This can be expanded by breaking up the response into multiple

                   messages.

                   */

                rspMbox.w0 = CY_U3P_MAKEDWORD (CYFXSTORRESP_DEVDATA, (uint8_t)devInfo.cardType,

                        (uint8_t)devInfo.numUnits, (uint8_t)devInfo.writeable);

                rspMbox.w1 = (uint32_t)devInfo.blkLen;

                fxAppDevBlkSize = devInfo.blkLen;

            }

            else

            {

                rspMbox.w0 = (CYFXSTORRESP_STATUS << 24) | status;

                rspMbox.w1 = 0;

            }

            CyU3PMboxWrite (&rspMbox);

        }

        break;

    case CYFXSTORRQT_QUERYUNIT:

        {

            CyU3PSibLunInfo_t unitInfo;

            status = CyU3PSibQueryUnit (params[0], params[1], &unitInfo);

            if (status == CY_U3P_SUCCESS)

            {

                /* Only some of the device info fields are being returned here, so as to restrict the

                   response to 8 bytes. This can be expanded by breaking up the response into multiple

                   messages.

                   */

                rspMbox.w0 = CY_U3P_MAKEDWORD (CYFXSTORRESP_UNITDATA, (uint8_t)unitInfo.valid,

                        (uint8_t)unitInfo.location, (uint8_t)unitInfo.type);

                rspMbox.w1 = unitInfo.numBlocks;

            }

            else

            {

                rspMbox.w0 = (CYFXSTORRESP_STATUS << 24) | status;

                rspMbox.w1 = 0;

            }

            CyU3PMboxWrite (&rspMbox);

        }

        break;

    case CYFXSTORRQT_READ:

        {

            uint32_t flag;

            status = CyU3PDmaChannelSetXfer (&fxAppReadChannel, params[3] * fxAppDevBlkSize);

            if (status == CY_U3P_SUCCESS)

            {

                status = CyU3PSibReadWriteRequest (CyTrue, params[0], params[1], params[2],

                        fxAppMbox.w1, CYFXSTORAPP_SIB_RDSOCK);

                if (status == CY_U3P_SUCCESS)

                {

                    status = CyU3PEventGet (&fxAppEvent, CYFXAPP_SIB_DONE_EVENT, CYU3P_EVENT_OR_CLEAR,

                            &flag, CYFXSTORAPP_XFER_TIMEOUT);

                    if (status == CY_U3P_SUCCESS)

                    {

                        if (fxAppXferStatus == CY_U3P_SUCCESS)

                        {

                            status = CyU3PDmaChannelWaitForCompletion (&fxAppReadChannel, CYFXSTORAPP_XFER_TIMEOUT);

                        }

                        else

                            status = fxAppXferStatus;

                    }

                    if (status != CY_U3P_SUCCESS)

                    {

                        CyU3PSibAbortRequest (params[0]);

                        CyU3PDmaChannelReset (&fxAppReadChannel);

                    }

                }

            }

            rspMbox.w0 = (CYFXSTORRESP_STATUS << 24) | status;

            rspMbox.w1 = 0;

            CyU3PMboxWrite (&rspMbox);

        }

        break;

    case CYFXSTORRQT_WRITE:

        {

            uint32_t flag;

            status = CyU3PDmaChannelSetXfer (&fxAppWriteChannel, params[3] * fxAppDevBlkSize);

            if (status == CY_U3P_SUCCESS)

            {

                status = CyU3PSibReadWriteRequest (CyFalse, params[0], params[1], params[2],

                        fxAppMbox.w1, CYFXSTORAPP_SIB_WRSOCK);

                if (status == CY_U3P_SUCCESS)

                {

                    status = CyU3PEventGet (&fxAppEvent, CYFXAPP_SIB_DONE_EVENT, CYU3P_EVENT_OR_CLEAR,

                            &flag, CYFXSTORAPP_XFER_TIMEOUT);

                    if (status == CY_U3P_SUCCESS)

                    {

                        if (fxAppXferStatus == CY_U3P_SUCCESS)

                        {

                            status = CyU3PDmaChannelWaitForCompletion (&fxAppWriteChannel, CYFXSTORAPP_XFER_TIMEOUT);

                        }

                        else

                            status = fxAppXferStatus;

                    }

                    if (status != CY_U3P_SUCCESS)

                    {

                        CyU3PSibAbortRequest (params[0]);

                        CyU3PDmaChannelReset (&fxAppWriteChannel);

                    }

                }

            }

            rspMbox.w0 = (CYFXSTORRESP_STATUS << 24) | status;

            rspMbox.w1 = 0;

            CyU3PMboxWrite (&rspMbox);

        }

        break;

    case CYFXSTORRQT_ECHO:

        {

            rspMbox.w0 = (CYFXSTORRESP_ECHO << 24) | (fxAppMbox.w0 & 0xFFFFFF);

            rspMbox.w1 = fxAppMbox.w1;

            CyU3PMboxWrite (&rspMbox);

        }

        break;

    default:

        {

            /* Unsupported command. */

            rspMbox.w0 = (CYFXSTORRESP_STATUS << 24) | CY_U3P_ERROR_CMD_NOT_SUPPORTED;

            rspMbox.w1 = 0;

            CyU3PMboxWrite (&rspMbox);

        }

        break;

    }

0 Likes
1 Reply