Ejemplo n.º 1
0
int NetEin:: list_net_ssh(QString flag)
{
QString befehl;
QString homepath = QDir::homePath(); 
QString hostname_;
QStringList adresse_;
QString adresse = ""; 
QString adresse_router;
QString adresse_eigen = "";
QString adresse_eigen_ = "";
int k = 0;
int i = 0;
        // Routeradresse ermitteln
        befehl = "route -n 1> " +  homepath + "/.config/qt5-fsarchiver/smbtree.txt";
        system (befehl.toLatin1().data());
        QFile file(homepath + "/.config/qt5-fsarchiver/smbtree.txt");
        QTextStream ds1(&file);
        if (file.open(QIODevice::ReadWrite | QIODevice::Text)) {
     	     	adresse = ds1.readLine();
             	adresse = ds1.readLine();
             	adresse = ds1.readLine();
            if (adresse != ""){  //verhindert Absturz wenn weder WLan noch Kabelnetzverbindung vorhanden ist
		do{
    			k=adresse.indexOf("  ");
			if (k > 0)
             	    	   adresse.replace("  ", " ");
	          }
			while  (k >= 0);
	     adresse_ = adresse.split(" ");
             adresse_router = adresse_[1];
           }
	}
        file.close();
        hostname_ = hostname();
        adresse_eigen = IP("localhost");
        i = adresse_eigen.indexOf("name_query");
        if (i > -1)
           adresse_eigen = IP(hostname_);
        adresse_ = adresse_eigen.split(" ");
        adresse_eigen = adresse_[0];
        adresse_eigen_ = adresse_[0];
        k = adresse_eigen.size();
        i = adresse_eigen.indexOf(".",k-2);
        if (i != -1)
            adresse_eigen = adresse_eigen.left(i);
        else {

        i = adresse_eigen.indexOf(".",k-3);
        if (i != -1)
            adresse_eigen = adresse_eigen.left(i); 
        i = adresse_eigen.indexOf(".",k-4);
        if (i != -1)
            adresse_eigen = adresse_eigen.left(i);
       }
        //Zahl zwischen 3. und 4. Punkt ermitteln
        //route -n ermittelt die Routeradresse
        befehl = "nmap -sP " + adresse_eigen + ".0/24 1> " +  homepath + "/.config/qt5-fsarchiver/smbtree.txt";
        system (befehl.toLatin1().data()); 
       	QTextStream ds(&file);
        if (file.open(QIODevice::ReadWrite | QIODevice::Text)) {
     	     adresse = ds.readLine();
  	     //Ermitteln widget_net Belegung
             i = 0;
             while (widget_net[i] != ""){
	            i = i +1;}
             while (!ds.atEnd()) {
		adresse = ds.readLine();
                if (adresse.indexOf("Nmap scan report") == 0){
                   adresse_ = adresse.split(" ");
                   adresse = adresse_[4];
                  // Prüfung ob adresse im Array widget_net schon vorhanden ist
                  if (adresse != adresse_router  &&  adresse != adresse_eigen_){
			k = Array_pruefen(adresse);
    		if (k == 2) {
         	     		//listWidget_net->addItem (adresse);
                   		widget_net[i]= adresse;
                     		i++;
               		 }
			}}
	}}
	file.close();
   return 0;
}
Ejemplo n.º 2
0
int
main()
{
  std::cout.setf(std::ios_base::boolalpha);

  std::polynomial<double> P({0.0, 1.0, 2.0, 3.0});
  std::cout << "P = " << P << std::endl;
  std::cout << "+P = " << +P << std::endl;
  std::cout << "-P = " << -P << std::endl;
  std::cout << "P = " << P << std::endl;
  std::cout << "degree(P) = " << P.degree() << std::endl;
  std::polynomial<double> Q({2.0, 1.0});
  std::cout << "Q = " << Q << std::endl;
  std::cout << "degree(Q) = " << Q.degree() << std::endl;
  std::cout << "P + Q = " << P + Q << std::endl;
  std::cout << "P - Q = " << P - Q << std::endl;
  std::cout << "P * Q = " << P * Q << std::endl;
  std::cout << "P / Q = " << P / Q << std::endl;
  std::cout << "P % Q = " << P % Q << std::endl;
  double b = 5.0;
  std::cout << "b = " << b << std::endl;
  std::cout << "P + b = " << P + b << std::endl;
  std::cout << "P - b = " << P - b << std::endl;
  std::cout << "P * b = " << P * b << std::endl;
  std::cout << "P / b = " << P / b << std::endl;
  std::cout << "P % b = " << P % b << std::endl;
  double a = 2.0;
  std::cout << "a = " << a << std::endl;
  std::cout << "a + Q = " << a + Q << std::endl;
  std::cout << "a - Q = " << a - Q << std::endl;
  std::cout << "a * Q = " << a * Q << std::endl;
  std::cout << "a / Q = " << a / Q << std::endl;
  std::cout << "a % Q = " << a % Q << std::endl;

  std::polynomial<double> B;// = b;
  B = b;
  std::cout << "B = " << B << std::endl;
  std::cout << "P % B = " << P % B << std::endl;

  Q = {0.0, -2.0, 4.0, -6.0, 8.0, -12.0};
  std::cout << "Q = " << Q << std::endl;

  std::polynomial<double> P2;
  P2 = P;
  std::cout << "P2 = " << P2 << std::endl;
  std::cout << "P2 == P = " << (P2 == P) << std::endl;

  for (int i = 0; i <= 100; ++i)
  {
    double x = i * 0.1;
    std::cout << "P(" << x << ") = " << P(x) << std::endl;
  }

  std::polynomial<std::complex<double>>
  CP({std::complex<double>(0.0, -1.0),
      std::complex<double>(1.0, -2.0), 
      std::complex<double>(2.0, -3.0), 
      std::complex<double>(3.0, -4.0)});
  std::cout << "CP = " << CP << std::endl;
  std::cout << "CP * CP = " << CP * CP << std::endl;

  std::polynomial<int> IP({0, 1, 2, 3});
  std::cout << "IP = " << IP << std::endl;
  std::cout << "IP * IP = " << IP * IP << std::endl;

  std::array<double, 10> arr;
  P.eval(1.0, arr);
  std::cout << "P(" << 1.0 << ") =";
  for (int i = 0; i < arr.size(); ++i)
    std::cout << " " << arr[i];
  std::cout << std::endl;

  P.eval(1.0, arr.begin(), arr.end());
  std::cout << "P(" << 1.0 << ") =";
  for (auto iarr = arr.cbegin(); iarr != arr.cend(); ++iarr)
    std::cout << " " << *iarr;
  std::cout << std::endl;

  std::istringstream is("(-2.0, -1.0, 0.0)");
  std::polynomial<double> R;
  is >> R;
  std::cout << "R = " << R << std::endl;

  std::istringstream is2("(5.0)");
  std::polynomial<double> S;
  is2 >> S;
  std::cout << "S = " << S << std::endl;

  std::istringstream is3("42.0");
  std::polynomial<double> T;
  is3 >> T;
  std::cout << "T = " << T << std::endl;

  std::polynomial<double> u({1.0, 3.0, 3.0, 1.0});
  std::polynomial<double> v({1.0, 1.0});
  std::polynomial<double> q, r;
  std::divmod(u, v, q, r);
  std::cout << "u = " << u << std::endl;
  std::cout << "v = " << v << std::endl;
  std::cout << "q = " << q << std::endl;
  std::cout << "r = " << r << std::endl;

  std::polynomial<double> u1({1.0, -3.0, 3.0, -1.0});
  std::polynomial<double> v1({1.0, -2.0, 1.0});
  std::polynomial<double> q1, r1;
  std::divmod(u1, v1, q1, r1);
  std::cout << "u1 = " << u1 << std::endl;
  std::cout << "v1 = " << v1 << std::endl;
  std::cout << "q1 = " << q1 << std::endl;
  std::cout << "r1 = " << r1 << std::endl;

  std::polynomial<double> u2({1.0, 1.0});
  std::polynomial<double> v2({1.0, 3.0, 3.0, 1.0});
  std::polynomial<double> q2, r2;
  std::divmod(u2, v2, q2, r2);
  std::cout << "u2 = " << u2 << std::endl;
  std::cout << "v2 = " << v2 << std::endl;
  std::cout << "q2 = " << q2 << std::endl;
  std::cout << "r2 = " << r2 << std::endl;

  std::polynomial<double> u3({1.0, 0.0, 0.0, 1.0});
  std::polynomial<double> v3({1.0, 3.0, 3.0, 1.0});
  std::polynomial<double> q3, r3;
  std::divmod(u3, v3, q3, r3);
  std::cout << "u3 = " << u3 << std::endl;
  std::cout << "v3 = " << v3 << std::endl;
  std::cout << "q3 = " << q3 << std::endl;
  std::cout << "r3 = " << r3 << std::endl;

  std::cout << "P = " << P << std::endl;
  std::cout << "P' = " << P.derivative() << std::endl;
  std::cout << "I = " << P.integral(42.0) << std::endl;

  //std::array<double, 5> aaa{{1.1, 2.2, 3.3, 4.4, 5.5}};
  //std::cout << "aaa = " << std::polynomial_eval(aaa, 3.13149) << std::endl;
}
Ejemplo n.º 3
0
void des_encrypt1(DES_LONG *data, des_key_schedule ks, int enc)
{
	DES_LONG l,r,t,u;
#ifdef DES_PTR
	const unsigned char *des_SP=(const unsigned char *)des_SPtrans;
#endif
#ifndef DES_UNROLL
	int i;
#endif
	DES_LONG *s;

	r=data[0];
	l=data[1];

	IP(r,l);
	/* Things have been modified so that the initial rotate is
	 * done outside the loop.  This required the
	 * des_SPtrans values in sp.h to be rotated 1 bit to the right.
	 * One perl script later and things have a 5% speed up on a sparc2.
	 * Thanks to Richard Outerbridge <*****@*****.**>
	 * for pointing this out. */
	/* clear the top bits on machines with 8byte longs */
	/* shift left by 2 */
	r=ROTATE(r,29)&0xffffffffL;
	l=ROTATE(l,29)&0xffffffffL;

	s=ks->ks.deslong;
	/* I don't know if it is worth the effort of loop unrolling the
	 * inner loop */
	if (enc)
		{
#ifdef DES_UNROLL
		D_ENCRYPT(l,r, 0); /*  1 */
		D_ENCRYPT(r,l, 2); /*  2 */
		D_ENCRYPT(l,r, 4); /*  3 */
		D_ENCRYPT(r,l, 6); /*  4 */
		D_ENCRYPT(l,r, 8); /*  5 */
		D_ENCRYPT(r,l,10); /*  6 */
		D_ENCRYPT(l,r,12); /*  7 */
		D_ENCRYPT(r,l,14); /*  8 */
		D_ENCRYPT(l,r,16); /*  9 */
		D_ENCRYPT(r,l,18); /*  10 */
		D_ENCRYPT(l,r,20); /*  11 */
		D_ENCRYPT(r,l,22); /*  12 */
		D_ENCRYPT(l,r,24); /*  13 */
		D_ENCRYPT(r,l,26); /*  14 */
		D_ENCRYPT(l,r,28); /*  15 */
		D_ENCRYPT(r,l,30); /*  16 */
#else
		for (i=0; i<32; i+=8)
			{
			D_ENCRYPT(l,r,i+0); /*  1 */
			D_ENCRYPT(r,l,i+2); /*  2 */
			D_ENCRYPT(l,r,i+4); /*  3 */
			D_ENCRYPT(r,l,i+6); /*  4 */
			}
#endif
		}
	else
		{
#ifdef DES_UNROLL
		D_ENCRYPT(l,r,30); /* 16 */
		D_ENCRYPT(r,l,28); /* 15 */
		D_ENCRYPT(l,r,26); /* 14 */
		D_ENCRYPT(r,l,24); /* 13 */
		D_ENCRYPT(l,r,22); /* 12 */
		D_ENCRYPT(r,l,20); /* 11 */
		D_ENCRYPT(l,r,18); /* 10 */
		D_ENCRYPT(r,l,16); /*  9 */
		D_ENCRYPT(l,r,14); /*  8 */
		D_ENCRYPT(r,l,12); /*  7 */
		D_ENCRYPT(l,r,10); /*  6 */
		D_ENCRYPT(r,l, 8); /*  5 */
		D_ENCRYPT(l,r, 6); /*  4 */
		D_ENCRYPT(r,l, 4); /*  3 */
		D_ENCRYPT(l,r, 2); /*  2 */
		D_ENCRYPT(r,l, 0); /*  1 */
#else
		for (i=30; i>0; i-=8)
			{
			D_ENCRYPT(l,r,i-0); /* 16 */
			D_ENCRYPT(r,l,i-2); /* 15 */
			D_ENCRYPT(l,r,i-4); /* 14 */
			D_ENCRYPT(r,l,i-6); /* 13 */
			}
#endif
		}

	/* rotate and clear the top bits on machines with 8byte longs */
	l=ROTATE(l,3)&0xffffffffL;
	r=ROTATE(r,3)&0xffffffffL;

	FP(r,l);
	data[0]=l;
	data[1]=r;
	l=r=t=u=0;
}
Ejemplo n.º 4
0
/**********
Copyright 1990 Regents of the University of California.  All rights reserved.
Author: 1987 Thomas L. Quarles
**********/

#include "ngspice/ngspice.h"
#include "ngspice/ifsim.h"
#include "ngspice/devdefs.h"
#include "ccvsdefs.h"
#include "ngspice/suffix.h"

/* current controlled voltage source */
IFparm CCVSpTable[] = { /* parameters */ 
 IOPU("gain",     CCVS_TRANS,   IF_REAL    ,"Transresistance (gain)"),
 IOPU("control",  CCVS_CONTROL, IF_INSTANCE,"Controlling voltage source"),
 IP("sens_trans",CCVS_TRANS_SENS,IF_FLAG,  
        "flag to request sens. WRT transimpedance"),
 OPU("pos_node", CCVS_POS_NODE,IF_INTEGER, "Positive node of source"),
 OPU("neg_node", CCVS_NEG_NODE,IF_INTEGER, "Negative node of source"),
 OP("i",        CCVS_CURRENT, IF_REAL,    "CCVS output current"),
 OP("v",        CCVS_VOLTS, IF_REAL,    "CCVS output voltage"),
 OP("p",        CCVS_POWER,   IF_REAL,    "CCVS power"),
 OPU("sens_dc",   CCVS_QUEST_SENS_DC,  IF_REAL,"dc sensitivity "),
 OPU("sens_real", CCVS_QUEST_SENS_REAL,IF_REAL,"real part of ac sensitivity"),
 OPU("sens_imag", CCVS_QUEST_SENS_IMAG,IF_REAL,"imag part of ac sensitivity"),
 OPU("sens_mag",  CCVS_QUEST_SENS_MAG, IF_REAL,"sensitivity of ac magnitude"),
 OPU("sens_ph",   CCVS_QUEST_SENS_PH,  IF_REAL, "sensitivity of ac phase"),
 OPU("sens_cplx", CCVS_QUEST_SENS_CPLX,IF_COMPLEX,"ac sensitivity")
};

char *CCVSnames[] = {
    "H+",
Ejemplo n.º 5
0
Author: 1985 Thomas L. Quarles
**********/

#include "spice.h"
#include <stdio.h>
#include "resdefs.h"
#include "devdefs.h"
#include "ifsim.h"
#include "suffix.h"

IFparm RESpTable[] = { /* parameters */ 
 IOPP( "resistance", RES_RESIST, IF_REAL,"Resistance"),
 IOPZU( "temp",        RES_TEMP,   IF_REAL,"Instance operating temperature"),
 IOPQU( "l",          RES_LENGTH, IF_REAL,"Length"),
 IOPZU( "w",          RES_WIDTH,  IF_REAL,"Width"),
 IP(   "sens_resist", RES_RESIST_SENS, IF_FLAG,   
        "flag to request sensitivity WRT resistance"),
 OP( "i",          RES_CURRENT,IF_REAL,"Current"),
 OP( "p",          RES_POWER,  IF_REAL,"Power"),
 OPU( "sens_dc",  RES_QUEST_SENS_DC,  IF_REAL,    "dc sensitivity "),
 OPU( "sens_real",RES_QUEST_SENS_REAL,IF_REAL,    
        "dc sensitivity and real part of ac sensitivity"),
 OPU( "sens_imag",RES_QUEST_SENS_IMAG,IF_REAL,    
        "dc sensitivity and imag part of ac sensitivity"),
 OPU( "sens_mag", RES_QUEST_SENS_MAG, IF_REAL, "ac sensitivity of magnitude"),
 OPU( "sens_ph",  RES_QUEST_SENS_PH,  IF_REAL,    "ac sensitivity of phase"),
 OPU( "sens_cplx",RES_QUEST_SENS_CPLX,IF_COMPLEX,    "ac sensitivity")
} ;

IFparm RESmPTable[] = { /* model parameters */
 IOPQ( "rsh",    RES_MOD_RSH,      IF_REAL,"Sheet resistance"),
 IOPZ( "narrow", RES_MOD_NARROW,   IF_REAL,"Narrowing of resistor"),
Ejemplo n.º 6
0
UINT statistic_traffic(LPVOID pvParam)
{
	CCUGBLinkerDlg* pMainWnd=(CCUGBLinkerDlg*)theApp.m_pMainWnd;
	CTrafficPage* pTrafficPage=(CTrafficPage*)&(pMainWnd->m_trafficPage);

	CString* errorInfo=new CString();
	int* flag=new int;

	char errbuf[PCAP_ERRBUF_SIZE];
	struct timeval st_ts;
	u_int netmask;
	struct bpf_program fcode;

	while(1) // 切换统计网卡后,对新网卡继续统计流量 
	{
		CStringA filter="";// 过滤器

		/* Open the output adapter */
		CStringA temp=CStringA(pTrafficPage->m_curNIC);
		if ( (fp= pcap_open(temp.GetBuffer(), 100, PCAP_OPENFLAG_NOCAPTURE_LOCAL, 1000, NULL, errbuf) ) == NULL)
		{
			errorInfo->Format(L"网卡打开失败,请检查是否已选择网卡. \n%S\n%S",temp.GetBuffer(), errbuf);
			*flag=BALLOON_ERROR;
			pMainWnd->PostMessage(WM_UPDATENOTIFY,(WPARAM)errorInfo,(LPARAM)flag);
			temp.ReleaseBuffer();
			return 1;
		}
		temp.ReleaseBuffer();

		/* Don't care about netmask, it won't be used for this filter */
		netmask=0xffffff; 

		// 配置过滤器,需读取本机网关,并获得网关mac地址
		char ipAddr[16]={0};
		char gatewayIP[16]={0};
		char gatewayMAC[18]={0};
		HKEY hKey;
		LONG lRet;
		DWORD BufferSize = 40;
		UCHAR* IPPerfData = new UCHAR[BufferSize];
		UCHAR* PerfData = new UCHAR[BufferSize];
		lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
			CString("SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\")
			+pTrafficPage->m_curNIC.Mid(12), 0, KEY_QUERY_VALUE, &hKey );

		if( lRet == ERROR_SUCCESS )
		{
			lRet=RegQueryValueEx( hKey,
				TEXT("EnableDHCP"),
				NULL,
				NULL,
				PerfData,
				&BufferSize );
			if( lRet == ERROR_SUCCESS )
			{
				BufferSize=40;
				if (PerfData[0]==1)
				{
					lRet=RegQueryValueEx( hKey,
						TEXT("DhcpIPAddress"),
						NULL,
						NULL,
						IPPerfData,
						&BufferSize );
					lRet=RegQueryValueEx( hKey,
						TEXT("DhcpDefaultGateway"),
						NULL,
						NULL,
						PerfData,
						&BufferSize );
				}
				else
				{
					lRet=RegQueryValueEx( hKey,
						TEXT("IPAddress"),
						NULL,
						NULL,
						IPPerfData,
						&BufferSize );
					lRet=RegQueryValueEx( hKey,
						TEXT("DefaultGateway"),
						NULL,
						NULL,
						PerfData,
						&BufferSize );
				}
			}
		}
		RegCloseKey( hKey );

		for (int i=0,j=0,k=0; i<15; i++,j++,k++)
		{
			if (PerfData[j]=='\0')
			{
				j++;
			}
			gatewayIP[i]=PerfData[j];
			if (IPPerfData[k]=='\0')
			{
				k++;
			}
			ipAddr[i]=IPPerfData[k];
		}
		CStringA IP(ipAddr);
		IP=IP.Trim();
		filter+="not (";
		filter+="src net (202.204.96/20 or 219.225.32/19 or 121.194.80/20)";
		if (IP!="")
		{
			filter+=" and dst host "+IP+")";
			filter+=" and not (src host ";
			filter+=IP;
			filter+=" and dst net (202.204.96/20 or 219.225.32/19 or 121.194.80/20)";
		}
		filter+=")";
		if (IP.Find("10.")==0 || IP.Find("172.")==0 || IP.Find("192.168.")==0)
		{
			if (CStringA(gatewayIP).Trim()!="")
			{
				// 获取网关mac地址
				ULONG MacAddr[2];       /* for 6-byte hardware addresses */
				ULONG PhysAddrLen = 6;  /* default to length of six bytes */
				memset(&MacAddr, 0xff, sizeof (MacAddr));
				SendARP(inet_addr(gatewayIP), 0, &MacAddr, &PhysAddrLen);

				BYTE *bPhysAddr = (BYTE *) & MacAddr;
				for (int i = 0; i < (int)PhysAddrLen; i++) 
				{
					if (i<(int)PhysAddrLen-1)
					{
						sprintf(gatewayMAC+i*3,"%.2X:",(int)bPhysAddr[i]);
					}
					else
					{
						sprintf(gatewayMAC+i*3,"%.2X",(int)bPhysAddr[i]);
					}
				}
				if (CStringA(gatewayMAC).Trim()!="")
				{
					filter+=CStringA(" and ether host ")+CStringA(gatewayMAC)+CStringA(" and not host ")+CStringA(gatewayIP);
				}
			}
		}

#ifdef _DEBUG
		AfxMessageBox(CString(filter));
#endif
		//compile the filter
		if (pcap_compile(fp, &fcode, filter, 1, netmask) <0 )
		{
			errorInfo->Format(L"Unable to compile the packet filter. Check the syntax.");
			*flag=BALLOON_ERROR;
			pMainWnd->PostMessage(WM_UPDATENOTIFY,(WPARAM)errorInfo,(LPARAM)flag);
			/* Free the device list */
			pcap_close(fp);
			return 1;
		}
#ifdef _DEBUG
		AfxMessageBox(L"compile filter");
#endif

		//set the filter
		if (pcap_setfilter(fp, &fcode)<0)
		{
			errorInfo->Format(L"Error setting the filter.");
			*flag=BALLOON_ERROR;
			pMainWnd->PostMessage(WM_UPDATENOTIFY,(WPARAM)errorInfo,(LPARAM)flag);
			/* Free the device list */
			pcap_close(fp);
			return 1;
		}
#ifdef _DEBUG
		AfxMessageBox(L"set filter");
#endif

		/* Put the interface in statstics mode */
		if (pcap_setmode(fp, MODE_STAT)<0)
		{
			errorInfo->Format(L"Error setting the mode.");
			*flag=BALLOON_ERROR;
			pMainWnd->PostMessage(WM_UPDATENOTIFY,(WPARAM)errorInfo,(LPARAM)flag);
			/* Free the device list */
			pcap_close(fp);
			return 1;
		}
#ifdef _DEBUG
		AfxMessageBox(L"set mode");
#endif

		/* Start the main loop */
		pcap_loop(fp, 0, dispatcher_handler, (PUCHAR)&st_ts);

		pcap_close(fp);
		fp=NULL;
	}
	return 0;
}
Ejemplo n.º 7
0
 IOPP( "resistance", RES_RESIST, IF_REAL,"Resistance"),
 IOPZU("temp",       RES_TEMP,   IF_REAL,"Instance operating temperature"),
 IOPQU("w",          RES_WIDTH,  IF_REAL,"Width"),
 IOPZU("l",          RES_LENGTH, IF_REAL,"Length"),
 OP(   "c",          RES_CURRENT,IF_REAL,"Current"),
 OP(   "p",          RES_POWER,  IF_REAL,"Power"),
} ;

static IFparm RESmPTable[] = { /* model parameters */
 IOPQ( "rsh",    RES_MOD_RSH,      IF_REAL,"Sheet resistance"),
 IOPZ( "narrow", RES_MOD_NARROW,   IF_REAL,"Narrowing of resistor"),
 IOPQ( "tc1",    RES_MOD_TC1,      IF_REAL,"First order temp. coefficient"),
 IOPQO("tc2",    RES_MOD_TC2,      IF_REAL,"Second order temp. coefficient"),
 IOPX( "defw",   RES_MOD_DEFWIDTH, IF_REAL,"Default device width"),
 IOPXU("tnom",   RES_MOD_TNOM,     IF_REAL,"Parameter measurement temperature"),
 IP(   "r",      RES_MOD_R,        IF_FLAG,"Device is a resistor model"),
};

static char *RESnames[] = {
    "R+",
    "R-"
};

static char *RESmodNames[] = {
    "r",
    NULL
};

static IFkeys RESkeys[] = {
    { 'r', NUMELEMS(RESnames), RESnames, 0, 0 },
};
Ejemplo n.º 8
0
**********/

#include "spice.h"
#include <stdio.h>
#include "devdefs.h"
#include "ifsim.h"
#include "vccsdefs.h"
#include "suffix.h"

/*
	Model for Voltage Controlled Current Source
*/

IFparm VCCSpTable[] = { /* parameters */ 
 IOPU("gain",       VCCS_TRANS, IF_REAL, "Transconductance of source (gain)"),
 IP("sens_trans",  VCCS_TRANS_SENS,IF_FLAG,
        "flag to request sensitivity WRT transconductance"),
 OPU("pos_node",    VCCS_POS_NODE, IF_INTEGER, "Positive node of source"),
 OPU("neg_node",    VCCS_NEG_NODE, IF_INTEGER, "Negative node of source"),
 OPU("cont_p_node",VCCS_CONT_P_NODE,IF_INTEGER,
				"Positive node of contr. source"),
 OPU("cont_n_node",VCCS_CONT_N_NODE,IF_INTEGER,
				"Negative node of contr. source"),
 IP("ic",          VCCS_IC, IF_REAL, "Initial condition of controlling source"),
 OP("i",            VCCS_CURRENT,IF_REAL, "Output current"),
 OP("v",            VCCS_VOLTS,IF_REAL, "Voltage across output"),
 OP("p",            VCCS_POWER,  IF_REAL, "Power"),
 OPU("sens_dc",   VCCS_QUEST_SENS_DC,       IF_REAL,    "dc sensitivity "),
 OPU("sens_real", VCCS_QUEST_SENS_REAL, IF_REAL, "real part of ac sensitivity"),
 OPU("sens_imag", VCCS_QUEST_SENS_IMAG, IF_REAL, "imag part of ac sensitivity"),
 OPU("sens_mag",  VCCS_QUEST_SENS_MAG,  IF_REAL, "sensitivity of ac magnitude"),
 OPU("sens_ph",   VCCS_QUEST_SENS_PH,   IF_REAL,  "sensitivity of ac phase"),
Ejemplo n.º 9
0
 IOPU("pd",        MOS3_PD,      IF_REAL   , "Drain perimeter"),
 IOPU("ps",        MOS3_PS,      IF_REAL   , "Source perimeter"),
 OP("id",    MOS3_CD,            IF_REAL, "Drain current"),
 OPR("cd",    MOS3_CD,            IF_REAL, "Drain current"),
 OPU("ibd",   MOS3_CBD,           IF_REAL, "B-D junction current"),
 OPU("ibs",   MOS3_CBS,           IF_REAL, "B-S junction current"),
 OPU("is",   MOS3_CS,    IF_REAL, "Source current"),
 OPU("ig",   MOS3_CG,    IF_REAL, "Gate current"),
 OPU("ib",   MOS3_CB,    IF_REAL, "Bulk current"),
 OP("vgs",   MOS3_VGS,            IF_REAL, "Gate-Source voltage"),
 OP("vds",   MOS3_VDS,            IF_REAL, "Drain-Source voltage"),
 OP("vbs",   MOS3_VBS,            IF_REAL, "Bulk-Source voltage"),
 OPU("vbd",   MOS3_VBD,            IF_REAL, "Bulk-Drain voltage"),
 IOPU("nrd",       MOS3_NRD,     IF_REAL   , "Drain squares"),
 IOPU("nrs",       MOS3_NRS,     IF_REAL   , "Source squares"),
 IP("off",        MOS3_OFF,     IF_FLAG   , "Device initially off"),
 IOPAU("icvds",       MOS3_IC_VDS,  IF_REAL   , "Initial D-S voltage"),
 IOPAU("icvgs",       MOS3_IC_VGS,  IF_REAL   , "Initial G-S voltage"),
 IOPAU("icvbs",       MOS3_IC_VBS,  IF_REAL   , "Initial B-S voltage"),
 IOPU("ic",     MOS3_IC,      IF_REALVEC, "Vector of D-S, G-S, B-S voltages"),
 IOPU("temp",      MOS3_TEMP,    IF_REAL   , "Instance operating temperature"),
 IP("sens_l",  MOS3_L_SENS, IF_FLAG, "flag to request sensitivity WRT length"),
 IP("sens_w",  MOS3_W_SENS, IF_FLAG, "flag to request sensitivity WRT width"),
 OPU("dnode",     MOS3_DNODE,   IF_INTEGER, "Number of drain node"),
 OPU("gnode",     MOS3_GNODE,   IF_INTEGER, "Number of gate node"),
 OPU("snode",     MOS3_SNODE,   IF_INTEGER, "Number of source node"),
 OPU("bnode",     MOS3_BNODE,   IF_INTEGER, "Number of bulk node"),
 OPU("dnodeprime", MOS3_DNODEPRIME,IF_INTEGER,"Number of internal drain node"),
 OPU("snodeprime", MOS3_SNODEPRIME,IF_INTEGER,"Number of internal source node"),
 OP("von",               MOS3_VON,           IF_REAL,    "Turn-on voltage"),
 OP("vdsat",       MOS3_VDSAT,         IF_REAL, "Saturation drain voltage"),
Ejemplo n.º 10
0
Author:	1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
Author:	1991 David A. Gates, U. C. Berkeley CAD Group
**********/

#include "ngspice.h"
#include "devdefs.h"
#include "numosdef.h"
#include "suffix.h"

/*
 * This file defines the 2d Numerical MOSFET data structures that are
 * available to the next level(s) up the calling hierarchy
 */

IFparm NUMOSpTable[] = {	/* parameters */
  IP("off", NUMOS_OFF, IF_FLAG, "Device initially off"),
  IP("ic.file", NUMOS_IC_FILE, IF_STRING, "Initial condition file"),
  IOP("area", NUMOS_AREA, IF_REAL, "Area factor"),
  IOP("w", NUMOS_WIDTH, IF_REAL, "Width factor"),
  IOP("l", NUMOS_LENGTH, IF_REAL, "Length factor"),
  IP("save", NUMOS_PRINT, IF_REAL, "Save solutions"),
  IP("print", NUMOS_PRINT, IF_REAL, "Print solutions"),
  OP("g11", NUMOS_G11, IF_REAL, "Conductance"),
  OP("c11", NUMOS_C11, IF_REAL, "Capacitance"),
  OP("y11", NUMOS_Y11, IF_COMPLEX, "Admittance"),
  OP("g12", NUMOS_G12, IF_REAL, "Conductance"),
  OP("c12", NUMOS_C12, IF_REAL, "Capacitance"),
  OP("y12", NUMOS_Y12, IF_COMPLEX, "Admittance"),
  OP("g13", NUMOS_G13, IF_REAL, "Conductance"),
  OP("c13", NUMOS_C13, IF_REAL, "Capacitance"),
  OP("y13", NUMOS_Y13, IF_COMPLEX, "Admittance"),
Ejemplo n.º 11
0
/**********
Copyright 1990 Regents of the University of California.  All rights reserved.
Author: 1987 Thomas L. Quarles
**********/

#include "ngspice/ngspice.h"
#include "ngspice/ifsim.h"
#include "ngspice/devdefs.h"
#include "cccsdefs.h"
#include "ngspice/suffix.h"

IFparm CCCSpTable[] = { /* parameters */ 
 IOPU("gain",    CCCS_GAIN,    IF_REAL    ,"Gain of source"),
 IOPU("control", CCCS_CONTROL, IF_INSTANCE,"Name of controlling source"),
 IOP ( "m",      CCCS_M,         IF_REAL   , "Parallel multiplier"),
 IP("sens_gain",CCCS_GAIN_SENS,IF_FLAG, "flag to request sensitivity WRT gain"),
 OPU("neg_node", CCCS_NEG_NODE,IF_INTEGER, "Negative node of source"),
 OPU("pos_node", CCCS_POS_NODE,IF_INTEGER, "Positive node of source"),
 OP("i",        CCCS_CURRENT, IF_REAL,    "CCCS output current"),
 OP("v",        CCCS_VOLTS,   IF_REAL,    "CCCS voltage at output"),
 OP("p",        CCCS_POWER,   IF_REAL,    "CCCS power"),
 OPU("sens_dc",  CCCS_QUEST_SENS_DC,  IF_REAL, "dc sensitivity "),
 OPU("sens_real",CCCS_QUEST_SENS_REAL,IF_REAL, "real part of ac sensitivity"),
 OPU("sens_imag",CCCS_QUEST_SENS_IMAG,IF_REAL, "imag part of ac sensitivity"),
 OPU("sens_mag", CCCS_QUEST_SENS_MAG, IF_REAL, "sensitivity of ac magnitude"),
 OPU("sens_ph",  CCCS_QUEST_SENS_PH,  IF_REAL, "sensitivity of ac phase"),
 OPU("sens_cplx",CCCS_QUEST_SENS_CPLX,IF_COMPLEX, "ac sensitivity")
};

#if 0
static IFparm CCCSmPTable[] = {
Ejemplo n.º 12
0
 * This file defines the LTRA data structures that are available to the next
 * level(s) up the calling hierarchy
 */

#include "ngspice.h"
#include "devdefs.h"
#include "ifsim.h"
#include "ltradefs.h"
#include "suffix.h"

IFparm LTRApTable[] = {		/* parameters */
  IOPAU("v1", LTRA_V1, IF_REAL, "Initial voltage at end 1"),
  IOPAU("v2", LTRA_V2, IF_REAL, "Initial voltage at end 2"),
  IOPAU("i1", LTRA_I1, IF_REAL, "Initial current at end 1"),
  IOPAU("i2", LTRA_I2, IF_REAL, "Initial current at end 2"),
  IP("ic", LTRA_IC, IF_REALVEC, "Initial condition vector:v1,i1,v2,i2"),
  OPU("pos_node1", LTRA_POS_NODE1, IF_INTEGER, "Positive node of end 1 of t-line"),
  OPU("neg_node1", LTRA_NEG_NODE1, IF_INTEGER, "Negative node of end 1 of t.line"),
  OPU("pos_node2", LTRA_POS_NODE2, IF_INTEGER, "Positive node of end 2 of t-line"),
  OPU("neg_node2", LTRA_NEG_NODE2, IF_INTEGER, "Negative node of end 2 of t-line")
};

IFparm LTRAmPTable[] = {	/* model parameters */
  IOP("ltra", LTRA_MOD_LTRA, IF_FLAG, "LTRA model"),
  IOPU("r", LTRA_MOD_R, IF_REAL, "Resistance per metre"),
  IOPAU("l", LTRA_MOD_L, IF_REAL, "Inductance per metre"),
  IOPR("g", LTRA_MOD_G, IF_REAL, "Conductance per metre"),
  IOPAU("c", LTRA_MOD_C, IF_REAL, "Capacitance per metre"),
  IOPU("len", LTRA_MOD_LEN, IF_REAL, "length of line"),
  OP("rel", LTRA_MOD_RELTOL, IF_REAL, "Rel. rate of change of deriv. for bkpt"),
  OP("abs", LTRA_MOD_ABSTOL, IF_REAL, "Abs. rate of change of deriv. for bkpt"),
Ejemplo n.º 13
0
#include "numcards.h"
#include "numgen.h"
#include "numenum.h"
#include "domndefs.h"
#include "devdefs.h"
#include "sperror.h"
#include "suffix.h"

#define UM_TO_CM 1.0e-4

extern int DOMNnewCard(void**,void*);
extern int DOMNparam(int,IFvalue*,void*);


IFparm DOMNpTable[] = {
  IP("x.low", 	DOMN_X_LOW,	IF_REAL,	"Location of left edge"),
  IP("x.high",	DOMN_X_HIGH,	IF_REAL,	"Location of right edge"),
  IP("y.low",	DOMN_Y_LOW,	IF_REAL,	"Location of top edge"),
  IP("y.high",	DOMN_Y_HIGH,	IF_REAL,	"Location of bottom edge"),
  IP("ix.low", 	DOMN_IX_LOW,	IF_INTEGER,	"Index of left edge"),
  IP("ix.high",	DOMN_IX_HIGH,	IF_INTEGER,	"Index of right edge"),
  IP("iy.low",	DOMN_IY_LOW,	IF_INTEGER,	"Index of top edge"),
  IP("iy.high",	DOMN_IY_HIGH,	IF_INTEGER,	"Index of bottom edge"),
  IP("number",	DOMN_NUMBER,	IF_INTEGER,	"Domain ID number"),
  IP("material",DOMN_MATERIAL,	IF_INTEGER,	"Material ID number")
};

IFcardInfo DOMNinfo = {
  "domain",
  "Identify material-type for portion of a device",
  NUMELEMS(DOMNpTable),
Ejemplo n.º 14
0
Archivo: main.c Proyecto: St4rk/PS4-SDK
#include "kernel.h"
#include "network.h"

struct in_addr ip = { IP(192, 168, 0, 4) };
const unsigned short port = 9023;
const char *message = "Hello!";

void _start(void) {
	int sock;
	
	struct sockaddr_in address = {
		AF_INET,
		port,
		ip,
	};
	
	initNetwork();
	
	sock = socket("test", AF_INET, SOCK_STREAM, 0);
	connect(sock, &address, sizeof(address));
	send(sock, message, sizeof(message), 0);
	close(sock);
	
	while(1) {
	}
}
Ejemplo n.º 15
0
Archivo: numd.c Proyecto: imr/ngspice
/**********
Copyright 1992 Regents of the University of California.  All rights reserved.
Author:	1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/

#include "ngspice/ngspice.h"
#include "ngspice/devdefs.h"
#include "numddefs.h"
#include "ngspice/suffix.h"

IFparm NUMDpTable[] = {		/* parameters */
  IP("off", NUMD_OFF, IF_FLAG, "Initially off"),
  IP("ic.file", NUMD_IC_FILE, IF_REAL, "Initial conditions file"),
  IOP("area", NUMD_AREA, IF_REAL, "Area factor"),
  IP("save", NUMD_PRINT, IF_INTEGER, "Save Solutions"),
  IPR("print", NUMD_PRINT, IF_INTEGER, "Print Solutions"),
  OP("vd", NUMD_VD, IF_REAL, "Voltage"),
  OPR("voltage", NUMD_VD, IF_REAL, "Voltage"),
  OP("id", NUMD_ID, IF_REAL, "Current"),
  OPR("current", NUMD_ID, IF_REAL, "Current"),
  OP("g11", NUMD_G11, IF_REAL, "Conductance"),
  OPR("conductance", NUMD_G11, IF_REAL, "Conductance"),
  OP("c11", NUMD_C11, IF_REAL, "Capacitance"),
  OPR("capacitance", NUMD_C11, IF_REAL, "Capacitance"),
  OP("y11", NUMD_Y11, IF_COMPLEX, "Admittance"),
  OPU("g12", NUMD_G12, IF_REAL, "Conductance"),
  OPU("c12", NUMD_C12, IF_REAL, "Capacitance"),
  OPU("y12", NUMD_Y12, IF_COMPLEX, "Admittance"),
  OPU("g21", NUMD_G21, IF_REAL, "Conductance"),
  OPU("c21", NUMD_C21, IF_REAL, "Capacitance"),
  OPU("y21", NUMD_Y21, IF_COMPLEX, "Admittance"),
Ejemplo n.º 16
0
/**********
Copyright 1990 Regents of the University of California.  All rights reserved.
Author: 1985 Thomas L. Quarles
**********/

#include "spice.h"
#include "devdefs.h"
#include "ifsim.h"
#include <stdio.h>
#include "inddefs.h"
#include "suffix.h"

IFparm INDpTable[] = { /* parameters */ 
 IOPAP("inductance",IND_IND,    IF_REAL,"Inductance of inductor"),
 IOPAU("ic",        IND_IC,     IF_REAL,"Initial current through inductor"),
 IP( "sens_ind", IND_IND_SENS,IF_FLAG,
        "flag to request sensitivity WRT inductance"),
 OP( "flux",      IND_FLUX,   IF_REAL,"Flux through inductor"),
 OP( "v",         IND_VOLT,   IF_REAL,"Terminal voltage of inductor"),
 OPR("volt",      IND_VOLT,   IF_REAL,""),
 OP( "i",   	  IND_CURRENT,IF_REAL,"Current through the inductor"),
 OPR( "current",  IND_CURRENT,IF_REAL,""),
 OP( "p",         IND_POWER,  IF_REAL,
        "instantaneous power dissipated by the inductor"),
 OPU( "sens_dc", IND_QUEST_SENS_DC,     IF_REAL, "dc sensitivity sensitivity"),
 OPU( "sens_real", IND_QUEST_SENS_REAL, IF_REAL, "real part of ac sensitivity"),
 OPU( "sens_imag", IND_QUEST_SENS_IMAG, IF_REAL, 
        "dc sensitivity and imag part of ac sensitivty"),
 OPU( "sens_mag",  IND_QUEST_SENS_MAG,  IF_REAL, "sensitivity of AC magnitude"),
 OPU( "sens_ph",   IND_QUEST_SENS_PH,   IF_REAL, "sensitivity of AC phase"),
 OPU( "sens_cplx", IND_QUEST_SENS_CPLX, IF_COMPLEX,    "ac sensitivity")
};
Ejemplo n.º 17
0
#include "ngspice.h"
#include "numcards.h"
#include "numgen.h"
#include "meshdefs.h"
#include "devdefs.h"
#include "sperror.h"
#include "suffix.h"

extern int XMSHnewCard(void**,void*);
extern int YMSHnewCard(void**,void*);
extern int MESHparam(int,IFvalue*,void*);



IFparm MESHpTable[] = {
  IP("location",MESH_LOCATION,	IF_REAL,	"Meshline location"),
  IP("width",	MESH_WIDTH,	IF_REAL,	"Distance to next line"),
  IP("number",	MESH_NUMBER,	IF_INTEGER,	"Meshline number"),
  IP("node",	MESH_NUMBER,	IF_INTEGER,	"Meshline number"),
  IP("ratio",	MESH_RATIO,	IF_REAL,	"Suggested spacing ratio"),
  IP("h.start",	MESH_H_START,	IF_REAL,	"Spacing at start of interval"),
  IP("h1",	MESH_H_START,	IF_REAL,	"Spacing at start of interVal"),
  IP("h.end",	MESH_H_END,	IF_REAL,	"Spacing at end of interval"),
  IP("h2",	MESH_H_END,	IF_REAL,	"Spacing at end of interval"),
  IP("h.max",	MESH_H_MAX,	IF_REAL,	"Max spacing during interval"),
  IP("h3",	MESH_H_MAX,	IF_REAL,	"Max spacing during interval")
};

IFcardInfo XMSHinfo = {
  "x.mesh",
  "Location of mesh lines",
Ejemplo n.º 18
0
#include "devdefs.h"
#include "bsim3def.h"
#include "suffix.h"

IFparm BSIM3pTable[] = { /* parameters */
IOP( "l",   BSIM3_L,      IF_REAL   , "Length"),
IOP( "w",   BSIM3_W,      IF_REAL   , "Width"),
IOP( "ad",  BSIM3_AD,     IF_REAL   , "Drain area"),
IOP( "as",  BSIM3_AS,     IF_REAL   , "Source area"),
IOP( "pd",  BSIM3_PD,     IF_REAL   , "Drain perimeter"),
IOP( "ps",  BSIM3_PS,     IF_REAL   , "Source perimeter"),
IOP( "nrd", BSIM3_NRD,    IF_REAL   , "Number of squares in drain"),
IOP( "nrs", BSIM3_NRS,    IF_REAL   , "Number of squares in source"),
IOP( "off", BSIM3_OFF,    IF_FLAG   , "Device is initially off"),
IOP( "nqsmod", BSIM3_NQSMOD, IF_INTEGER, "Non-quasi-static model selector"),
IP( "ic",  BSIM3_IC,     IF_REALVEC , "Vector of DS,GS,BS initial voltages"),
OP( "gmbs",         BSIM3_GMBS,       IF_REAL,    "Gmb"),
OP( "gm",           BSIM3_GM,         IF_REAL,    "Gm"),
OP( "gds",          BSIM3_GDS,        IF_REAL,    "Gds"),
OP( "vdsat",        BSIM3_VDSAT,      IF_REAL,    "Vdsat"),
OP( "vth",          BSIM3_VON,        IF_REAL,    "Vth"),
OP( "id",           BSIM3_CD,         IF_REAL,    "Ids"),
OP( "vbs",          BSIM3_VBS,        IF_REAL,    "Vbs"),
OP( "vgs",          BSIM3_VGS,        IF_REAL,    "Vgs"),
OP( "vds",          BSIM3_VDS,        IF_REAL,    "Vds"),
};

IFparm BSIM3mPTable[] = { /* model parameters */
IOP( "capmod", BSIM3_MOD_CAPMOD, IF_INTEGER, "Capacitance model selector"),
IOP( "mobmod", BSIM3_MOD_MOBMOD, IF_INTEGER, "Mobility model selector"),
IOP( "noimod", BSIM3_MOD_NOIMOD, IF_INTEGER, "Noise model selector"),
Ejemplo n.º 19
0
/**********
Copyright 1990 Regents of the University of California.  All rights reserved.
Author: 1987 Thomas L. Quarles
**********/

#include "ngspice/ngspice.h"
#include "ngspice/ifsim.h"
#include "ngspice/devdefs.h"
#include "vcvsdefs.h"
#include "ngspice/suffix.h"

IFparm VCVSpTable[] = { /* parameters */ 
 IOPU("gain", VCVS_GAIN, IF_REAL,"Voltage gain"),
 IP("sens_gain",VCVS_GAIN_SENS,IF_FLAG,"flag to request sensitivity WRT gain"),
 OPU("pos_node", VCVS_POS_NODE, IF_INTEGER, "Positive node of source"),
 OPU("neg_node", VCVS_NEG_NODE, IF_INTEGER, "Negative node of source"),
 OPU("cont_p_node",VCVS_CONT_P_NODE,IF_INTEGER,
					"Positive node of contr. source"),
 OPU("cont_n_node",VCVS_CONT_N_NODE,IF_INTEGER,
					"Negative node of contr. source"),
 IP("ic", VCVS_IC, IF_REAL, "Initial condition of controlling source"),
 OP("i",        VCVS_CURRENT,       IF_REAL,        "Output current"),
 OP("v",        VCVS_VOLTS,         IF_REAL,        "Output voltage"),
 OP("p",        VCVS_POWER,         IF_REAL,        "Power"),
 OPU("sens_dc",   VCVS_QUEST_SENS_DC,  IF_REAL, "dc sensitivity "),
 OPU("sens_real", VCVS_QUEST_SENS_REAL,IF_REAL, "real part of ac sensitivity"),
 OPU("sens_imag", VCVS_QUEST_SENS_IMAG,IF_REAL, "imag part of ac sensitivity"),
 OPU("sens_mag",  VCVS_QUEST_SENS_MAG, IF_REAL, "sensitivity of ac magnitude"),
 OPU("sens_ph",   VCVS_QUEST_SENS_PH,  IF_REAL, "sensitivity of ac phase"),
 OPU("sens_cplx", VCVS_QUEST_SENS_CPLX,     IF_COMPLEX,    "ac sensitivity")
};
Ejemplo n.º 20
0
 OP("gm",           JFET_GM,             IF_REAL,   "Transconductance"),
 OP("gds",          JFET_GDS,            IF_REAL,   "Conductance D-S"),
 OP("ggs",          JFET_GGS,            IF_REAL,   "Conductance G-S"),
 OP("ggd",          JFET_GGD,            IF_REAL,   "Conductance G-D"),
 OPU("qgs", JFET_QGS,  IF_REAL,"Charge storage G-S junction"),
 OPU("qgd", JFET_QGD,  IF_REAL,"Charge storage G-D junction"),
 OPU("cqgs",JFET_CQGS, IF_REAL,
			"Capacitance due to charge storage G-S junction"),
 OPU("cqgd",JFET_CQGD, IF_REAL,
			"Capacitance due to charge storage G-D junction"),
 OPU("p",   JFET_POWER,IF_REAL,"Power dissipated by the JFET"),
};

IFparm JFETmPTable[] = { /* model parameters */
 OP("type",     JFET_MOD_TYPE,    IF_STRING, "N-type or P-type JFET model"),
 IP("njf",     JFET_MOD_NJF,     IF_FLAG,"N type JFET model"),
 IP("pjf",     JFET_MOD_PJF,     IF_FLAG,"P type JFET model"),
 IOP("vt0",     JFET_MOD_VTO,     IF_REAL,"Threshold voltage"),
 IOPR("vto",     JFET_MOD_VTO,    IF_REAL,"Threshold voltage"),
 IOP("beta",    JFET_MOD_BETA,    IF_REAL,"Transconductance parameter"),
 IOP("lambda",  JFET_MOD_LAMBDA,  IF_REAL,"Channel length modulation param."),
 IOP("rd",      JFET_MOD_RD,      IF_REAL,"Drain ohmic resistance"),
 OPU("gd", JFET_MOD_DRAINCONDUCT, IF_REAL,"Drain conductance"),
 IOP("rs",      JFET_MOD_RS,      IF_REAL,"Source ohmic resistance"),
 OPU("gs",JFET_MOD_SOURCECONDUCT,IF_REAL,"Source conductance"),
 IOPA("cgs",     JFET_MOD_CGS,    IF_REAL,"G-S junction capactance"),
 IOPA("cgd",     JFET_MOD_CGD,    IF_REAL,"G-D junction cap"),
 IOP("pb",      JFET_MOD_PB,      IF_REAL,"Gate junction potential"),
 IOP("is",      JFET_MOD_IS,      IF_REAL,"Gate junction saturation current"),
 IOP("fc",      JFET_MOD_FC,      IF_REAL,"Forward bias junction fit parm."),
 /* Modification for Sydney University JFET model */
Ejemplo n.º 21
0
**********/

/*
 * This file defines the VBIC data structures that are
 * available to the next level(s) up the calling hierarchy
 */

#include "ngspice/ngspice.h"
#include "ngspice/devdefs.h"
#include "vbicdefs.h"
#include "ngspice/suffix.h"

IFparm VBICpTable[] = { /* parameters */
 IOPU("area",    VBIC_AREA,           IF_REAL,    "Area factor"),
 IOPU("off",     VBIC_OFF,            IF_FLAG,    "Device initially off"),
 IP("ic",        VBIC_IC,             IF_REALVEC, "Initial condition vector"),
 IOPAU("icvbe",  VBIC_IC_VBE,         IF_REAL,    "Initial B-E voltage"),
 IOPAU("icvce",  VBIC_IC_VCE,         IF_REAL,    "Initial C-E voltage"),
 IOPU("temp",    VBIC_TEMP,           IF_REAL,    "Instance temperature"),
 IOPU("dtemp",   VBIC_DTEMP,          IF_REAL,    "Instance delta temperature"),
 IOPU("m",       VBIC_M,              IF_REAL,    "Multiplier"),

 OPU("collnode", VBIC_QUEST_COLLNODE, IF_INTEGER, "Number of collector node"),
 OPU("basenode", VBIC_QUEST_BASENODE, IF_INTEGER, "Number of base node"),
 OPU("emitnode", VBIC_QUEST_EMITNODE, IF_INTEGER, "Number of emitter node"),
 OPU("subsnode", VBIC_QUEST_SUBSNODE, IF_INTEGER, "Number of substrate node"),
 OPU("collCXnode",VBIC_QUEST_COLLCXNODE,IF_INTEGER, "Internal collector node"),
 OPU("collCInode",VBIC_QUEST_COLLCINODE,IF_INTEGER, "Internal collector node"),
 OPU("baseBXnode",VBIC_QUEST_BASEBXNODE,IF_INTEGER, "Internal base node"),
 OPU("baseBInode",VBIC_QUEST_BASEBINODE,IF_INTEGER, "Internal base node"),
 OPU("baseBPnode",VBIC_QUEST_BASEBPNODE,IF_INTEGER, "Internal base node"),
Ejemplo n.º 22
0
 IOPU("pd",      MOS2_PD,    IF_REAL   , "Drain perimeter"),
 IOPU("ps",      MOS2_PS,    IF_REAL   , "Source perimeter"),
 OP( "id",          MOS2_CD,          IF_REAL,"Drain current"),
 OPR( "cd",          MOS2_CD,          IF_REAL,""),
 OP( "ibd",     MOS2_CBD,   IF_REAL,    "B-D junction current"),
 OP( "ibs",     MOS2_CBS,   IF_REAL,    "B-S junction current"),
 OP( "is",      MOS2_CS,    IF_REAL,    "Source current "),
 OP( "ig",      MOS2_CG,    IF_REAL,    "Gate current "),
 OP( "ib",      MOS2_CB,    IF_REAL,    "Bulk current "),
 OP( "vgs",     MOS2_VGS,   IF_REAL,    "Gate-Source voltage"),
 OP( "vds",     MOS2_VDS,   IF_REAL,    "Drain-Source voltage"),
 OP( "vbs",     MOS2_VBS,   IF_REAL,    "Bulk-Source voltage"),
 OPU( "vbd",     MOS2_VBD,   IF_REAL,    "Bulk-Drain voltage"),
 IOPU("nrd",     MOS2_NRD,   IF_REAL   , "Drain squares"),
 IOPU("nrs",     MOS2_NRS,   IF_REAL   , "Source squares"),
 IP("off",      MOS2_OFF,   IF_FLAG   , "Device initially off"),
 IOPAU("icvds",     MOS2_IC_VDS,IF_REAL   , "Initial D-S voltage"),
 IOPAU("icvgs",     MOS2_IC_VGS,IF_REAL   , "Initial G-S voltage"),
 IOPAU("icvbs",     MOS2_IC_VBS,IF_REAL   , "Initial B-S voltage"),
 IOPU("temp",    MOS2_TEMP,  IF_REAL    ,"Instance operating temperature"),
 IOPU("dtemp",   MOS2_DTEMP, IF_REAL   , "Instance temperature difference"),
 IP( "ic",      MOS2_IC,    IF_REALVEC, "Vector of D-S, G-S, B-S voltages"),
 IP( "sens_l",  MOS2_L_SENS,IF_FLAG,  "flag to request sensitivity WRT length"),
 IP( "sens_w",  MOS2_W_SENS,IF_FLAG,  "flag to request sensitivity WRT width"),
 /*
 OP( "cgs",     MOS2_CGS,   IF_REAL   , "Gate-Source capacitance"),
 OP( "cgd",     MOS2_CGD,   IF_REAL   , "Gate-Drain capacitance"),
 */
 OPU( "dnode",   MOS2_DNODE, IF_INTEGER, "Number of drain node"),
 OPU( "gnode",   MOS2_GNODE, IF_INTEGER, "Number of gate node"),
 OPU( "snode",   MOS2_SNODE, IF_INTEGER, "Number of source node"),
Ejemplo n.º 23
0
IFparm URCpTable[] = { /* parameters */ 
 IOPU( "l",      URC_LEN,   IF_REAL, "Length of transmission line"),
 IOPU( "n",      URC_LUMPS, IF_REAL, "Number of lumps"),
 OPU( "pos_node",URC_POS_NODE,IF_INTEGER,"Positive node of URC"),
 OPU( "neg_node",URC_NEG_NODE,IF_INTEGER,"Negative node of URC"),
 OPU( "gnd",     URC_GND_NODE,IF_INTEGER,"Ground node of URC")
};

IFparm URCmPTable[] = { /* model parameters */
 IOP( "k",      URC_MOD_K,      IF_REAL, "Propagation constant"),
 IOPA( "fmax",   URC_MOD_FMAX,   IF_REAL, "Maximum frequency of interest"),
 IOP( "rperl",  URC_MOD_RPERL,  IF_REAL, "Resistance per unit length"),
 IOPA( "cperl",  URC_MOD_CPERL,  IF_REAL, "Capacitance per unit length"),
 IOP( "isperl", URC_MOD_ISPERL, IF_REAL, "Saturation current per length"),
 IOP( "rsperl", URC_MOD_RSPERL, IF_REAL, "Diode resistance per length"),
 IP( "urc",    URC_MOD_URC,    IF_FLAG, "Uniform R.C. line model")
};

char *URCnames[] = {
    "P1",
    "P2",
    "Ref"
};

int	URCnSize = NUMELEMS(URCnames);
int	URCpTSize = NUMELEMS(URCpTable);
int	URCmPTSize = NUMELEMS(URCmPTable);
int	URCiSize = sizeof(URCinstance);
int	URCmSize = sizeof(URCmodel);
Ejemplo n.º 24
0
static void
fast_intxx(struct proc *p, int intrno)
{
	struct trapframe *tf = p->p_md.md_regs;
	/*
	 * handle certain interrupts directly by pushing the interrupt
	 * frame and resetting registers, but only if user said that's ok
	 * (i.e. not revectored.)  Otherwise bump to 32-bit user handler.
	 */
	struct vm86_struct *u_vm86p;
	struct { u_short ip, cs; } ihand;

	u_long ss, sp;

	/*
	 * Note: u_vm86p points to user-space, we only compute offsets
	 * and don't deref it. is_revectored() above does copyin() to
	 * get stuff from it
	 */
	u_vm86p = (struct vm86_struct *)p->p_addr->u_pcb.vm86_userp;

	/*
	 * If user requested special handling, return to user space with
	 * indication of which INT was requested.
	 */
	if (is_bitset(intrno, &u_vm86p->int_byuser[0]))
		goto vector;

	/*
	 * If it's interrupt 0x21 (special in the DOS world) and the
	 * sub-command (in AH) was requested for special handling,
	 * return to user mode.
	 */
	if (intrno == 0x21 && is_bitset(V86_AH(tf), &u_vm86p->int21_byuser[0]))
		goto vector;

	/*
	 * Fetch intr handler info from "real-mode" IDT based at addr 0 in
	 * the user address space.
	 */
	if (copyin((caddr_t)(intrno * sizeof(ihand)), &ihand, sizeof(ihand)))
		goto bad;

	/*
	 * Otherwise, push flags, cs, eip, and jump to handler to
	 * simulate direct INT call.
	 */
	ss = SS(tf) << 4;
	sp = SP(tf);

	putword(ss, sp, get_vflags_short(p));
	putword(ss, sp, CS(tf));
	putword(ss, sp, IP(tf));
	SP(tf) = sp;

	IP(tf) = ihand.ip;
	CS(tf) = ihand.cs;

	return;

vector:
	vm86_return(p, VM86_MAKEVAL(VM86_INTx, intrno));
	return;

bad:
	vm86_return(p, VM86_UNKNOWN);
	return;
}
Ejemplo n.º 25
0
#define CONFIG


#include "devdefs.h"
#include "noisedef.h"
#include "suffix.h"


/* XXX Should be -1 ? There is always an extra null element at the end ? */
static char * specSigList[] = {
    "time"
};

static IFparm nodeParms[] = {
    IP( "nodeset",PARM_NS ,IF_REAL,"suggested initial voltage"),
    IP( "ic",PARM_IC ,IF_REAL,"initial voltage"),
    IP( "type",PARM_NODETYPE ,IF_INTEGER,"output type of equation")
};

IFsimulator SIMinfo = {
    "ngspice",			/* name */
    "Circuit level simulation program",	/* more about me */
    Spice_Version,		/* version */

    CKTinit,			/* newCircuit function */
    CKTdestroy,			/* deleteCircuit function */

    CKTnewNode,			/* newNode function */
    CKTground,			/* groundNode function */
    CKTbindNode,		/* bindNode function */
Ejemplo n.º 26
0
/*
 * Handle a GP fault that occurred while in VM86 mode.  Things that are easy
 * to handle here are done here (much more efficient than trapping to 32-bit
 * handler code and then having it restart VM86 mode).
 */
void
vm86_gpfault(struct proc *p, int type)
{
	struct trapframe *tf = p->p_md.md_regs;
	union sigval sv;

	/*
	 * we want to fetch some stuff from the current user virtual
	 * address space for checking.  remember that the frame's
	 * segment selectors are real-mode style selectors.
	 */
	u_long cs, ip, ss, sp;
	u_char tmpbyte;
	int trace;

	cs = CS(tf) << 4;
	ip = IP(tf);
	ss = SS(tf) << 4;
	sp = SP(tf);

	trace = tf->tf_eflags & PSL_T;

	/*
	 * For most of these, we must set all the registers before calling
	 * macros/functions which might do a vm86_return.
	 */
	tmpbyte = getbyte(cs, ip);
	IP(tf) = ip;
	switch (tmpbyte) {
	case CLI:
		/* simulate handling of IF */
		clr_vif(p);
		break;

	case STI:
		/* simulate handling of IF.
		 * XXX the i386 enables interrupts one instruction later.
		 * code here is wrong, but much simpler than doing it Right.
		 */
		set_vif(p);
		break;

	case INTxx:
		/* try fast intxx, or return to 32bit mode to handle it. */
		tmpbyte = getbyte(cs, ip);
		IP(tf) = ip;
		fast_intxx(p, tmpbyte);
		break;

	case INTO:
		if (tf->tf_eflags & PSL_V)
			fast_intxx(p, 4);
		break;

	case PUSHF:
		putword(ss, sp, get_vflags_short(p));
		SP(tf) = sp;
		break;

	case IRET:
		IP(tf) = getword(ss, sp);
		CS(tf) = getword(ss, sp);
	case POPF:
		set_vflags_short(p, getword(ss, sp));
		SP(tf) = sp;
		break;

	case OPSIZ:
		tmpbyte = getbyte(cs, ip);
		IP(tf) = ip;
		switch (tmpbyte) {
		case PUSHF:
			putdword(ss, sp, get_vflags(p) & ~PSL_VM);
			SP(tf) = sp;
			break;

		case IRET:
			IP(tf) = getdword(ss, sp);
			CS(tf) = getdword(ss, sp);
		case POPF:
			set_vflags(p, getdword(ss, sp) | PSL_VM);
			SP(tf) = sp;
			break;

		default:
			IP(tf) -= 2;
			goto bad;
		}
		break;

	case LOCK:
	default:
		IP(tf) -= 1;
		goto bad;
	}

	if (trace && tf->tf_eflags & PSL_VM) {
		sv.sival_int = 0;
		trapsignal(p, SIGTRAP, T_TRCTRAP, TRAP_TRACE, sv);
	}
	return;

bad:
	vm86_return(p, VM86_UNKNOWN);
	return;
}
Ejemplo n.º 27
0
#include "hsm1def.h"
#include "suffix.h"

IFparm HSM1pTable[] = { /* parameters */
 IOP( "l",   HSM1_L,      IF_REAL   , "Length"),
 IOP( "w",   HSM1_W,      IF_REAL   , "Width"),
 IOP( "ad",  HSM1_AD,     IF_REAL   , "Drain area"),
 IOP( "as",  HSM1_AS,     IF_REAL   , "Source area"),
 IOP( "pd",  HSM1_PD,     IF_REAL   , "Drain perimeter"),
 IOP( "ps",  HSM1_PS,     IF_REAL   , "Source perimeter"),
 IOP( "nrd", HSM1_NRD,    IF_REAL   , "Number of squares in drain"),
 IOP( "nrs", HSM1_NRS,    IF_REAL   , "Number of squares in source"),
 IOP( "temp", HSM1_TEMP,  IF_REAL   , "Lattice temperature"),
 IOP( "dtemp", HSM1_DTEMP,IF_REAL   , ""),
 IOP( "off", HSM1_OFF,    IF_FLAG   , "Device is initially off"), 
 IP ( "ic",  HSM1_IC,     IF_REALVEC , "Vector of DS,GS,BS initial voltages"),
 IOP( "m",   HSM1_M,      IF_REAL   , "Parallel multiplier")
};

IFparm HSM1mPTable[] = { /* model parameters */
  IP("nmos", HSM1_MOD_NMOS, IF_FLAG, ""),
  IP("pmos", HSM1_MOD_PMOS, IF_FLAG, ""),
  IOP("level", HSM1_MOD_LEVEL, IF_INTEGER, ""),
  IOP("info", HSM1_MOD_INFO, IF_INTEGER, "information level (for debug, etc.)"),
  IOP("noise", HSM1_MOD_NOISE, IF_INTEGER, "noise model selector"),
  IOP("version", HSM1_MOD_VERSION, IF_INTEGER, "model version 102 or 112 or 120"),
  IOP("show", HSM1_MOD_SHOW, IF_INTEGER, "show physical value"),
  IOP("corsrd", HSM1_MOD_CORSRD, IF_INTEGER, "solve equations accounting Rs and Rd."),
  IOP("coiprv", HSM1_MOD_COIPRV, IF_INTEGER, "use ids_prv as initial guess of Ids"),
  IOP("copprv", HSM1_MOD_COPPRV, IF_INTEGER, "use ps{0/l}_prv as initial guess of Ps{0/l}"),
  IOP("cocgso", HSM1_MOD_COCGSO, IF_INTEGER, "calculate cgso"),
Ejemplo n.º 28
0
/*
 * sniffer_next
 *
 * Fill a structure with a copy of the next packet and its metadata.
 * Return number of packets read.
 *
 */
static int
sniffer_next(source_t * src, void *out_buf, size_t out_buf_size)
{
    struct _snifferinfo * info = (struct _snifferinfo *) src->ptr; 
    uint npkts;                 /* processed pkts */
    uint out_buf_used;          /* bytes in output buffer */

    npkts = out_buf_used = 0; 
    mb();
    while (info->m->k2u_cons != info->m->k2u_prod) {
	uint ind;
	uint token;
	ushort iface;
	struct timeval tv;
	int len, pktofs; 
	pkt_t *pkt;
	char * base; 

	ind = info->m->k2u_cons % RING_SIZE;
	token = info->m->k2u_pipe[ind].token;

	iface = info->m->k2u_pipe[ind].interface;
	if (iface == (ushort)-1) {
	    /* Kernel decided not to use this token.  Return it. */
	    return_token(info->m, token);
	    info->m->k2u_cons++;
	    continue;
	}

	if (iface >= info->retimer_size || info->clock_retimers[iface] == NULL){
	    /* Clock calibration was incomplete.  Uh oh. */
	    return_token(info->m, token);
	    info->m->k2u_cons++;
	    continue;
	}

	/* we have a good incoming packet; deal with it. */
	base = info->packet_pool[token].payload; 
	len = info->m->k2u_pipe[ind].len; 
	getTime(info->clock_retimers[iface], info->m->k2u_pipe[ind].tstamp, 
		&tv, NULL);

        /* check if we have enough space in output buffer */
        if (sizeof(pkt_t) + len > out_buf_size - out_buf_used)
            break;

        /*
         * Now we have a packet: start filling a new pkt_t struct
         * (beware that it could be discarded later on)
         */
        pkt = (pkt_t *) ((char *)out_buf + out_buf_used);
        pkt->ts = TIME2TS(tv.tv_sec, tv.tv_usec); 
        pkt->len = len; 
        pkt->type = COMO_L2_ETH; 
        pkt->flags = 0; 
        pkt->caplen = 0;        /* NOTE: we update caplen as we go given
                                 * that we may not store all fields that
                                 * exists in the actual bpf packet (e.g.,
                                 * IP options)
                                 */

        bcopy(base, &pkt->layer2.eth, 14);
        if (H16(pkt->layer2.eth.type) != 0x0800) {
            /*
             * this is not an IP packet. discard and 
	     * go to next packet. 
	     */
            logmsg(LOGSNIFFER, "non-IP packet received (%04x)\n",
                H16(pkt->layer2.eth.type));
            continue;
        }
  	pktofs = 14; 
        base += 14;

        /* copy IP header */
        pkt->ih = *(struct _como_iphdr *) base;
        pkt->caplen += sizeof(struct _como_iphdr);

        /* skip the IP header
         *
         * XXX we are losing IP options if any in the packets.
         *     need to find a place to put them in the como packet
         *     data structure...
         */
        base += (IP(vhl) & 0x0f) << 2;
        pktofs += (IP(vhl) & 0x0f) << 2;

        /* copy layer 4 header and payload */
        bcopy(base, &pkt->layer4, len - pktofs); 
        pkt->caplen += (len - pktofs); 

	/* done with this packet. return the token */
	info->m->k2u_cons++;
	return_token(info->m, token);

        /* increment the number of processed packets */
        npkts++;
        out_buf_used += STDPKT_LEN(pkt); 
    }

    return npkts;		
}
Ejemplo n.º 29
0
void
lapic_dump(void)
{
	int	i;

#define BOOL(a) ((a)?' ':'!')
#define VEC(lvt) \
	LAPIC_READ(lvt)&LAPIC_LVT_VECTOR_MASK
#define	DS(lvt)	\
	(LAPIC_READ(lvt)&LAPIC_LVT_DS_PENDING)?" SendPending" : "Idle"
#define DM(lvt) \
	DM_str[(LAPIC_READ(lvt)>>LAPIC_LVT_DM_SHIFT)&LAPIC_LVT_DM_MASK]
#define MASK(lvt) \
	BOOL(LAPIC_READ(lvt)&LAPIC_LVT_MASKED)
#define TM(lvt) \
	(LAPIC_READ(lvt)&LAPIC_LVT_TM_LEVEL)? "Level" : "Edge"
#define IP(lvt) \
	(LAPIC_READ(lvt)&LAPIC_LVT_IP_PLRITY_LOW)? "Low " : "High"

	kprintf("LAPIC %d at %p version 0x%x\n", 
		(LAPIC_READ(ID)>>LAPIC_ID_SHIFT)&LAPIC_ID_MASK,
		(void *) lapic_start,
		LAPIC_READ(VERSION)&LAPIC_VERSION_MASK);
	kprintf("Priorities: Task 0x%x  Arbitration 0x%x  Processor 0x%x\n",
		LAPIC_READ(TPR)&LAPIC_TPR_MASK,
		LAPIC_READ(APR)&LAPIC_APR_MASK,
		LAPIC_READ(PPR)&LAPIC_PPR_MASK);
	kprintf("Destination Format 0x%x Logical Destination 0x%x\n",
		LAPIC_READ(DFR)>>LAPIC_DFR_SHIFT,
		LAPIC_READ(LDR)>>LAPIC_LDR_SHIFT);
	kprintf("%cEnabled %cFocusChecking SV 0x%x\n",
		BOOL(LAPIC_READ(SVR)&LAPIC_SVR_ENABLE),
		BOOL(!(LAPIC_READ(SVR)&LAPIC_SVR_FOCUS_OFF)),
		LAPIC_READ(SVR) & LAPIC_SVR_MASK);
#if CONFIG_MCA
	if (mca_is_cmci_present())
		kprintf("LVT_CMCI:    Vector 0x%02x [%s] %s %cmasked\n",
			VEC(LVT_CMCI),
			DM(LVT_CMCI),
			DS(LVT_CMCI),
			MASK(LVT_CMCI));
#endif
	kprintf("LVT_TIMER:   Vector 0x%02x %s %cmasked %s\n",
		VEC(LVT_TIMER),
		DS(LVT_TIMER),
		MASK(LVT_TIMER),
		(LAPIC_READ(LVT_TIMER)&LAPIC_LVT_PERIODIC)?"Periodic":"OneShot");
	kprintf("  Initial Count: 0x%08x \n", LAPIC_READ(TIMER_INITIAL_COUNT));
	kprintf("  Current Count: 0x%08x \n", LAPIC_READ(TIMER_CURRENT_COUNT));
	kprintf("  Divide Config: 0x%08x \n", LAPIC_READ(TIMER_DIVIDE_CONFIG));
	kprintf("LVT_PERFCNT: Vector 0x%02x [%s] %s %cmasked\n",
		VEC(LVT_PERFCNT),
		DM(LVT_PERFCNT),
		DS(LVT_PERFCNT),
		MASK(LVT_PERFCNT));
	kprintf("LVT_THERMAL: Vector 0x%02x [%s] %s %cmasked\n",
		VEC(LVT_THERMAL),
		DM(LVT_THERMAL),
		DS(LVT_THERMAL),
		MASK(LVT_THERMAL));
	kprintf("LVT_LINT0:   Vector 0x%02x [%s][%s][%s] %s %cmasked\n",
		VEC(LVT_LINT0),
		DM(LVT_LINT0),
		TM(LVT_LINT0),
		IP(LVT_LINT0),
		DS(LVT_LINT0),
		MASK(LVT_LINT0));
	kprintf("LVT_LINT1:   Vector 0x%02x [%s][%s][%s] %s %cmasked\n",
		VEC(LVT_LINT1),
		DM(LVT_LINT1),
		TM(LVT_LINT1),
		IP(LVT_LINT1),
		DS(LVT_LINT1),
		MASK(LVT_LINT1));
	kprintf("LVT_ERROR:   Vector 0x%02x %s %cmasked\n",
		VEC(LVT_ERROR),
		DS(LVT_ERROR),
		MASK(LVT_ERROR));
	kprintf("ESR: %08x \n", lapic_esr_read());
	kprintf("       ");
	for(i=0xf; i>=0; i--)
		kprintf("%x%x%x%x",i,i,i,i);
	kprintf("\n");
	kprintf("TMR: 0x");
	for(i=7; i>=0; i--)
		kprintf("%08x",LAPIC_READ_OFFSET(TMR_BASE, i*0x10));
	kprintf("\n");
	kprintf("IRR: 0x");
	for(i=7; i>=0; i--)
		kprintf("%08x",LAPIC_READ_OFFSET(IRR_BASE, i*0x10));
	kprintf("\n");
	kprintf("ISR: 0x");
	for(i=7; i >= 0; i--)
		kprintf("%08x",LAPIC_READ_OFFSET(ISR_BASE, i*0x10));
	kprintf("\n");
}
Ejemplo n.º 30
0
int NetEin:: list_net(QString flag)
{
int pos = 0;
int pos1 = 0;
int i = 0;
int j;
QStringList adresse_;
QString adresse_eigen;
QString adresse2;
QString befehl;
QString homepath = QDir::homePath(); 
QString hostname_;
 	hostname_ = hostname();
      // Eigenen Rechner nicht anzeigen
        adresse_eigen = IP("localhost");
        i = adresse_eigen.indexOf("name_query");
        if (i > -1)
           adresse_eigen = IP(hostname_);
        adresse_ = adresse_eigen.split(" ");
        adresse_eigen = adresse_[0];
 //smbtree: zuverlässige und schnelle Linux-Rechner Suche. Windows-Rechner werden aber nicht erkannt
// -N verhindert die sudo-Abfrage
        befehl = "smbtree -N 1> " +  homepath + "/.config/qt5-fsarchiver/smbtree.txt";
	system (befehl.toLatin1().data()); 
        QFile file(homepath + "/.config/qt5-fsarchiver/smbtree.txt");
    	QTextStream ds(&file);
        QString text = ds.readLine();
        if (file.open(QIODevice::ReadWrite | QIODevice::Text)) {
     	     text = ds.readLine();
   	     while (!ds.atEnd()) {
             	text = ds.readLine();
               // text = text.toLower(); 
                pos = text.indexOf("IPC$ ");
                if (pos > -1){
                pos1 = text.indexOf(hostname_);
                text = text.left(pos-1);
                text = text.trimmed();
                j = text.size();
		        text = text.right(j-2);
               // if (pos1 == -1) {
                     text = text.toLower();
                     text = IP(text); // IP ermitteln
                     adresse_ = text.split(" ");
                     adresse2 = adresse_[0]; 
                  if (adresse2 != adresse_eigen){ // Eigenen Rechner nicht anzeigen
                      widget_net[i]= text;
                      i++;}
                   if (i > 99)
                      break;
              //  }
             }} 
        } 
	file.close();
//Auswertung findsmb-qts Windows-Rechner werden erkannt
        befehl = "findsmb-qt5 1> " +  homepath + "/.config/qt5-fsarchiver/findsmb-qt.txt";
	system (befehl.toLatin1().data()); 
        QFile file1(homepath + "/.config/qt5-fsarchiver/findsmb-qt.txt");
    	QTextStream ds1(&file1);
        QString adresse = ds1.readLine();
        QString adresse1; 
        int k;
        // Eigenen Rechner nicht anzeigen
	hostname_ = hostname();
        adresse_eigen = IP("localhost");
        i = adresse_eigen.indexOf("name_query");
        if (i > -1)
           adresse_eigen = IP(hostname_);
        adresse_ = adresse_eigen.split(" ");
        adresse_eigen = adresse_[0];
        if (file1.open(QIODevice::ReadWrite | QIODevice::Text)) {
            for (k = 0; k < 5; k++){
               	adresse = ds1.readLine();
             }
   	     while (!ds1.atEnd()) {
             	adresse = ds1.readLine();
                adresse = adresse.toLower();
                k = adresse.size();
                if (k > 0)
                { //findsmb findet die IP-Adresse nicht
                   adresse_ = adresse.split(" ");
                   j = adresse_[0].size();
		   adresse2 = adresse_[0];
		   adresse = adresse.right(k-j);
                   adresse = adresse.trimmed();
                   adresse_ = adresse.split(" ");
                   adresse = adresse_[0];
                   pos = adresse.indexOf("+");
                   if (pos == -1)
                   {
                      adresse = IP(adresse);
		      // Prüfung ob adresse im Array widget_net schon vorhanden ist
                      k = 0;
                      if (adresse2 != adresse_eigen) // Eigenen Rechner nicht anzeigen
                	k = Array_pruefen(adresse2);
                      if (k == 2) {
         	        listWidget_net->addItem(adresse);
                        widget_net[i]= adresse;
                        i++;
                    }
                }
               }
             } 
        }
	file1.close();
        // Dateien entfernen 
  	if (file1.exists()){
     		befehl = "rm ~/.config/qt5-fsarchiver/findsmb-qt.txt";
		system (befehl.toLatin1().data());
       } 
        list_net_ssh(" ");
        //Ermitteln widget_net Belegung
        if (widget_net[0] == "" && flag == "1"){
   		QMessageBox::about(this,tr("Note","Hinweis"),
      		tr("There is currently no available network computer.\n","Es ist derzeit kein Netzwerkrechner.\n"));
        return 1;
   }
   
   return 0;
}