📄 mk_extern.h
字号:
/*********************************************************************
(c) copyright Freescale Semiconductor HK Ltd 2004
ALL RIGHTS RESERVED
*********************************************************************
Mini Kernel Module for S12 MCUs
*********************************************************************
File: mk_extern.c
Description: Prototypes of global variable of mini-kernel
Date: May. 2002
Author: Keny Chen
********************************************************************/
#include "FreescaleDef.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 );
// ==================================================================
// MK_RemoveEventHook() -
//
// To remove a hook function from assigned event source.
//
//
// Input - eventSourceID = assigned event source ID.
// myEventHook = pointer to hook function
//
// Output - nil
//
// Function returns the error code of the result.
//
// ==================================================================
mErrorCode MK_RemoveEventHook(muint8 eventSourceID, pHookFunc myEventHook );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -