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

📄 mk_extern.h

📁 飞思卡尔 MC9S12UF32做U盘的例子!
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
*                                                  
*  (c) copyright Freescale Semiconductor Hong Kong Ltd. 2004
*  ALL RIGHTS RESERVED
*                                                                       
*******************************************************************************  
** THIS  CODE IS ONLY INTENDED AS AN EXAMPLE FOR DEMONSTRATING THE FREESCALE **
** MICROCONTROLLERS.  IT  HAS ONLY BEEN GIVEN A MIMIMUM LEVEL OF TEST. IT IS **
** PROVIDED  'AS  SEEN'  WITH  NO  GUARANTEES  AND  NO  PROMISE  OF SUPPORT. **
*******************************************************************************  
*                                                                           
* FILE:         mk_extern.h	 	REVISION 0.2
*  
* DESCRIPTION:  Application code is placed here.
* 			
*
* COMPILER: Metrowerks                     VERSION: ADS v1.2 (initial version)           
*                                          VERSION: ADS v2.0 (Demo version)
*
* UPDATED HISTORY:
*
* REV   YYYY.MM.DD  AUTHOR        DESCRIPTION OF CHANGE
* ---   ----------  ------        --------------------- 
* 0.0   2002.05.31  Keny Chen     Initial version
* 0.1   2002.09.12  Kenny Lam     Demo beta version
* 0.2   2004.04.12  Kenny Lam     Demo version
*
******************************************************************************/                                                                        
/* Freescale  is  not  obligated  to  provide  any  support, upgrades or new */
/* releases  of  the Software. Freescale may make changes to the Software at */
/* any time, without any obligation to notify or provide updated versions of */
/* the  Software  to you. Freescale expressly disclaims any warranty for the */
/* Software.  The  Software is provided as is, without warranty of any kind, */
/* either  express  or  implied,  including, without limitation, the implied */
/* warranties  of  merchantability,  fitness  for  a  particular purpose, or */
/* non-infringement.  You  assume  the entire risk arising out of the use or */
/* performance of the Software, or any systems you design using the software */
/* (if  any).  Nothing  may  be construed as a warranty or representation by */
/* Freescale  that  the  Software  or  any derivative work developed with or */
/* incorporating  the  Software  will  be  free  from  infringement  of  the */
/* intellectual property rights of third parties. In no event will Freescale */
/* be  liable,  whether in contract, tort, or otherwise, for any incidental, */
/* special,  indirect, consequential or punitive damages, including, but not */
/* limited  to,  damages  for  any loss of use, loss of time, inconvenience, */
/* commercial loss, or lost profits, savings, or revenues to the full extent */
/* such  may be disclaimed by law. The Software is not fault tolerant and is */
/* not  designed,  manufactured  or  intended by Freescale for incorporation */
/* into  products intended for use or resale in on-line control equipment in */
/* hazardous, dangerous to life or potentially life-threatening environments */
/* requiring  fail-safe  performance,  such  as  in the operation of nuclear */
/* facilities,  aircraft  navigation  or  communication systems, air traffic */
/* control,  direct  life  support machines or weapons systems, in which the */
/* failure  of  products  could  lead  directly to death, personal injury or */
/* severe  physical  or  environmental  damage  (High  Risk Activities). You */
/* specifically  represent and warrant that you will not use the Software or */
/* any  derivative  work of the Software for High Risk Activities.           */
/* Freescale  and the Freescale logos are registered trademarks of Freescale */
/* Semiconductor Inc.                                                        */ 
/*****************************************************************************/

#include	"frDefs.h"			// get my Constant & Type definitions.


//
//  This is the header file of all the global variables for modules
//   to include in. All the global variables allocation is done in
//   file <mk_Data.c>.
//

#ifndef _H_EXTVARS_		// To avoid multiple defining
#define _H_EXTVARS_		// start of external variables definition


// *********************************************************************
//
//                   Exported Mini-Kernel Specific Constant
//
// *********************************************************************


// --------------------------------------------
//     ***  Compiler Options for Mini-Kernel
// --------------------------------------------


//#define	__kEnableSciDebugger__		1	// Enable the SCI Debugger sub-module
 


// --- Result Code Definition ---------------------------------------

#define	kQueryYes			1		// The answer to query is Yes
#define	kQueryNo			0		// The answer to query is No

#define	kNoError			0		// Reporting as No Error 
#define	kErrGeneral			-1		// Reporting as General Error 
#define	kErrWrongParm		-2		// Reporting as Wrong Parameters
#define	kErrDeviceBusy		-3		// Device is busy now
#define	kErrOutOfSpace		-4		// Running out of memory space.
#define	kErrElemNotFound	-5		// Element not found.
#define	kErrSrvNotAvail		-6		// Service is not available
#define	kErrNotReady		-7		// Service is not ready

#define kUnknownError		-99		// Unknown reason error


// *** Event Source ID number definitions ****************************
#define	kEvtDebugService			1	// Debug Service event
#define	kEvtSCIService				2	// SCI port interface event
#define	kEvtSPIService				3	// SPI port interface event
#define	kEvtUSBRequests				4	// USB event (Class/Vendor commands)
#define	kEvtUSBData					5	// USB event (Data Tx/Rx of non-Control endpoints)
#define	kEvtAtaService				6	// ATA/PI protocol generated event
#define	kEvtCFDrv					7	// Compact Flash driver generated event
#define	kEvtSMDrv					8	// Smart Media driver generated event
#define	kEvtSDDrv					9	// Secure Digital driver generated event
#define	kEvtMSDrv					10	// Memory Stick driver generated event
#define	kEvtIDEDrv					11	// IDE device driver generated event


// *** System Shared Resource ID definitions ****************************
#define	kRsrcGPIO					1	// GPIO ports
#define	kRsrcTIM					2	// System Timer module
#define	kRsrcSCI					3	// SCI interface module
#define	kRsrcSPI					4	// SPI interface module
#define	kRsrcUSB					5	// USB interface module
#define	kRsrcCF						6	// Compact Flash interface module
#define	kRsrcSM						7	// Smart Media interface module
#define	kRsrcSD						8	// Secure Digital interface module
#define	kRsrcMS						9	// Memory Stick interface module
#define	kRsrcIDE					10	// IDE device interface module


// *** Service ID number definitions *********************************
#define	kSrvSysTimer				1	// System Timer Service ID
#define	kSrvEvtHook					2	// Event/Hook Service ID
#define	kSrvDebug					3	// Debugger Service ID
#define	kSrvGPIO					4	// GPIO Port Service ID
#define	kSrvSCI						5	// SCI Port Service ID
#define	kSrvSPI						6	// SPI Port Service ID




// --------------------------------------------------------------------

#pragma DATA_SEG DEFAULT

// *********************************************************************
//
// 					Global Variables of mini-kernel
//
// *********************************************************************
//

// -------------------------------------------
// To create the Service List
extern muint8		gpServiceTable[];

// -------------------------------------------
// To create the Event Source List 
extern msEventSourceElem	gpEventSourceTable[];


// *********************************************************************************
// Global variables for mini-kernel Timer
#ifdef	__UseSysTick__		// Check if System Timer is enabled

extern muint16		gSystemTime;			// System Ticker Counter (unit= 1ms)

// The Sys Timer Hook Function List
extern pHookFunc	gpSysTimerHookTable[];
extern muint16		gpTimerHookIntervalTable[];
extern muint16		gpTimerHookCountTable[];

#endif	__UseSysTick__		// end if -- Check if System Timer is required
// *********************************************************************************






// code is placed in the main code area.
#pragma CODE_SEG	DEFAULT



// *********************************************************************
//
//	               EXPORTED FUNCTIONS FOR OTHER MODULES
//
//   (Can be called by other modules like Application, Drivers...etc)
//
// *********************************************************************




// ==================================================================
//   MK_InitMcu() -
//
//     To init. the MCU in the very first time after reset
// ==================================================================
void MK_InitMcu(void);



// ==================================================================
//   MK_InitKernel() -
//
//     To init. Mini-Kernel. This should be called in <StartSys.c>
// ==================================================================
void MK_InitKernel(void);



// ---------------------------------------------------------------------
//  Kernel Specific Funcions

// ==================================================================
//   MK_RegService() -
//
//     To register the shared Service of Mini-Kernel.
//
//
//	Input -		serviceID = the ID of service to be registered.
//
//	Output - 	nil
//
//	Function returns the error code of the result.
//
// 
mErrorCode	MK_RegService(muint8 serviceID);

// ==================================================================
//   MK_RegService() -
//
//     To register the shared Service of Mini-Kernel.
//
//
//	Input -		serviceID = the ID of service to be registered.
//
//	Output - 	nil
//
//	Function returns the error code of the result.
//
// 
mErrorCode	MK_QueryService(muint8 serviceID);




// ==================================================================
//   MK_RegEventSource() -
//
//     To register the shared Service of Mini-Kernel.
//
//
//	Input -		eventSourceID =  event source ID to be registered.
//				eventHookList =	 pointer to related hook function table
//
//	Output - 	nil
//
//	Function returns the error code of the result.
//
// 
mErrorCode	MK_RegEventSource(muint8 eventSourceID, pHookFunc *eventHookList);






// ==================================================================
//   MK_UnRegEventSource() -
//
//     To remove an Event Source from the event sourece list.
//
//
//	Input -		eventSourceID =  event source ID to be removed.
//
//	Output - 	nil
//
//	Function returns the error code of the result.
//
// ==================================================================
mErrorCode	MK_UnRegEventSource(muint8 eventSourceID);






// ==================================================================
//   MK_AttachEventHook() -
//
//     To attach a hook function to assigned event source.
//
//
//	Input -		eventSourceID =  event source ID to be registered.
//				myEventHook =	 pointer to hook function
//
//	Output - 	nil
//
//	Function returns the error code of the result.
//
// 
mErrorCode	MK_AttachEventHook(muint8 eventSourceID, pHookFunc myEventHook );





// ==================================================================

⌨️ 快捷键说明

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