00001 /*----------------------------------------------------------------------------* 00002 * Copyright (c) 2005 Southeastern Universities Research Association, * 00003 * Thomas Jefferson National Accelerator Facility * 00004 * * 00005 * This software was developed under a United States Government license * 00006 * described in the NOTICE file included as part of this distribution. * 00007 * * 00008 * E.Wolin, 25-Feb-2005, Jefferson Lab * 00009 * * 00010 * Authors: Elliott Wolin * 00011 * wolin@jlab.org Jefferson Lab, MS-6B * 00012 * Phone: (757) 269-7365 12000 Jefferson Ave. * 00013 * Fax: (757) 269-5519 Newport News, VA 23606 * 00014 * 00015 *----------------------------------------------------------------------------*/ 00016 00017 #ifndef _vxTIInterruptService_hxx 00018 #define _vxTIInterruptService_hxx 00019 00020 00021 00022 00023 #include <vxWorks.h> 00024 #include <unistd.h> 00025 #include <intLib.h> 00026 #include <iv.h> 00027 #include <semLib.h> 00028 #include <taskLib.h> 00029 00030 00031 #include <InterruptibleObject.hxx> 00032 00033 00034 namespace codaObject { 00035 00036 00037 // for board support packages 00038 extern "C" { 00039 extern int sysBusToLocalAdrs(int,char*,char**); 00040 extern int intDisconnect(int); 00041 extern int sysIntEnable(int); 00042 extern int sysIntDisable(int); // ??? is this needed 00043 } 00044 00045 00046 // default TI and VME addresses, etc. for A16/D16 access mode 00047 00048 // settable by switches on TI module 00049 #define TI_BASE_ADDR 0x0ed0 00050 #define TI_INTERRUPT_LEVEL 5 00051 00052 // user selectable within constraints from cpu 00053 #define TI_INTERRUPT_VECTOR 0xee 00054 #define TI_DISPATCH_PRIORITY 100 00055 00056 // fixed by TI board itself 00057 #define TI_VME_ACCESS_MODE 0x29 00058 #define TI_RESET 0x80 00059 #define TI_MODE 0x7 00060 #define TI_INTERRUPT_REENABLE 0x8000 00061 00062 00063 00064 //----------------------------------------------------------------------------- 00065 //----------------------------------------------------------------------------- 00066 00067 00071 class vxTIInterruptService : public InterruptService { 00072 00073 public: 00074 vxTIInterruptService(unsigned short *ti_addr = (unsigned short*)TI_BASE_ADDR, int dispatchPriority = TI_DISPATCH_PRIORITY, 00075 int interruptLevel = TI_INTERRUPT_LEVEL, short interruptVector = TI_INTERRUPT_VECTOR); 00076 virtual ~vxTIInterruptService(void) throw(); 00077 virtual bool setupInterrupt(void); 00078 virtual bool enableInterrupt(void); 00079 virtual bool pauseInterrupt(void) {return(true);} 00080 virtual bool resumeInterrupt(void) {return(true);} 00081 virtual bool deleteInterrupt(void); 00082 00083 virtual int dispatchInterrupt(void); 00084 00085 00086 private: 00087 static void ISR(int sem); 00088 00089 00090 protected: 00091 unsigned short *myBaseAddr; 00092 unsigned short *myAddr; 00093 int myInterruptTaskId; 00094 SEM_ID mySemId; 00095 int myDispatchPriority; 00096 int myInterruptLevel; 00097 int myInterruptVector; 00098 }; 00099 00100 00101 //----------------------------------------------------------------------------- 00102 //----------------------------------------------------------------------------- 00103 00104 00105 } // namespace codaObject 00106 00107 #endif /* _vxTIInterruptService_hxx */