📄 680x0.txt
字号:
*/
/*
*********************************************************************************************************
* DATA TYPES
*********************************************************************************************************
*/
typedef unsigned char BOOLEAN; /* TRUE or FALSE */
typedef unsigned char UBYTE; /* Unsigned 8 bit quantity ( 0 to 255) */
typedef signed char BYTE; /* Signed 8 bit quantity ( -128 to 127) */
typedef unsigned int UWORD; /* Unsigned 16 bit quantity ( 0 to 65,535) */
typedef signed int WORD; /* Signed 16 bit quantity ( -32,768 to 32,767) */
typedef unsigned long ULONG; /* Unsigned 32 bit quantity ( 0 to 4,294,967,295) */
typedef signed long LONG; /* Signed 32 bit quantity (-2,147,483,648 to 2,147,483,647) */
/*
*********************************************************************************************************
* CONSTANTS
*********************************************************************************************************
*/
#ifndef FALSE /* Define TRUE and FALSE if not already done */
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/*
*********************************************************************************************************
* M680x0 & CPU32 SPECIFICS
*********************************************************************************************************
*/
_CASM void _OSEnterCritical() { /* In-line code to disable interrupts */
move sr,-(a7)
or #$0700,sr
}
_CASM void _OSExitCritical() { /* In-line code to re-enable interrupts */
move (a7)+,sr
}
#define OS_FAR /* Define OS_FAR to nothing (680x0 does not use 'far')*/
#define OS_STK_TYPE ULONG /* Data type used for stacks */
#define OS_ENTER_CRITICAL() _OSEnterCritical()
#define OS_EXIT_CRITICAL() _OSExitCritical()
#define OS_TASK_SW() _TRAP(OS_TRAP_NBR);
extern ULONG OSGlobalData; /* Each task's A5 should be set to 'OSGlobalData' */
/*
*********************************************************************************************************
* File : OS_CFG.H
* By : Jean J. Labrosse
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* uC/OS CONFIGURATION
*********************************************************************************************************
*/
#define OS_MAX_TASKS 63 /* Maximum number of tasks in your application */
#define OS_MAX_EVENTS 20 /* Maximum number of event control blocks in your application */
#define OS_MAX_QS 5 /* Maximum number of queue control blocks in your application */
#define OS_IDLE_TASK_STK_SIZE 256 /* Idle task stack size (ULONGs) */
#define OS_IDLE_TASK_STK_TOP 255 /* Index into idle task top of stack */
#define OS_TASK_CHANGE_PRIO_EN 1 /* Include code for OSTaskChangePrio() */
#define OS_TASK_DEL_EN 1 /* Include code for OSTaskDel() */
#define OS_SEM_EN 1 /* Include code for SEMAPHORES */
#define OS_MBOX_EN 1 /* Include code for MAILBOXES */
#define OS_Q_EN 1 /* Include code for QUEUES */
#define OS_TASK_SUSPEND_EN 1 /* Include code for OSTaskSuspend() and OSTaskResume() */
/*
*********************************************************************************************************
* 680x0 SPECIFICS
*********************************************************************************************************
*/
#define OS_TRAP_NBR 0 /* TRAP# used for task level context switch */
#define OS_CPU_68000 0 /* Define the type of CPU used (only one must be 1!) */
#define OS_CPU_68008 0
#define OS_CPU_68010 0
#define OS_CPU_68020 0
#define OS_CPU_68030 0
#define OS_CPU_68040 0
#define OS_CPU_68060 0
#define OS_CPU_68332 1
#define OS_CPU_68340 0
#define OS_CPU_68360 0
#define OS_INITIAL_SR (UWORD)0x2000 /* Initial value of Status Register for each task: */
/* ... Supervisor Mode and */
/* ... All interrupts are enabled */
/*
*********************************************************************************************************
* File : TEST.C
* By : Jean J. Labrosse
*********************************************************************************************************
*/
#include "INCLUDES.H"
/*
*********************************************************************************************************
* VARIABLES
*********************************************************************************************************
*/
ULONG AppStartTaskStk[256];
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
void OS_FAR AppStartTask(void *pdata);
void AppTickInit(void);
/*
*********************************************************************************************************
* main()
*********************************************************************************************************
*/
void main(void)
{
/*---- Any initialization code prior to calling OSInit() goes HERE --------------------------------*/
OSInit(); /* Initialize "uC/OS, The Real-Time Kernel" */
/*---- Any initialization code before starting multitasking ---------------------------------------*/
OSTaskCreate(AppStartTask, (void *)0, (void *)&AppStartTaskStk[255], 0);
/*---- Create any other task you want before we start multitasking --------------------------------*/
OSStart(); /* Start multitasking (i.e. give control to uC/OS) */
}
/*
*********************************************************************************************************
* STARTUP TASK
*********************************************************************************************************
*/
void OS_FAR AppStartTask(void *pdata)
{
pdata = pdata; /* Prevent compiler warning if we don't use pdata. */
AppTickInit(); /* Initialize the ticker */
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
OSTimeDly(1); /* Delay task execution for one clock tick */
}
}
/*
*********************************************************************************************************
* TICKER INITIALIZATION
*********************************************************************************************************
*/
void AppTickInit(void)
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -