ucos III 任务创建和消息,定时器调用 2013
- UID
- 1029342
- 性别
- 男
|
ucos III 任务创建和消息,定时器调用 2013
#include <app_cfg.h>
#include <includes.h>
#define ADC1_DR_Address ((u32)0x4001204C)
/*
*********************************************************************************************************
* LOCAL DEFINES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
/* ----------------- APPLICATION GLOBALS ------------------ */
static OS_TCB AppTaskStartTCB;
static OS_TCB AppTaskConfigTCB;
static OS_TCB AppTasktestsemTCB;
static CPU_STK AppTaskStartStk[APP_CFG_TASK_START_STK_SIZE];
static CPU_STK AppTaskConfigStk[APP_CFG_TASK_START_STK_SIZE];
static CPU_STK AppTasktestsemStk[APP_CFG_TASK_START_STK_SIZE];
OS_SEM testsem;
OS_TMR MYTIMER1;
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static void AppTaskStart (void *p_arg);
static void AppTaskCreate (void);
static void AppObjCreate (void);
static void userTaskStart (void);
static void userTasksem (void);
void MYCALLBACKFUNCT(void *p_arg) ;
/*
*********************************************************************************************************
* main()
*
* Description : This is the standard entry point for C code. It is assumed that your code will call
* main() once you have performed all necessary initialization.
*
* Arguments : none
*
* Returns : none
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* ?¨??????±???
*********************************************************************************************************
*/
CPU_FP32 AD_value_1,AD_value_2;
CPU_INT16U ADC_ConvertedValue[2];
/*********************************************************************************************************/
int main(void)
{
OS_ERR err;
BSP_IntDisAll(); /* Disable all interrupts. */
OSInit(&err); /* Init uC/OS-III. */
ADC1_CH6_DMA_Config(ADC1_DR_Address,ADC_ConvertedValue);
ADC_SoftwareStartConv(ADC1);
OSTaskCreate((OS_TCB *)&AppTaskStartTCB, /* Create the start task */
(CPU_CHAR *)"App Task Start",
(OS_TASK_PTR )AppTaskStart,
(void *)0,
(OS_PRIO )APP_CFG_TASK_START_PRIO,
(CPU_STK *)&AppTaskStartStk[0],
(CPU_STK_SIZE )AppTaskStartStk[APP_CFG_TASK_START_STK_SIZE / 10],
(CPU_STK_SIZE )APP_CFG_TASK_START_STK_SIZE,
(OS_MSG_QTY )0,
(OS_TICK )0,
(void *)0,
(OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
(OS_ERR *)&err);
OSStart(&err); /* Start multitasking (i.e. give control to uC/OS-III). */
(void)&err;
return (0);
} |
|
|
|
|
|