Beispiel #1
0
/* Application define function which creates the threads. */
void
CyFxApplicationDefine (
    void)
{
    void *ptr = NULL;
    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    /* Allocate the memory for the threads */
    ptr = CyU3PMemAlloc (CY_FX_APPLN_THREAD_STACK);

    /* Create the thread for the application */
    status = CyU3PThreadCreate (&applnThread,               /* App Thread structure */
                                "21:USB_DEBUG",                   /* Thread ID and Thread name */
                                ApplnThread_Entry,                /* App Thread Entry function */
                                0,                                /* No input parameter to thread */
                                ptr,                              /* Pointer to the allocated thread stack */
                                CY_FX_APPLN_THREAD_STACK,         /* App Thread stack size */
                                CY_FX_APPLN_THREAD_PRIORITY,      /* App Thread priority */
                                CY_FX_APPLN_THREAD_PRIORITY,      /* App Thread pre-emption threshold */
                                CYU3P_NO_TIME_SLICE,              /* No time slice for the application thread */
                                CYU3P_AUTO_START                  /* Start the Thread immediately */
                               );

    /* Check the return code */
    if (status != 0)
    {
        /* Add custom recovery or debug actions here */

        /* Application cannot continue */
        /* Loop indefinitely */
        while(1);
    }
}
/*
 * Create the application thread and other OS objects required for this example.
 */
void
CyFxApplicationDefine (
        void)
{
    void *ptr;
    uint32_t txstatus;

    /* Allocate the memory for the threads */
    ptr = CyU3PMemAlloc (CYFXAPP_STACK_SIZE);
    if (ptr == 0)
        goto error;

    /* Event structure used by this application. */
    txstatus = CyU3PEventCreate (&fxAppEvent);
    if (txstatus != 0)
        goto error;

    /* Create the thread for the application */
    txstatus = CyU3PThreadCreate (&fxAppThread, "25:GpifToStorage App",
            GpifAppThreadEntry, 0, ptr, CYFXAPP_STACK_SIZE, CYFXAPP_THREAD_PRIORITY, CYFXAPP_THREAD_PRIORITY,
            CYU3P_NO_TIME_SLICE, CYU3P_AUTO_START);
    if (txstatus != 0)
        goto error;

    return;

error:
    /* Application cannot continue. Loop indefinitely. */
    while (1);
}
/* Application define function which creates the threads. */
void
CyFxApplicationDefine (
        void)
{
    void *ptr = NULL;
    uint32_t retThrdCreate = CY_U3P_SUCCESS;

    /* Allocate the memory for the threads */
    ptr = CyU3PMemAlloc (CY_FX_UARTLP_THREAD_STACK);

    /* Create the thread for the application */
    retThrdCreate = CyU3PThreadCreate (&UartLpAppThread,           /* UART Example App Thread structure */
                          "21:UART_loopback_register_mode",        /* Thread ID and Thread name */
                          UartLpAppThread_Entry,                   /* UART Example App Thread Entry function */
                          0,                                       /* No input parameter to thread */
                          ptr,                                     /* Pointer to the allocated thread stack */
                          CY_FX_UARTLP_THREAD_STACK,               /* UART Example App Thread stack size */
                          CY_FX_UARTLP_THREAD_PRIORITY,            /* UART Example App Thread priority */
                          CY_FX_UARTLP_THREAD_PRIORITY,            /* UART Example App Thread priority */
                          CYU3P_NO_TIME_SLICE,                     /* No time slice for the application thread */
                          CYU3P_AUTO_START                         /* Start the Thread immediately */
                          );

    /* Check the return code */
    if (retThrdCreate != 0)
    {
        /* Thread creation failed with the error code retThrdCreate */

        /* Add custom recovery or debug actions here */

        /* Application cannot continue */
        /* Loop indefinitely */
        while(1);
    }
}
/* Application define function which creates the threads. */
void
CyFxApplicationDefine (
        void)
{
    void *ptr = NULL;
    uint32_t retThrdCreate = CY_U3P_SUCCESS;

    /* Allocate the memory for the threads */
    ptr = CyU3PMemAlloc (CY_FX_GPIOAPP_THREAD_STACK);

    /* Create the thread for the application */
    retThrdCreate = CyU3PThreadCreate (&gpioPWMThread,           /* GPIO Example App Thread structure */
                          "21:GPIO_PWM",                         /* Thread ID and Thread name */
                          GpioPWMThread_Entry,                   /* GPIO Example App Thread Entry function */
                          0,                                     /* No input parameter to thread */
                          ptr,                                   /* Pointer to the allocated thread stack */
                          CY_FX_GPIOAPP_THREAD_STACK,            /* Thread stack size */
                          CY_FX_GPIOAPP_THREAD_PRIORITY,         /* Thread priority */
                          CY_FX_GPIOAPP_THREAD_PRIORITY,         /* Pre-emption threshold for the thread. */
                          CYU3P_NO_TIME_SLICE,                   /* No time slice for the application thread */
                          CYU3P_AUTO_START                       /* Start the Thread immediately */
                          );

    /* Check the return code */
    if (retThrdCreate != 0)
    {
        /* Thread creation failed with the error code retThrdCreate */

        /* Add custom recovery or debug actions here */

        /* Application cannot continue */
        /* Loop indefinitely */
        while(1);
    }

    /* Allocate the memory for the threads */
    ptr = CyU3PMemAlloc (CY_FX_GPIOAPP_THREAD_STACK);

    /* Create the thread for the application */
    retThrdCreate = CyU3PThreadCreate (&gpioMeasureThread,        /* GPIO Example App Thread structure */
                          "22:GPIO_measure",                      /* Thread ID and Thread name */
                          GpioMeasureThread_Entry,                /* GPIO Example App Thread entry function */
                          0,                                      /* No input parameter to thread */
                          ptr,                                    /* Pointer to the allocated thread stack */
                          CY_FX_GPIOAPP_THREAD_STACK,             /* Thread stack size */
                          CY_FX_GPIOAPP_THREAD_PRIORITY,          /* Thread priority */
                          CY_FX_GPIOAPP_THREAD_PRIORITY,          /* Pre-emption threshold for the thread */
                          CYU3P_NO_TIME_SLICE,                    /* No time slice for the application thread */
                          CYU3P_AUTO_START                        /* Start the Thread immediately */
                          );

    /* Check the return code */
    if (retThrdCreate != 0)
    {
        /* Thread creation failed with the error code retThrdCreate */

        /* Add custom recovery or debug actions here */

        /* Application cannot continue */
        /* Loop indefinitely */
        while(1);
    }

    /* Allocate the memory for the threads */
    ptr = CyU3PMemAlloc (CY_FX_GPIOAPP_THREAD_STACK);

    /* Create the thread for the application */
    retThrdCreate = CyU3PThreadCreate (&gpioCounterThread,        /* GPIO Example App Thread structure */
                          "23:GPIO_counter",                      /* Thread ID and Thread name */
                          GpioCounterThread_Entry,                /* GPIO Example App Thread entry function */
                          0,                                      /* No input parameter to thread */
                          ptr,                                    /* Pointer to the allocated thread stack */
                          CY_FX_GPIOAPP_THREAD_STACK,             /* Thread stack size */
                          CY_FX_GPIOAPP_THREAD_PRIORITY,          /* Thread priority */
                          CY_FX_GPIOAPP_THREAD_PRIORITY,          /* Pre-emption threshold for the thread */
                          CYU3P_NO_TIME_SLICE,                    /* No time slice for the application thread */
                          CYU3P_AUTO_START                        /* Start the Thread immediately */
                          );

    /* Check the return code */
    if (retThrdCreate != 0)
    {
        /* Thread creation failed with the error code retThrdCreate */

        /* Add custom recovery or debug actions here */

        /* Application cannot continue */
        /* Loop indefinitely */
        while(1);
    }
}