📄 kernel.c
字号:
//***********************************************************************
// *
// P H I L I P S P R O P R I E T A R Y *
// *
// COPYRIGHT (c) 1999 BY PHILIPS SINGAPORE (APIC). *
// -- ALL RIGHTS RESERVED -- *
// *
// File Name : Kernel.c *
// Author : Albert Goh *
// Created : 3 March 2000 *
// *
//***********************************************************************
//***********************************************************************
// *
// Kernel.c is the control centre for this evaluation firmware. It will *
// control where should the firmware branch through via the selection *
// of the UART port of the 8051. if not via the UART, it will be from *
// the selection of the code defintion *
// *
//***********************************************************************
//***********************************************************************
// *
// Module History *
// ************** *
// *
// Date Version Author Changes *
// ==== ======= ====== ======= *
// 030300 0.1 Albert Created *
// *
// *
//***********************************************************************
//***********************************************************************
//* *
//* Include Files Definition *
//* *
//***********************************************************************
#include "standard.h"
#include "Kernel.h"
#include "i2c.h"
//***********************************************************************
//* *
//* External routine Definition *
//* *
//***********************************************************************
extern Init_Main();
extern USB_Debug_Mode();
extern DMA_Debug_Mode();
extern USB_INT_FLAG USB_Int_Flag;
extern UC idata I2CDev_UniqueAddr;
extern UC idata I2C_SubAddr;
extern UC idata Endpt_FIFO[64];
//***********************************************************************
//* *
//* Prototype routine Definition *
//* *
//***********************************************************************
void Start_mSEC_Timer(Data);
//void Start_SEC_Timer(Data);
//***********************************************************************
//* *
//* Variable Definition *
//* *
//***********************************************************************
UI Temp;
KERNEL Kernel_Flag;
TIMER idata Timer;
//***********************************************************************
//* *
//* Routine Definition *
//* *
//***********************************************************************
//***********************************************************************
//* *
//* Routine : *
//* Input : *
//* Output : *
//* Function : *
//* *
//***********************************************************************
void Main(void)
{
Init_Main(); //Initialization routine
do
{
USB_Debug_Mode(); //USB Debug Mode
// DMA_Debug_Mode(); //DMA Master Slave Mode
}
while(1);
}
//***********************************************************************
//* *
//* Routine : Start_mSEC_Timer(Delay) *
//* Input : Delay in milli second *
//* Output : Start timer operation *
//* Function : To start the timeout operation based on the delay i/p *
//* *
//***********************************************************************
void Start_mSEC_Timer(Data)
{
do
{
Temp = Timer.mSEC_Scale; //calculate timer value
Temp = 0xffff - Temp;
ET0 = 1;
Temp >>= 8;
TH0 = (UC) Temp;
Temp = Timer.mSEC_Scale; //calculate timer value
Temp = 0xffff - Temp;
TL0 = (UC) Temp; //initialize timer 0 counter
TR0 = 1; //start timer count
Kernel_Flag.BITS.Timer_Expired = 0;
while(!Kernel_Flag.BITS.Timer_Expired);
Kernel_Flag.BITS.Timer_Expired = 0;
TR0 = 0; //stop timer
ET0 = 0;
Data--;
}
while(Data != 0);
}
//***********************************************************************
//* *
//* Routine : Start_SEC_Timer(Delay) *
//* Input : Delay in second *
//* Output : Start timer operation *
//* Function : To start the timeout operation based on the delay i/p *
//* *
//***********************************************************************
/*
void Start_SEC_Timer(Data)
{
Data *= 10;
do
{
Temp = Timer.Hundred_mSEC_Scale; //calculate timer value
Temp = 0xffff - Temp;
TMOD = 0x01; //set to crystal clocking
//set to timer mode
//select 16 bit timer
ET0 = 1;
Temp >>= 8;
TH0 = (UC) Temp;
Temp = Timer.Hundred_mSEC_Scale; //calculate timer value
Temp = 0xffff - Temp;
TL0 = (UC) Temp; //initialize timer 0 counter
TR0 = 1; //start timer count
Kernel_Flag.BITS.Timer_Expired = 0;
while(!Kernel_Flag.BITS.Timer_Expired);
Kernel_Flag.BITS.Timer_Expired = 0;
TR0 = 0; //stop timer
ET0 = 0;
Data--;
}
while(Data != 0);
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -