ticktimersim.c

来自「这是CodeWarrior环境下基于freescale单片机上的实时操作系统代码」· C语言 代码 · 共 87 行

C
87
字号
#include <hidef.h>		 	/* for EnableInterrupts macro */
#include <MC9S08GT60.h> 	/* include peripheral declarations */
#include "TickTimerSim.h"

#include "FreeRTOS.h"		/* The one and only FreeRTOS.h */


/*
*******************************************************************************
*
*
*
*******************************************************************************
*/
unsigned char TickTimer_Enable (void)
{	
	return 0;
}



/*
*******************************************************************************
*
*
*
*******************************************************************************
*/
signed char TickTimer_SetFreqHz (short Freq)
{

	return 0;
}


/*
*******************************************************************************
*
*
*
*******************************************************************************
*/
void TickTimer_Init(void)
{
	CTimer.TimerReg = 0x1FFF;
	CTimer.Control  = 0x01;
}



/*
*******************************************************************************
*
*
*
*******************************************************************************
*/
#pragma TRAP_PROC SAVE_NO_REGS
__interrupt 10 void TickTimer_Interrupt (void)
{	
	CTimer.Status |= 0x80;
		
	__asm ( "nop" );
		
	#if configUSE_PREEMPTION == 1
	{
		/* A context switch might happen so save the context. */
		portSAVE_CONTEXT();

		/* Increment the tick ... */
		vTaskIncrementTick();

		/* ... then see if the new tick value has necessitated a
		context switch. */
		vTaskSwitchContext();

		/* Restore the context of a task - which may be a different task
		to that interrupted. */
		portRESTORE_CONTEXT();	
	}
	#else
	{
		vTaskIncrementTick();
	}
	#endif
}

⌨️ 快捷键说明

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