FX3/CX3 简介

FX3,CX3(Cyusb3014,cyusb3065等)是Cypress 公司集成了ARM9处理器的USB3.0外设控制器。
FX3 的并行和串行接口提供了与系统中其他设备的高速连接。
FX3设备在系统中的主要功能是在USB主机与外设(如摄像头或扫描仪)之间传输高带宽数据。强大的片上ARM9处理器使FX3能够进行访问数据流,并能高效地处理数据。在不要求FX3执行数据处理的系统中,ARM9固件仅初始化和管理USB和数据消耗/提供设备两个接口间的数据传输。
除了I2C、SPI、UART和I2S串行接口之外,FX3还有一个高度灵活的可编程接口,即第二代通用可编程接口(GPIF II)。通过可编程的GPIF II,FX3可以同各种设备(包括FPGA、图像传感器、ADC以及应用处理器)相连接。因此,在多种高性能USB 3.0应用中,FX3是一个优秀的控制器选择。

DMA
GPIF II是一种可编程的状态机,它所启用的灵活接口使用自己的高速时钟,完全独立于ARM9。

FX3集成了512 KB或256 KB的嵌入式SRAM(取决于所选择的设备型号),并支持四种启动代码的方法(USB、GPIF II、I2C或者SPI)。

CX3 = FX3 + MIPI(摄像头接口)
2. 程序流程:
main函数初始化时钟,IO口,
/* This is a non returnable call for initializing the RTOS kernel */
CyU3PKernelEntry ();
然后加入:
CyFxApplicationDefine()
此中创建IO线程,
–Thread: CyCx3UvcAppThread_Entry – CyCx3UvcApplnInit( usb_init;) CyCx3UvcApplnStart

low performance peripheral (LPP)
3 . GPIO settting

void
CyFxGpioInit (void)
{
    CyU3PGpioClock_t gpioClock;
    CyU3PGpioSimpleConfig_t gpioConfig;
    CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

    /* Init the GPIO module */
    gpioClock.fastClkDiv = 2;
    gpioClock.slowClkDiv = 0;
    gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2;
    gpioClock.clkSrc = CY_U3P_SYS_CLK;
    gpioClock.halfDiv = 0;

    apiRetStatus = CyU3PGpioInit(&gpioClock, CyFxGpioIntrCb);
    if (apiRetStatus != 0)
    {
        /* Error Handling */
        CyU3PDebugPrint (4, "CyU3PGpioInit failed, error code = %d\n", apiRetStatus);
        CyFxAppErrorHandler(apiRetStatus);
    }

    /* Configure GPIO 45 as input with interrupt enabled for both edges */
    gpioConfig.outValue = CyTrue;
    gpioConfig.inputEn = CyTrue;
    gpioConfig.driveLowEn = CyFalse;
    gpioConfig.driveHighEn = CyFalse;
    gpioConfig.intrMode = CY_U3P_GPIO_INTR_BOTH_EDGE;
    apiRetStatus = CyU3PGpioSetSimpleConfig(45, &gpioConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
    {
        /* Error handling */
        CyU3PDebugPrint (4, "CyU3PGpioSetSimpleConfig failed, error code = %d\n",
                apiRetStatus);
        CyFxAppErrorHandler(apiRetStatus);
    }

    /* Override GPIO 21 as this pin is associated with GPIF Control signal.
     * The IO cannot be selected as GPIO by CyU3PDeviceConfigureIOMatrix call
     * as it is part of the GPIF IOs. Override API call must be made with
     * caution as this will change the functionality of the pin. If the IO
     * line is used as part of GPIF and is connected to some external device,
     * then the line will no longer behave as a GPIF IO.. Here CTL4 line is
     * not used and so it is safe to override.  */
    apiRetStatus = CyU3PDeviceGpioOverride (21, CyTrue);
    if (apiRetStatus != 0)
    {
        /* Error Handling */
        CyU3PDebugPrint (4, "CyU3PDeviceGpioOverride failed, error code = %d\n",
                apiRetStatus);
        CyFxAppErrorHandler(apiRetStatus);
    }

    /* Configure GPIO 21 as output */
    gpioConfig.outValue = CyFalse;
    gpioConfig.driveLowEn = CyTrue;
    gpioConfig.driveHighEn = CyTrue;
    gpioConfig.inputEn = CyFalse;
    gpioConfig.intrMode = CY_U3P_GPIO_NO_INTR;
    apiRetStatus = CyU3PGpioSetSimpleConfig(21, &gpioConfig);
    if (apiRetStatus != CY_U3P_SUCCESS)
    {
        /* Error handling */
        CyU3PDebugPrint (4, "CyU3PGpioSetSimpleConfig failed, error code = %d\n",
                apiRetStatus);
        CyFxAppErrorHandler(apiRetStatus);
    }
}
   /* Wait for two seconds */
    CyU3PThreadSleep(2000);
     apiRetStatus = CyU3PGpioSetValue (21, CyFalse);

3 . Timer

static CyU3PTimer        mpuTimer;
static void mpuAppProgressTimer (uint32_t arg)
{
     CyU3PDebugPrint (4, "Timer test...\r\n");
    // CyU3PTimerStart (&mpuTimer);//one shot 1694line
}
 //  CyU3PTimerCreate (&mpuTimer, mpuAppProgressTimer, 0x00, TIMER_PERIOD, 1, CYU3P_AUTO_ACTIVATE);//thread.sleep(1);
  //  CyU3PTimerStart (&mpuTimer);

4 . cyu3error.h 错误返回值宏定义,类似GetLastError 中的返回值。

你可能感兴趣的:(FX3/CX3,USB3.0)