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

📄 bsp.c

📁 PPPoE协议在Psos中的实现源代码
💻 C
字号:
/***********************************************************************//*                                                                     *//*   MODULE:  bsp.c   1.24                                                *//*   DATE:    16:56:21 - 99/09/23                                                *//*   PURPOSE: This file contains the tick timer driver for the         *//*            decrementer in the processor and timer chip Intel 82C54. *//*            Selection of one of the two is controlled by defining    *//*            TICK_DEC. The use of the decrementer alleviates the need *//*            for the 8254 in the system.                              *//*                                                                     *//*---------------------------------------------------------------------*//*                                                                     *//*           Copyright 1991 - 1995, Integrated Systems, Inc.           *//*                      ALL RIGHTS RESERVED                            *//*                                                                     *//*   Permission is hereby granted to licensees of Integrated Systems,  *//*   Inc. products to use or abstract this computer program for the    *//*   sole purpose of implementing a product based on Integrated        *//*   Systems, Inc. products.   No other rights to reproduce, use,      *//*   or disseminate this computer program, whether in part or in       *//*   whole, are granted.                                               *//*                                                                     *//*   Integrated Systems, Inc. makes no representation or warranties    *//*   with respect to the performance of this computer program, and     *//*   specifically disclaims any responsibility for any damages,        *//*   special or consequential, connected with the use of this program. *//*                                                                     *//*---------------------------------------------------------------------*//*                                                                     *//*                                                                     *//*                                                                     *//***********************************************************************/#include "bsp.h"#include <bspfuncs.h>#include <psos.h>#include <configs.h>#include <drv_intf.h>#ifdef __TCS__#include <tm1/tmInterrupts.h>#include <tm1/tmTimers.h>#else#include <tmInterrupts.h>#include <tmTimers.h>#endif#include <stdarg.h>/*---------------------------------------------------------------------*//* General Definitions                                                 *//*---------------------------------------------------------------------*/#define UCHAR  unsigned char#define USHORT unsigned short#define ULONG  unsigned long/*---------------------------------------------------------------------*//* The node anchor address is a pointer to the node configuration      *//* table, which in turn points to the pSOS+ configuration table.  This *//* driver will look in the pSOS+ configuration table to see how many   *//* ticks per second are specified, and thus how many interrupts per    *//* second to generate.                                                 *//*---------------------------------------------------------------------*/extern NODE_CT *anchor;/*---------------------------------------------------------------------*//* Define function prototypes                                          *//*---------------------------------------------------------------------*/void RtcInit(struct ioparms *);extern void TimerIntWrapper(void);/*---------------------------------------------------------------------*//* Declarations of external functions & variables                      *//*---------------------------------------------------------------------*//*---------------------------------------------------------------------*//* The decrementer driver should announce a tick to pSOS+ only after   *//* the tick timer has been initialized.                                *//*---------------------------------------------------------------------*/ULONG rtcDecInitDone;/*---------------------------------------------------------------------*//*---------------------------------------------------------------------*//* Global Variable Declarations                                        *//*---------------------------------------------------------------------*/ULONG cpuClkRate = 100;		   /* Assume CPU bus frequency = 1 MHz *//***********************************************************************//* SysInitFail: Report a system initalization failure                  *//*                                                                     *//* INPUTS:  string = pointer to text of message                        *//* OUTPUTS: None                                                       *//*                                                                     *//* NOTE: Doesn't return.  Just continually prints the error message on *//*       the serial channel once per second.                           *//*                                                                     *//***********************************************************************/void SysInitFail(const char *string){  write(1, string, strlen(string));  write(1, "\r\n", 2);  exit(-1);}void InitBoard(void){}/***********************************************************************//* RtcInit:      Initialize real time clock.                           *//* INPUTS:       None                                                  *//* OUTPUTS:      None                                                  *//* NOTES:        Installs the RTC Interrupt handler in Interrupt Table.*//***********************************************************************/void RtcInit (struct ioparms *p){       Int                        timer;	       timInstanceSetup_t         setup;/*---------------------------------------------------------------------*//* Check and set the init flag                                         *//*---------------------------------------------------------------------*/        if (rtcDecInitDone) { return; }	rtcDecInitDone = 1;/*---------------------------------------------------------------------*//* Set the count from pSOS+ configuration table                        *//*---------------------------------------------------------------------*/	if (anchor->psosct->kc_ticks2sec == 0) {		p->err = TIMR_TICKRATE;		return;	}/*---------------------------------------------------------------------*//* Update the decrementer                                              *//*---------------------------------------------------------------------*/        setup.source   = timCLOCK;        setup.prescale = 1;        setup.handler  = TimerIntWrapper;        setup.priority = intPRIO_5;        setup.running  = True;        timToCycles( 1000000000 / anchor->psosct->kc_ticks2sec, &setup.modulus );        if (  timOpen(&timer)           || timInstanceSetup( timer, &setup )            ) {            SysInitFail("Could not allocate psos tick timer");        }/*---------------------------------------------------------------------*//* Finally, set return values in the I/O driver parameter structure.   *//*---------------------------------------------------------------------*/	p->used       = 1;	p->err        = 0;	p->out_retval = 0;}/***********************************************************************//* TimerIntWrapper						       */	/*                                                                     *//*	Announce the interrupt to PSOS				       */	  	/*                                                                     *//***********************************************************************/voidTimerIntWrapper(void){# pragma TCS_interruptible_handler#ifdef __TCS       /*        * work around the IPENDING bug in the TM1        * remove this code when the hardware clears        * correctly.        */        MMIO(ICLEAR) = 1 << bsp_interrupt;#endif	ienter(); 	AppModel_run_on_sstack( (Pointer)tm_tick, Null );	ireturn();}	#ifdef KC_SYSSTKint AppModel_system_stack_size= KC_SYSSTK;#endif

⌨️ 快捷键说明

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