📄 probecfg.c
字号:
/***********************************************************************//* *//* MODULE: probecfg.c 1.4 *//* DATE: 17:57:14 - 97/12/05 *//* PURPOSE: pROBE+ configuration file *//* *//*---------------------------------------------------------------------*//* *//* Copyright 1994 - 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. *//* *//*---------------------------------------------------------------------*//* *//* This code in this module controls the configuration of the *//* pROBE+ component. Many configurations are possible, based on *//* these inputs: *//* * Options selected in "sys_conf.h" *//* * The capabilities of the board-support package being used, *//* as defined in "bsp.h" *//* * Answers given to questions in the startup configuration *//* dialog, if it is enabled *//* *//***********************************************************************/#include "sys_conf.h"#include "bsp.h"#include <bspfuncs.h>#include "machine.h"#if (SC_PROBE)#include <bsp.h>#include <bspfuncs.h>#include <configs.h>#include <sysvars.h>#define PS_DATA 0x800 /* Processor Services Data Area */#define PS_STACK 0x1000 /* Processor Services Data Area */#define DI_DATA 0x100 /* Dis-Assembler Data Area */#define CE_DATA 0x400 /* Console Interface Executive */#define REL_DATA 0x1400 /* Reliability Layer Data Area */#define RD_DATA (0x1B00+REL_DATA) /* RBUG Data Area */#define PROBE_DATA (PS_DATA+DI_DATA+CE_DATA+RD_DATA)#if BSP_NEW_SERIAL #define SerialPollInit ProbeIOInit #define SerialPollConsts ProbeConsts #define SerialPollConin ProbeConin #define SerialPollConout ProbeConout #define SerialPollOn ProbeEntry #define SerialPollOff ProbeExit#endif#define INIT 0x11 /* SerialDriver mode parameter */#define GET 0x14#define PUT 0x12#define STATUS 0x15 #define BREAK 2 /* SerialDriver return codes */#define MORE 1#define NO_MSG -1#define XMIT_ERR -2#define NO_IO -3#define ALIGN(addr, boundary) ((addr + boundary - 1) & ~(boundary - 1))/*---------------------------------------------------------------------*//* This definition saves space when typecasting ("Pointer to Function *//* returning Unsigned Long") *//*---------------------------------------------------------------------*/#define PFUL unsigned long (*)()/*---------------------------------------------------------------------*//* Function Prototypes *//*---------------------------------------------------------------------*/extern long pna_di(ULONG, long *, char *);#if SC_RBUG_PORT extern long RDISerialDrv(ULONG mode, long *byte_cnt, char *buf_ptr);#endifstatic long SerialDriver(ULONG mode, long *byte_cnt, char *buf_ptr);static void ProbeStateChng(ULONG flags);/*---------------------------------------------------------------------*//* pROBE+ entry points *//*---------------------------------------------------------------------*/extern void pROBE_critical(void);extern void pROBE_machck(void);extern void pROBE_mabrk(void);extern void pROBE_ia(void);extern void pROBE_align(void);extern void pROBE_inbrk(void);extern void pROBE_ioctlr(void);extern void pROBE_trace(void);extern void pROBE_ia_brk(void);extern void pROBE_runmode(void);extern void pROBE_debug(void);extern void pROBE_fpu(void);extern void pROBE_rsrv(void);/*---------------------------------------------------------------------*//* Global Variables *//*---------------------------------------------------------------------*/pROBE_CT ProbeCfg;extern struct SD_parms SysVars;/***********************************************************************//* ProbeSetup: Setup the pROBE+ component *//* *//* INPUTS: FreeMem = pointer to free memory *//* node_ct_ptr = pointer to node configuration table *//* *//* RETURNS: The new value of FreeMemPtr. *//* NOTE: This function should be called first if pROBE+ is *//* used because it initializes all the interrupt vectors. *//* *//***********************************************************************/ULONG ProbeSetup(ULONG *FreeMem, NODE_CT *node_ct_ptr){int vect_nr;unsigned long offset, MaxOffset;unsigned long ProcType;unsigned long rbug_cnsl_present;rbug_cnsl_present = 0;#if (SC_RBUG_PORT)rbug_cnsl_present = 1;#endifFreeMem = (ULONG *) ALIGN((ULONG) FreeMem, 4);/*---------------------------------------------------------------------*//* Build the pROBE+ configuration table. *//*---------------------------------------------------------------------*/ProbeCfg.td_code = pROBE_Core;#if SC_PROBE_DISASM ProbeCfg.td_ds_code = pROBE_Disasm;#else ProbeCfg.td_ds_code = 0;#endifProbeCfg.td_data = (ULONG *) FreeMem;FreeMem += PROBE_DATA;FreeMem += PS_STACK;ProbeCfg.td_stack = (ULONG *) FreeMem;ProbeCfg.td_brkopc = TD_BRKTRAP;ProbeCfg.td_flags = TD_FLAGS;if (SysVars.DebugMode == DBG_AP) ProbeCfg.td_flags |= SMODE_MASK;#if (SC_PROBE && !SC_PROBE_CIE && !SC_PROBE_DEBUG)#error "Either SC_PROBE_CIE or SC_PROBE_DEBUG should be present!"#endif#if (SC_PROBE_CIE && !SC_PROBE_CONSOLE)#error "SC_PROBE_CIE requires SC_PROBE_CONSOLE to be set to the console port# !"#endif#if ((BSP_SERIAL || BSP_NEW_SERIAL) && SC_PROBE_CONSOLE && SC_PROBE_CIE) ProbeCfg.td_ce_code = &pROBE_Console; ProbeCfg.td_drv0 = SerialDriver;#else ProbeCfg.td_ce_code = 0; ProbeCfg.td_drv0 = 0;#endif#if SC_PROBE_DEBUG #if (!SC_PNA && !SC_RBUG_PORT) #error "If RBUG is Enabled, then set either of SC_PNA or SC_RBUG_PORT !" #endif ProbeCfg.td_rd_code = pROBE_Debug; ProbeCfg.td_drv1 = 0; #if (SC_PNA) if ((SysVars.DebugMode == DBG_XS) && !rbug_cnsl_present) SysInitFail("SC_RBUG_PORT should be set for DBG_XS mode"); else if (SysVars.DebugMode != DBG_XS) ProbeCfg.td_drv1 = pna_di; #endif #if (SC_RBUG_PORT) if (SysVars.DebugMode != DBG_XN) ProbeCfg.td_drv1 = RDISerialDrv; #endif if (ProbeCfg.td_drv1 == 0) SysInitFail("If SC_PROBE_DEBUG is set, then set either of SC_PNA or" " SC_RBUG_PORT. Otherwise Set SC_PROBE_DEBUG to NO in" "sys_conf.h!!!!"); if ((SysVars.DebugMode == DBG_XS) || (SysVars.DebugMode == DBG_XN)) ProbeCfg.td_flags |= RBUG_MASK; /* Turn on RBUG bit */#else ProbeCfg.td_rd_code = 0; ProbeCfg.td_drv1 = 0;#endifProbeCfg.td_dbgpri = TD_DBGPRI;#if SC_PROBE_QUERY ProbeCfg.td_qs_code = pROBE_Query;#else ProbeCfg.td_qs_code = 0;#endifProbeCfg.td_statechng = ProbeStateChng;ProbeCfg.td_urcom = 0;ProbeCfg.td_urwrite = 0;ProbeCfg.td_reserved1[0] = 0;ProbeCfg.td_reserved1[1] = 0;ProbeCfg.td_reserved1[2] = 0;ProbeCfg.td_reserved1[3] = 0;ProbeCfg.td_reserved2[0] = 0;ProbeCfg.td_reserved2[1] = 0;ProbeCfg.td_reserved2[2] = 0;ProbeCfg.td_reserved2[3] = 0;ProbeCfg.td_reserved2[4] = 0;ProbeCfg.td_reserved2[5] = 0;/*---------------------------------------------------------------------*//* Install pROBE configuration table address in node config table. *//*---------------------------------------------------------------------*/node_ct_ptr->probect = &ProbeCfg;/*---------------------------------------------------------------------*//* Now set the pROBE exception vectors. Start off by initializing all *//* of them to point to the pROBE "reserved" entry *//*---------------------------------------------------------------------*/ProcType = BspCpuType() & PROC_MASK;MaxOffset = (ProcType == PPC403GA) ? 0x2000 : 0x3f00;for (offset = 0x100; offset <= MaxOffset; offset += 0x100) SysSetVector(offset, pROBE_rsrv, VT_REG, 0);/*---------------------------------------------------------------------*//* Reenable ME bit in MSR *//*---------------------------------------------------------------------*/SysSetVector(V_MACH_CK, pROBE_machck, VT_REG, MSR_ME);if ((ProcType == PPC601) || (ProcType == PPC603) || (ProcType == PPC604) || (ProcType == PPC821)) { SysSetVector(V_DA, pROBE_mabrk, VT_REG, 0); SysSetVector(V_IA, pROBE_ia, VT_REG, 0); }SysSetVector(V_ALIGN, pROBE_align, VT_REG, 0);SysSetVector(V_PROGRAM, pROBE_inbrk, VT_REG, 0);SysSetVector(V_FLOAT, pROBE_fpu, VT_REG, 0);if (ProcType == PPC601) SysSetVector(V_IOERROR, pROBE_ioctlr, VT_REG, 0);if ((ProcType == PPC603) || (ProcType == PPC604)) { SysSetVector(V_TRACE, pROBE_trace, VT_REG, 0); SysSetVector(V_IA_BP, pROBE_ia_brk, VT_REG, 0); }if (ProcType == PPC601) SysSetVector(V_RUNMODE, pROBE_runmode, VT_REG, 0);if (ProcType == PPC821) { SysSetVector(V_SEI821, pROBE_inbrk, VT_REG, 0); SysSetVector(V_TRACE, pROBE_trace, VT_REG, 0); SysSetVector(V_IA_BP821, pROBE_ia_brk, VT_REG, 0); SysSetVector(V_DA_BP821, pROBE_ia_brk, VT_REG, 0); }if (ProcType == PPC403GA) { /*------------------------------------------------------------------*/ /* Reenable CE, ME and DE bits in MSR */ /*------------------------------------------------------------------*/ SysSetVector(V_CRITINT, pROBE_critical, VT_CRITICAL, MSR_CE | MSR_ME | MSR_DE); SysSetVector(V_WATCHDG, pROBE_rsrv, VT_CRITICAL, MSR_CE | MSR_ME | MSR_DE); SysSetVector(V_MACH_CK, pROBE_machck, VT_CRITICAL, MSR_CE | MSR_DE); /*------------------------------------------------------------------*/ /* Reenable CE, ME in the MSR */ /* pROBE+ will enable DE in the MSR */ /*------------------------------------------------------------------*/ SysSetVector(V_DEBUG, pROBE_debug, VT_CRITICAL, MSR_CE | MSR_ME); }return ((ULONG) FreeMem);}/***********************************************************************//* ProbeStateChng: Change modes, etc, to match pROBE state changes *//* *//* INPUTS: flags: bit-encoded flags indicating state changes *//* *//* *//***********************************************************************/static void ProbeStateChng(unsigned long flags){#if BSP_SERIAL if (flags & TASKING_PROBE) SerialPollOn(); if (flags & TASKING_NORM) SerialPollOff();#endif#if BSP_MMU if (flags & MEMACCESS_PROBE) BspMmuTransOn();#endif}/***********************************************************************//* SerialDriver: The serial interface for nuProbe *//* *//* INPUTS: mode = INIT, PUT, GET, or STATUS *//* byte_cnt = byte count for PUT and GET *//* buf_ptr = buffer pointer for PUT and GET *//* *//* RETURNS: *//* *//***********************************************************************/static long SerialDriver(ULONG mode, long *byte_cnt, char *buf_ptr){ULONG i;int bc = *byte_cnt; if (mode == INIT) { SerialPollInit(); SerialPollOn(); }else { if (mode == PUT) { while (bc--) SerialPollConout(*buf_ptr++); } else { if (mode == GET) { if ((i = SerialPollConsts(0)) == 1) { *buf_ptr++ = SerialPollConin(); *byte_cnt = 1; } else { if (i == 2) return (BREAK); else return (NO_MSG); } } else { if (mode == STATUS) { if ((i = SerialPollConsts(0)) == 2) return (BREAK); else return (NO_MSG); } } } } return (SUCCESS);}#else static int dummy;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -