⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 This code ports the uC/OS operating system by Jean LaBrosse to the TI TMS320C2xx family of DSP s.
💻 C
字号:
/*******************************************************************************
* Module    :   main.c
*
* Purpose   :   First bit of 'C' code that executes after startup (see boot.asm).
;				Starts up the operating system, uC/OS.
*
* Language  :   'c'
*
* Written   :   Kirby W. Cartwright, The Vanner Power Group, 06/29/98
*
* Modified  :
*
* Project   :   Vanner Power Group Modular Controller Project PX-02.
*
* Copyright :   (C) copyright 1998 by Vanner, Inc.  All Rights Reserved.
*
* Notes     :
*
* Unit Tested:
*
*******************************************************************************/
#define	LEDS	0x000C					/* LEDs Register	*/
#include <ioports.h>
#include <time.h>
#include "includes.h"

extern void KickDog(void);

OS_STK_TYPE TimeOfDayStk[OS_TASK_IDLE_STK_SIZE];
static void TimeOfDayTask(void *);
/*******************************************************************************
*
* Routine	:   main
*
* Purpose   : 	Initialize further hardware, start multitasking.
*
* Inputs    :   None (void).
*
* Globals	:	None.
*
* Outputs (Returns):
*				None (void).
*
* Note(s)	:
*
*******************************************************************************/
void main(void)
	{
	int i;
	extern void ConfigureWatchDog(void);
    ConfigureWatchDog();
	OSInit();
	OSTaskCreate(TimeOfDayTask,(void *)&i,(void *)&TimeOfDayStk[OS_TASK_IDLE_STK_TOP], 62);
    OSStart();                                             /* Start multitasking */
	}

/*******************************************************************************
*
* Routine	:   void abort(void)
*
* Purpose   : 	Satisfy a link requirement.
*
* Inputs    :   None (void).
*
* Globals	:	None.
*
* Outputs (Returns):
*				None (void).
*
* Note(s)	:   Should never get here.  Should add code to annunciate if we
*				ever do.
*
*******************************************************************************/
void abort(void)
	{
    while (1);
    }
/*******************************************************************************
*
* Routine	:   void interrupt DefaultISR(void)
*
* Purpose   : 	Supply a default ISR for unused vectors.
*
* Inputs    :   None (void).
*
* Globals	:	None.
*
* Outputs (Returns):
*				None (void).
*
* Note(s)	:   Should add code to annunciate if we ever get here.
*
*******************************************************************************/
void interrupt DefaultISR(void)
	{
    }
/*******************************************************************************
*
* Task		:   void TimeOfDayTask(void *j);
*
* Purpose   : 	Time of day task.
*
* Inputs    :   Pointer to context?  Pointer to time/date structure.
*
* Globals	:	None.
*
* Outputs (Returns):
*				None (void).  Should never return.
*
* Note(s)	:   Should add code to go update global time and date structures.
*				Y2K compliant.
*				Should add code to initialize from hardware RTC on power-up.
*				The actual interrupt rate is 15625/256=61.03515625 Hz.
*
*******************************************************************************/

void TimeOfDayTask(void *j)
	{
    volatile UBYTE LEDTick=0;
    while (1)
    	{
        outport(0x000C,LEDTick++);
		KickDog();
        OSTimeDly(31);
        }
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -