embed\app\LNG3A\main.c app_cfg.h os_cfg.h --ucosii移植在LPC1788--oart6

/*****************************************************************************************
*                                       任务管理
*****************************************************************************************/
#include "includes.h"
#include "bsp.h"
/*****************************************************************************************
*                                       LOCAL GLOBAL VARIABLES
*****************************************************************************************/
static  OS_STK         App_TaskLEDStk[APP_TASK_LED_STK_SIZE];
static  OS_STK         App_TaskLCDStk[APP_TASK_LCD_STK_SIZE];
static  OS_STK         AppTask_Touch[APP_TASK_Touch_STK_SIZE];
/*****************************************************************************************
*                                      LOCAL FUNCTION PROTOTYPES
*****************************************************************************************/
static  void  App_Task_LED  (void   *p_arg);
static  void  App_Task_LCD  (void   *p_arg);
static  void  App_TaskTouch (void   *p_arg);
int main(void)
{
    INT8U  os_err;
    BspInit();
    OS_CPU_SysTickInit();
    OSInit();

    os_err = OSTaskCreateExt((void (*)(void *)) App_Task_LED, /* Create the start task. */
                             (void          * ) 0,
                             (OS_STK        * )&App_TaskLEDStk[APP_TASK_LED_STK_SIZE - 1],
                             (INT8U           ) APP_TASK_LED_PRIO,
                             (INT16U          ) APP_TASK_LED_PRIO,
                             (OS_STK        * )&App_TaskLEDStk[0],
                             (INT32U          ) APP_TASK_LED_STK_SIZE,
                             (void          * )0,
                             (INT16U          )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));

    os_err = OSTaskCreateExt((void (*)(void *)) App_Task_LCD,
                             (void          * ) 0,
                             (OS_STK        * )&App_TaskLCDStk[APP_TASK_LCD_STK_SIZE-1],
                             (INT8U           ) APP_TASK_LCD_PRIO,
                             (INT16U          ) APP_TASK_LCD_PRIO,
                             (OS_STK        * )&App_TaskLCDStk[0],
                             (INT32U          ) APP_TASK_LCD_STK_SIZE,
                             (void          * ) 0,
                             (INT16U          )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));
    os_err =os_err;
    OSStart();
}

/*****************************************************************************************
*                                     任务函数
*****************************************************************************************/
static  void  App_Task_LED (void *p_arg)
{
    (void)p_arg;
    while(1)
    {
        OSTimeDly(40);
        OSTimeDly(40);
    }
}

static  void  App_Task_LCD  (void *p_arg)
{
    (void)p_arg;
    OSTaskCreateExt(App_TaskTouch,
                    (void *)0,
                    (OS_STK *)&AppTask_Touch[APP_TASK_Touch_STK_SIZE - 1],
                    APP_TASK_TOUCH_PRIO,
                    APP_TASK_TOUCH_PRIO,
                    (OS_STK *)&AppTask_Touch[0],
                    APP_TASK_Touch_STK_SIZE,
                    (void *)0,
                    OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);
    while(1)
    {
        OSTimeDly(10);
        OSTimeDly(20);
    }
}

static  void  App_TaskTouch (void *p_arg)
{
   (void)p_arg;
    while(1)
    {
        OSTimeDlyHMSM(0, 0, 0, 35);
    }
}

/*****************************************************************************************
* Filename      : app_cfg.h
* Version       : V2.86
* Programmer(s) : SR
*****************************************************************************************/
#define  APP_OS_CFG_START_TASK_PRIO                     5
#define  APP_TASK_LED_PRIO                              6
#define  APP_TASK_LCD_PRIO                              7
#define  APP_TASK_TOUCH_PRIO                            8
#define  OS_PROBE_TASK_PRIO         OS_LOWEST_PRIO - 3)
#define  OS_TASK_TMR_PRIO           (OS_LOWEST_PRIO - 2)

#define  APP_OS_CFG_START_TASK_STK_SIZE             128
#define  APP_TASK_LED_STK_SIZE                      128
#define  APP_TASK_LCD_STK_SIZE                      512
#define  APP_TASK_Touch_STK_SIZE                    128
#define  OS_PROBE_TASK_STK_SIZE                     128

/*****************************************************************************************
*                                                uC/OS-II
*                                          The Real-Time Kernel
*                                  uC/OS-II Configuration File for V2.8x
*
*                               (c) Copyright 2005-2007, Micrium, Weston, FL
*                                           All Rights Reserved
* File    : OS_CFG.H
* By      : Jean J. Labrosse
* Version : V2.86
******************************************************************************************/
#ifndef OS_CFG_H
#define OS_CFG_H
                                       /* ---------------------- MISCELLANEOUS ----------------------- */
#define OS_APP_HOOKS_EN           0    /* Application-defined hooks are called from the uC/OS-II hooks */
#define OS_ARG_CHK_EN             0    /* Enable (1) or Disable (0) argument checking                  */
#define OS_CPU_HOOKS_EN           1    /* uC/OS-II hooks are found in the processor port files         */

#define OS_DEBUG_EN               1    /* Enable(1) debug variables                                    */

#define OS_EVENT_MULTI_EN         1    /* Include code for OSEventPendMulti()                          */
#define OS_EVENT_NAME_SIZE       32    /* Determine the size of the name of a Sem, Mutex, Mbox or Q    */

#define OS_LOWEST_PRIO           63    /* Defines the lowest priority that can be assigned ...         */
                                       /* ... MUST NEVER be higher than 254!                           */

#define OS_MAX_EVENTS           100    /* Max. number of event control blocks in your application      */
#define OS_MAX_FLAGS              5    /* Max. number of Event Flag Groups    in your application      */
#define OS_MAX_MEM_PART           5    /* Max. number of memory partitions                             */
#define OS_MAX_QS                 4    /* Max. number of queue control blocks in your application      */
#define OS_MAX_TASKS             20    /* Max. number of tasks in your application, MUST be >= 2       */

#define OS_SCHED_LOCK_EN          1    /*     Include code for OSSchedLock() and OSSchedUnlock()       */

#define OS_TICK_STEP_EN           1    /* Enable tick stepping feature for uC/OS-View                  */
#define OS_TICKS_PER_SEC        200    /* Set the number of ticks in one second                        */

                                       /* --------------------- TASK STACK SIZE ---------------------- */
#define OS_TASK_TMR_STK_SIZE    128    /* Timer      task stack size (# of OS_STK wide entries)        */
#define OS_TASK_STAT_STK_SIZE   128    /* Statistics task stack size (# of OS_STK wide entries)        */
#define OS_TASK_IDLE_STK_SIZE   128    /* Idle       task stack size (# of OS_STK wide entries)        */

                                       /* --------------------- TASK MANAGEMENT ---------------------- */
#define OS_TASK_CHANGE_PRIO_EN    0    /*     Include code for OSTaskChangePrio()                      */
#define OS_TASK_CREATE_EN         1    /*     Include code for OSTaskCreate()                          */
#define OS_TASK_CREATE_EXT_EN     1    /*     Include code for OSTaskCreateExt()                       */
#define OS_TASK_DEL_EN            1    /*     Include code for OSTaskDel()                             */
#define OS_TASK_NAME_SIZE        32    /*     Determine the size of a task name                        */
#define OS_TASK_PROFILE_EN        1    /*     Include variables in OS_TCB for profiling                */
#define OS_TASK_QUERY_EN          1    /*     Include code for OSTaskQuery()                           */
#define OS_TASK_STAT_EN           1    /* Enable (1) or Disable(0) the statistics task                 */
#define OS_TASK_STAT_STK_CHK_EN   1    /* Check task stacks from statistic task                        */
#define OS_TASK_SUSPEND_EN        1    /*     Include code for OSTaskSuspend() and OSTaskResume()      */
#define OS_TASK_SW_HOOK_EN        1    /*     Include code for OSTaskSwHook()                          */

                                       /* ----------------------- EVENT FLAGS ------------------------ */
#define OS_FLAG_EN                1    /* Enable (1) or Disable (0) code generation for EVENT FLAGS    */
#define OS_FLAG_ACCEPT_EN         1    /*     Include code for OSFlagAccept()                          */
#define OS_FLAG_DEL_EN            1    /*     Include code for OSFlagDel()                             */
#define OS_FLAG_NAME_SIZE        32    /*     Determine the size of the name of an event flag group    */
#define OS_FLAG_QUERY_EN          1    /*     Include code for OSFlagQuery()                           */
#define OS_FLAG_WAIT_CLR_EN       1    /*     Include code for Wait on Clear EVENT FLAGS               */
#define OS_FLAGS_NBITS           16    /* Size in #bits of OS_FLAGS data type (8, 16 or 32)            */

                                       /* -------------------- MESSAGE MAILBOXES --------------------- */
#define OS_MBOX_EN                1    /* Enable (1) or Disable (0) code generation for MAILBOXES      */
#define OS_MBOX_ACCEPT_EN         1    /*     Include code for OSMboxAccept()                          */
#define OS_MBOX_DEL_EN            1    /*     Include code for OSMboxDel()                             */
#define OS_MBOX_PEND_ABORT_EN     1    /*     Include code for OSMboxPendAbort()                       */
#define OS_MBOX_POST_EN           1    /*     Include code for OSMboxPost()                            */
#define OS_MBOX_POST_OPT_EN       1    /*     Include code for OSMboxPostOpt()                         */
#define OS_MBOX_QUERY_EN          1    /*     Include code for OSMboxQuery()                           */

                                       /* --------------------- MEMORY MANAGEMENT -------------------- */
#define OS_MEM_EN                 0    /* Enable (1) or Disable (0) code generation for MEMORY MANAGER */
#define OS_MEM_NAME_SIZE         32    /*     Determine the size of a memory partition name            */
#define OS_MEM_QUERY_EN           0    /*     Include code for OSMemQuery()                            */

                                       /* ---------------- MUTUAL EXCLUSION SEMAPHORES --------------- */
#define OS_MUTEX_EN               1    /* Enable (1) or Disable (0) code generation for MUTEX          */
#define OS_MUTEX_ACCEPT_EN        1    /*     Include code for OSMutexAccept()                         */
#define OS_MUTEX_DEL_EN           1    /*     Include code for OSMutexDel()                            */
#define OS_MUTEX_QUERY_EN         1    /*     Include code for OSMutexQuery()                          */

                                       /* ---------------------- MESSAGE QUEUES ---------------------- */
#define OS_Q_EN                   1    /* Enable (1) or Disable (0) code generation for QUEUES         */
#define OS_Q_ACCEPT_EN            1    /*     Include code for OSQAccept()                             */
#define OS_Q_DEL_EN               1    /*     Include code for OSQDel()                                */
#define OS_Q_FLUSH_EN             1    /*     Include code for OSQFlush()                              */
#define OS_Q_PEND_ABORT_EN        1    /*     Include code for OSQPendAbort()                          */
#define OS_Q_POST_EN              1    /*     Include code for OSQPost()                               */
#define OS_Q_POST_FRONT_EN        1    /*     Include code for OSQPostFront()                          */
#define OS_Q_POST_OPT_EN          1    /*     Include code for OSQPostOpt()                            */
#define OS_Q_QUERY_EN             0    /*     Include code for OSQQuery()                              */

                                       /* ------------------------ SEMAPHORES ------------------------ */
#define OS_SEM_EN                 1    /* Enable (1) or Disable (0) code generation for SEMAPHORES     */
#define OS_SEM_ACCEPT_EN          1    /*    Include code for OSSemAccept()                            */
#define OS_SEM_DEL_EN             1    /*    Include code for OSSemDel()                               */
#define OS_SEM_PEND_ABORT_EN      1    /*    Include code for OSSemPendAbort()                         */
#define OS_SEM_QUERY_EN           1    /*    Include code for OSSemQuery()                             */
#define OS_SEM_SET_EN             1    /*    Include code for OSSemSet()                               */

                                       /* --------------------- TIME MANAGEMENT ---------------------- */
#define OS_TIME_DLY_HMSM_EN       1    /*     Include code for OSTimeDlyHMSM()                         */
#define OS_TIME_DLY_RESUME_EN     0    /*     Include code for OSTimeDlyResume()                       */
#define OS_TIME_GET_SET_EN        1    /*     Include code for OSTimeGet() and OSTimeSet()             */
#define OS_TIME_TICK_HOOK_EN      1    /*     Include code for OSTimeTickHook()                        */

                                       /* --------------------- TIMER MANAGEMENT --------------------- */
#define OS_TMR_EN                 0    /* Enable (1) or Disable (0) code generation for TIMERS         */
#define OS_TMR_CFG_MAX           16    /*     Maximum number of timers                                 */
#define OS_TMR_CFG_NAME_SIZE     16    /*     Determine the size of a timer name                       */
#define OS_TMR_CFG_WHEEL_SIZE     8    /*     Size of timer wheel (#Spokes)                            */
#define OS_TMR_CFG_TICKS_PER_SEC 10    /*     Rate at which timer management task runs (Hz)            */
#endif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值