Esempio n. 1
0
void
enpci_setIrqMask(struct IsdnCardState *cs, BYTE val) {
        if (!val)
	        OutByte(cs->hw.njet.base+NETJET_IRQMASK1, 0x00);
        else
	        OutByte(cs->hw.njet.base+NETJET_IRQMASK1, TJ_AMD_IRQ);
}
Esempio n. 2
0
File: unzip.c Progetto: nbzwt/nPal
void         Expand(int      c)
   { 
      #define DLE           144
   
      switch (ExState) {
           
           case 0:
               if (c != DLE)
                   OutByte(c);
               else 
                   ExState = 1; 
           break; 
           
           case 1:
               if (c != 0)
               { 
                   V = c; 
                   Len = reduce_L(V);
                   ExState = reduce_F(Len);
               } 
               else 
               { 
                   OutByte(DLE); 
                   ExState = 0; 
               } 
           break; 
           
           case 2:   { 
                  Len = Len + c; 
                  ExState = 3; 
               } 
           break; 
           
           case 3:   { 
                  int i;
                  longint offset = reduce_D(V,c);
                  longint op = outpos - offset;

                  for (i = 0; i <= Len + 2; i++) 
                  { 
                     if (op < 0L) 
                        OutByte(0);
                     else 
                        OutByte(outbuf[(int)(op % sizeof(outbuf))]);
                     op++; 
                  } 

                  ExState = 0; 
               } 
         break;
      } 
   } 
Esempio n. 3
0
/* cs->writeisac, macro wByteAMD */
void
WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value)
{
	/* direktes Register */
	if(offset < 8)
		OutByte(cs->hw.njet.isac + 4*offset, value);

	/* indirektes Register */
	else {
		OutByte(cs->hw.njet.isac + 4*AMD_CR, offset);
		OutByte(cs->hw.njet.isac + 4*AMD_DR, value);
	}
}
Esempio n. 4
0
void UnmaskIRQ(unsigned char irq)
{
	if(irq == 0xFF)
	{
		OutByte(MASTER_DATA, 0x00);
		OutByte(SLAVE_DATA, 0x00);
	}
	else
	{
		irq = irq & (1<<irq);
		if(irq < 8)
			OutByte(MASTER_DATA, irq & 0xFF);
		else
			OutByte(SLAVE_DATA, irq >> 8);
	}
}
Esempio n. 5
0
static irqreturn_t
enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{
	struct IsdnCardState *cs = dev_id;
	BYTE s0val, s1val, ir;
	u_long flags;

	spin_lock_irqsave(&cs->lock, flags);
	s1val = InByte(cs->hw.njet.base + NETJET_IRQSTAT1);

        /* AMD threw an interrupt */
	if (!(s1val & TJ_AMD_IRQ)) {
                /* read and clear interrupt-register */
		ir = ReadByteAmd7930(cs, 0x00);
		Amd7930_interrupt(cs, ir);
		s1val = 1;
	} else
		s1val = 0;
	s0val = InByte(cs->hw.njet.base + NETJET_IRQSTAT0);
	if ((s0val | s1val)==0) { // shared IRQ
		spin_unlock_irqrestore(&cs->lock, flags);
		return IRQ_NONE;
	} 
	if (s0val)
		OutByte(cs->hw.njet.base + NETJET_IRQSTAT0, s0val);

	/* DMA-Interrupt: B-channel-stuff */
	/* set bits in sval to indicate which page is free */
	if (inl(cs->hw.njet.base + NETJET_DMA_WRITE_ADR) <
		inl(cs->hw.njet.base + NETJET_DMA_WRITE_IRQ))
		/* the 2nd write page is free */
		s0val = 0x08;
	else	/* the 1st write page is free */
		s0val = 0x04;
	if (inl(cs->hw.njet.base + NETJET_DMA_READ_ADR) <
		inl(cs->hw.njet.base + NETJET_DMA_READ_IRQ))
		/* the 2nd read page is free */
		s0val = s0val | 0x02;
	else	/* the 1st read page is free */
		s0val = s0val | 0x01;
	if (s0val != cs->hw.njet.last_is0) /* we have a DMA interrupt */
	{
		if (test_and_set_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
			spin_unlock_irqrestore(&cs->lock, flags);
			return IRQ_HANDLED;
		}
		cs->hw.njet.irqstat0 = s0val;
		if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_READ) !=
			(cs->hw.njet.last_is0 & NETJET_IRQM0_READ))
			/* we have a read dma int */
			read_tiger(cs);
		if ((cs->hw.njet.irqstat0 & NETJET_IRQM0_WRITE) !=
			(cs->hw.njet.last_is0 & NETJET_IRQM0_WRITE))
			/* we have a write dma int */
			write_tiger(cs);
		test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
	}
	spin_unlock_irqrestore(&cs->lock, flags);
	return IRQ_HANDLED;
}
Esempio n. 6
0
void InterruptHandler(CPU_State s, int vector)
{
	s = s; // remove warning about s
	if(vector == 0x21)
		KeybaordHandler();
	else
	{
		WriteString("\nNumber: ");
		WriteString(itoa(vector));
		WriteString(" Interrupt Handled (");
		WriteString(itoa(++counterOfThings));
		WriteString(")\n");
	}
	if(vector >= 20)
		OutByte(SLAVE, 0x20);
	OutByte(MASTER, 0x20);

}
Esempio n. 7
0
void    AlignEven( void ) {
//=========================

// Align ObjPtr on an even boundary.

    if( (int)ObjPtr & 0x0001 ) {
        OutByte( 0 );
    }
}
Esempio n. 8
0
static void
reset_enpci(struct IsdnCardState *cs)
{
	if (cs->debug & L1_DEB_ISAC)
		debugl1(cs, "enter:now PCI: reset");

	/* Reset on, (also for AMD) */
	cs->hw.njet.ctrl_reg = 0x07;
	OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
	mdelay(20);
	/* Reset off */
	cs->hw.njet.ctrl_reg = 0x30;
	OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
	/* 20ms delay */
	mdelay(20);
	cs->hw.njet.auxd = 0;  // LED-status
	cs->hw.njet.dmactrl = 0;
	OutByte(cs->hw.njet.base + NETJET_AUXCTRL, ~TJ_AMD_IRQ);
	OutByte(cs->hw.njet.base + NETJET_IRQMASK1, TJ_AMD_IRQ);
	OutByte(cs->hw.njet.auxa, cs->hw.njet.auxd); // LED off
}
Esempio n. 9
0
/* cs->readisac, macro rByteAMD */
BYTE
ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset)
{
	/* direktes Register */
	if(offset < 8)
		return (InByte(cs->hw.njet.isac + 4*offset));

	/* indirektes Register */
	else {
		OutByte(cs->hw.njet.isac + 4*AMD_CR, offset);
		return(InByte(cs->hw.njet.isac + 4*AMD_DR));
	}
}
Esempio n. 10
0
void UStart (struct MST *ms)
{
	uint32 count;
	uint32 int_state;
	
	int_state = DisableInterrupts();
	OutByte (TMR_TCW, TMRC_MODE0);
	count = InByte (TMR_TMRCNT0);
	count |= (InByte (TMR_TMRCNT0) << 8);
	RestoreInterrupts (int_state);
	
	ms->prev_count = count;
	ms->accum_count = 0;
	
}
Esempio n. 11
0
/*----------------------------------------------------------------------
  GetBpp() returns current graphics mode color depth
  In:  None
  Out: return 8 - 8 Bpp (256 color mode)
             16 - 16 Bpp (High color mode)
             24 - 24 Bpp (True color mode)
             32 - 32 Bpp (True color mode)
 ----------------------------------------------------------*/
u16 GetBpp(void)
{
    u8 bModeBpp;
    
    OutByte(TVIA3CEINDEX, 0x77);
    bModeBpp = InByte(TVIA3CFDATA) & 0x07;
    switch (bModeBpp) {
    case 0xA:                      /*444*/
    case 2:                        /*565*/
    case 6: bModeBpp = 16; break;  /*555*/
    case 3: bModeBpp = 32; break;  /*x888*/
    case 4: bModeBpp = 24; break;  /*888*/
    case 1: bModeBpp =  8; break;  /*8bpp index*/
    default:bModeBpp =  4; break;  /*4bpp VGA modes*/
    }
    return ((u16)bModeBpp);
}
Esempio n. 12
0
uint32 UElapsed (struct MST *ms)
{
	uint32 count;
	uint32 int_state;
    
	int_state = DisableInterrupts();
	OutByte (TMR_TCW,  TMRC_MODE0);
	count = InByte (TMR_TMRCNT0);
	count |= (InByte (TMR_TMRCNT0) << 8);
	RestoreInterrupts (int_state);
	
	ms->accum_count += (count <= ms->prev_count) ? (ms->prev_count - count) : 1;
	ms->prev_count = count;
    
    if (ms->accum_count <= 1)
    	return 0;
    	

    /* frac = 1000000 / 1193182; */
    /* multiplier = (2^32) * frac */
    
    return MullFrac (ms->accum_count - 1, 3599591091UL);
}
Esempio n. 13
0
void PICRemap(int pic1, int pic2)
{
	// Save the data currently in the data spaces
	unsigned char oldMasterData = InByte(MASTER_DATA);
	unsigned char oldSlaveData = InByte(SLAVE_DATA);

	// reset the chip (EOI: https://en.wikipedia.org/wiki/End_of_interrupt)
	OutByte(MASTER, EOI);

	// ICW1 control setup
	OutByte(MASTER, ICW1_INIT + ICW1_ICW4);
	OutByte(SLAVE, ICW1_INIT + ICW1_ICW4);

	OutByte(MASTER_DATA, pic1);
	OutByte(SLAVE_DATA, pic2);

	OutByte(MASTER_DATA, 4);
	OutByte(SLAVE_DATA, 2);

	OutByte(MASTER_DATA, ICW4_8086);
	OutByte(SLAVE_DATA, ICW4_8086);

	// Restore data
	OutByte(MASTER_DATA, oldMasterData);
	OutByte(SLAVE_DATA, oldSlaveData);

	// enable keyboard
	OutByte(0x21, 0xfd);
	OutByte(0xa1, 0xff);
	asm("sti");
}
Esempio n. 14
0
File: unzip.c Progetto: nbzwt/nPal
void         extract_member(void)
{ 
   int    b;
   printf("Extract Member \r\n");
for (b=0; b<sizeof(outbuf); b++) outbuf[b]=0;
   pcbits = 0; 
   incnt = 0; 
   outpos = 0L; 
   outcnt = 0; 
   zipeof = 0;

   //outfd = creat(filename,S_IWRITE|S_IREAD);
   //if (outfd < 1)
   //{ 
   //   printf("Can't create output: %s\n",filename); 
   //   exit(0);
   //} 

   //close(outfd);
   //outfd = open(filename,O_RDWR|O_BINARY);


   switch (cmethod) {
      
      case 0:     /* stored */ 
            { 
               //printf(" Extract: %s ...",filename); 
               while ((!zipeof)) 
               { 
                  ReadByte(&b); 
                  OutByte(b); 
               } 
            } 
      break; 
      
      case 1:   { 
               //printf("UnShrink: %s ...",filename); 
               unShrink(); 
            } 
      break; 
      
      case 2:   
      case 3:   
      case 4:   
      case 5:   { 
               //printf("  Expand: %s ...",filename); 
               unReduce(); 
            } 
      break; 
      
      default: printf("Unknown compression method."); 
   } 

   //if (outcnt > 0) 
      //write(outfd,outbuf,outcnt);


   /* set output file date and time */
   //td.zt.ztime = lrec.last_mod_file_time;
   //td.zt.zdate = lrec.last_mod_file_date;
   //setftime(outfd,&td.ft);

   //close(outfd);
   printf("  done.\n"); 
} 
Esempio n. 15
0
File: unzip.c Progetto: nbzwt/nPal
void         unShrink(void)

{ 
   int      stackp;
   int      finchar;
   int      code;
   int      oldcode;
   int      incode;


   /* decompress the file */ 
   maxcodemax = 1 << max_bits; 
   cbits = init_bits; 
   maxcode = (1 << cbits) - 1; 
   free_ent = first_ent; 
   offset = 0; 
   sizex = 0; 

   for (code = maxcodemax; code > 255; code--)
      prefix_of[code] = -1;

   for (code = 255; code >= 0; code--) 
   { 
      prefix_of[code] = 0;
      suffix_of[code] = code;
   } 

   ReadBits(cbits,&oldcode); 
   if (zipeof) return;
   finchar = oldcode; 

   OutByte(finchar); 

   stackp = 0; 

   while ((!zipeof)) 
   { 
      ReadBits(cbits,&code); 
      if (zipeof) return;

      while (code == clear)
      { 
         ReadBits(cbits,&code); 

         switch (code) {
            
            case 1:   { 
                  cbits++; 
                  if (cbits == max_bits) 
                     maxcode = maxcodemax;
                  else 
                     maxcode = (1 << cbits) - 1; 
               } 
            break;

            case 2:
                  partial_clear();
            break;
         } 

         ReadBits(cbits,&code); 
         if (zipeof) return;
      } 

   
      /* special case for KwKwK string */
      incode = code;
      if (prefix_of[code] == -1)
      { 
         stack[stackp] = finchar;
         stackp++; 
         code = oldcode; 
      } 


      /* generate output characters in reverse order */
      while (code >= first_ent)
      { 
         stack[stackp] = suffix_of[code];
         stackp++; 
         code = prefix_of[code];
      } 

      finchar = suffix_of[code];
      stack[stackp] = finchar;
      stackp++; 


      /* and put them out in forward order */
      while (stackp > 0)
      { 
         stackp--; 
         OutByte(stack[stackp]);
      } 


      /* generate new entry */
      code = free_ent;
      if (code < maxcodemax) 
      { 
         prefix_of[code] = oldcode;
         suffix_of[code] = finchar;
         while ((free_ent < maxcodemax) && (prefix_of[free_ent] != -1))
            free_ent++;
      } 


      /* remember previous code */
      oldcode = incode; 
   } 

} 
Esempio n. 16
0
File: v86.c Progetto: cod5/kielder
int V86HandleOpcode (struct ContextState *state)
{
	bool is_operand32 = FALSE;
	bool is_address32 = FALSE;
	uint32 *sp32;
	uint16 *sp16;
	uint32 eflags;
	uint8 *ip;
		
	uint32 new_ip;
	uint32 new_cs;
	uint8 *vector;

	
	
	
	while (1)
	{
		ip = V86GetAddress (state->return_eip, state->return_cs);
		
		switch (*ip)
		{
			case PREFIX_O32:
				is_operand32 = TRUE;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				continue;
				
			case PREFIX_A32:
				is_address32 = TRUE;
				ip++;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				continue;
			
				
			case OPCODE_PUSHF:
				if (is_operand32 == TRUE)
				{
					state->return_esp = ((state->return_esp & 0x0000ffff) - 4) & 0x0000ffff;
					sp32 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = state->return_eflags & V86_EFLAG_MASK;

					*sp32 = (v86_if == TRUE)
							? eflags | EFLAG_IF
							: eflags & ~EFLAG_IF;
				}
				else
				{
					state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff; 
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = state->return_eflags & V86_EFLAG_MASK;

					*sp16 = (uint16) (v86_if == TRUE)
							? eflags | EFLAG_IF
							: eflags & ~EFLAG_IF;					
					
				}
			
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
				
			case OPCODE_POPF:
				if (is_operand32 == TRUE)
				{
					sp32 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = *sp32;
					state->return_eflags = (eflags & V86_EFLAG_MASK) | EFLAG_IF | EFLAG_VM;
					v86_if = (eflags & EFLAG_IF) ? TRUE : FALSE;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 4) & 0x0000ffff;
				}
				else
				{
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = *sp16;
					state->return_eflags = (eflags & V86_EFLAG_MASK) | EFLAG_IF | EFLAG_VM;
					v86_if = (eflags & EFLAG_IF) ? TRUE : FALSE;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;
				}

				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;

			
			case OPCODE_INT:
			{
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				vector = V86GetAddress (state->return_eip, state->return_cs);
				V86GetInterruptVector (*vector, &new_ip, &new_cs);
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				
				state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff;
				sp16 = V86GetAddress (state->return_esp, state->return_ss);
				*sp16 = (uint16) state->return_eip;
				
				state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff;
				sp16 = V86GetAddress (state->return_esp, state->return_ss);
				*sp16 = (uint16) state->return_cs;
				
				state->return_esp = ((state->return_esp & 0x0000ffff) - 2) & 0x0000ffff;
				sp16 = V86GetAddress (state->return_esp, state->return_ss);
				
				eflags = (v86_if == TRUE)
						? (state->return_eflags & V86_EFLAG_MASK) | EFLAG_IF
						: (state->return_eflags & V86_EFLAG_MASK) & ~EFLAG_IF;
				
				*sp16 = (uint16) eflags;
				
				state->return_eflags = (state->return_eflags & ~(EFLAG_IF | EFLAG_TF | EFLAG_AC)) | EFLAG_VM;
				v86_if = FALSE;
				
				state->return_eip = new_ip & 0x0000ffff;
				state->return_cs = new_cs & 0x0000ffff;
				
				return 0;
			}
			
			case OPCODE_IRET:
				if (state->return_eip == 0x0002 && state->return_cs == 0x1000)
				{
					return 1;
				}
				else
				{
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					eflags = *sp16;
					
					eflags = (eflags & 0x257fd5) | (state->return_eflags & 0x1a0000);
					
					state->return_eflags = eflags | EFLAG_IF | EFLAG_VM;
					v86_if = (eflags & EFLAG_IF) ? TRUE : FALSE;
							
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;
					
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					state->return_cs = *sp16;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;
					
					sp16 = V86GetAddress (state->return_esp, state->return_ss);
					state->return_eip = *sp16;
					state->return_esp = ((state->return_esp & 0x0000ffff) + 2) & 0x0000ffff;

					return 0;
				}
							
				
			case OPCODE_CLI:
				v86_if = FALSE;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
							
			case OPCODE_STI:
				v86_if = TRUE;
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
					
		
			case OPCODE_OUTB:
				OutByte (state->edx, state->eax);
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
			
			case OPCODE_INB:
				state->eax = InByte (state->edx);
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
			
			case OPCODE_OUTWL:
				if(is_operand32 == FALSE)
					OutWord (state->edx, state->eax);
				else
					OutLong (state->edx, state->eax);
				
				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;
			
			case OPCODE_INWL:
				if(is_operand32 == FALSE)
					state->eax = InWord (state->edx);
				else
					state->eax = InLong (state->edx);

				state->return_eip = (state->return_eip + 1) & 0x0000ffff;
				return 0;

			case OPCODE_OUTB_AL_NN:
				OutByte (*(ip+1), state->eax);
				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;

			case OPCODE_INB_NN_AL:
				state->eax = InByte (*(ip+1));
				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;
			
			case OPCODE_OUTWL_EAX_NN:
				if (is_operand32 == FALSE)
					OutWord (*(ip+1), state->eax);
				else
					OutLong (*(ip+1), state->eax);

				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;
			
			case OPCODE_INWL_NN_EAX:
				if(is_operand32 == FALSE)
					state->eax = InWord (*(ip+1));
				else
					state->eax = InLong (*(ip+1));
				
				state->return_eip = (state->return_eip + 2) & 0x0000ffff;
				return 0;
			
			
			case OPCODE_HLT:
			{
				KPANIC ("Halt in V86");
			}
			
			default:
			{
				KPRINTF ("opcode = %#010x", *ip);
				KPANIC ("#GP Unknown V86 opcode");
			}
		}
	}
}
Esempio n. 17
0
/* called by config.c */
int __init
setup_enternow_pci(struct IsdnCard *card)
{
	int bytecnt;
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

#if CONFIG_PCI
#ifdef __BIG_ENDIAN
#error "not running on big endian machines now"
#endif
        strcpy(tmp, enternow_pci_rev);
	printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
	if (cs->typ != ISDN_CTYPE_ENTERNOW)
		return(0);
	test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);

	for ( ;; )
	{
		if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
			PCI_DEVICE_ID_TIGERJET_300,  dev_netjet))) {
			if (pci_enable_device(dev_netjet))
				return(0);
			cs->irq = dev_netjet->irq;
			if (!cs->irq) {
				printk(KERN_WARNING "enter:now PCI: No IRQ for PCI card found\n");
				return(0);
			}
			cs->hw.njet.base = pci_resource_start(dev_netjet, 0);
			if (!cs->hw.njet.base) {
				printk(KERN_WARNING "enter:now PCI: No IO-Adr for PCI card found\n");
				return(0);
			}
                        /* checks Sub-Vendor ID because system crashes with Traverse-Card */
			if ((dev_netjet->subsystem_vendor != 0x55) ||
				(dev_netjet->subsystem_device != 0x02)) {
				printk(KERN_WARNING "enter:now: You tried to load this driver with an incompatible TigerJet-card\n");
                                printk(KERN_WARNING "Use type=20 for Traverse NetJet PCI Card.\n");
                                return(0);
                        }
		} else {
                        printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
			return(0);
		}

		cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
		cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD

		/* Reset an */
		cs->hw.njet.ctrl_reg = 0x07;  // geändert von 0xff
		OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
		/* 20 ms Pause */
		mdelay(20);

		cs->hw.njet.ctrl_reg = 0x30;  /* Reset Off and status read clear */
		OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
		mdelay(10);

		cs->hw.njet.auxd = 0x00; // war 0xc0
		cs->hw.njet.dmactrl = 0;

		OutByte(cs->hw.njet.base + NETJET_AUXCTRL, ~TJ_AMD_IRQ);
		OutByte(cs->hw.njet.base + NETJET_IRQMASK1, TJ_AMD_IRQ);
		OutByte(cs->hw.njet.auxa, cs->hw.njet.auxd);

		break;
	}
#else

	printk(KERN_WARNING "enter:now PCI: NO_PCI_BIOS\n");
	printk(KERN_WARNING "enter:now PCI: unable to config Formula-n enter:now ISDN PCI ab\n");
	return (0);

#endif /* CONFIG_PCI */

	bytecnt = 256;

	printk(KERN_INFO
		"enter:now PCI: PCI card configured at 0x%lx IRQ %d\n",
		cs->hw.njet.base, cs->irq);
	if (!request_region(cs->hw.njet.base, bytecnt, "Fn_ISDN")) {
		printk(KERN_WARNING
			   "HiSax: %s config port %lx-%lx already in use\n",
			   CardType[card->typ],
			   cs->hw.njet.base,
			   cs->hw.njet.base + bytecnt);
		return (0);
	}
	setup_Amd7930(cs);
	cs->hw.njet.last_is0 = 0;
        /* macro rByteAMD */
        cs->readisac = &ReadByteAmd7930;
        /* macro wByteAMD */
        cs->writeisac = &WriteByteAmd7930;
        cs->dc.amd7930.setIrqMask = &enpci_setIrqMask;

        cs->BC_Read_Reg  = &dummyrr;
	cs->BC_Write_Reg = &dummywr;
	cs->BC_Send_Data = &netjet_fill_dma;
	cs->cardmsg = &enpci_card_msg;
	cs->irq_func = &enpci_interrupt;
	cs->irq_flags |= SA_SHIRQ;

        return (1);
}
Esempio n. 18
0
static int
enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
	u_long flags;
        BYTE *chan;

	if (cs->debug & L1_DEB_ISAC)
		debugl1(cs, "enter:now PCI: card_msg: 0x%04X", mt);

        switch (mt) {
		case CARD_RESET:
			spin_lock_irqsave(&cs->lock, flags);
			reset_enpci(cs);
                        Amd7930_init(cs);
                        spin_unlock_irqrestore(&cs->lock, flags);
			break;
		case CARD_RELEASE:
			release_io_netjet(cs);
			break;
		case CARD_INIT:
			reset_enpci(cs);
			inittiger(cs);
			/* irq must be on here */
			Amd7930_init(cs);
			break;
		case CARD_TEST:
			break;
                case MDL_ASSIGN:
                        /* TEI assigned, LED1 on */
                        cs->hw.njet.auxd = TJ_AMD_IRQ << 1;
                        OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd);
                        break;
                case MDL_REMOVE:
                        /* TEI removed, LEDs off */
	                cs->hw.njet.auxd = 0;
                        OutByte(cs->hw.njet.base + NETJET_AUXDATA, 0x00);
                        break;
                case MDL_BC_ASSIGN:
                        /* activate B-channel */
                        chan = (BYTE *)arg;

                        if (cs->debug & L1_DEB_ISAC)
		                debugl1(cs, "enter:now PCI: assign phys. BC %d in AMD LMR1", *chan);

                        cs->dc.amd7930.ph_command(cs, (cs->dc.amd7930.lmr1 | (*chan + 1)), "MDL_BC_ASSIGN");
                        /* at least one b-channel in use, LED 2 on */
                        cs->hw.njet.auxd |= TJ_AMD_IRQ << 2;
                        OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd);
                        break;
                case MDL_BC_RELEASE:
                        /* deactivate B-channel */
                        chan = (BYTE *)arg;

                        if (cs->debug & L1_DEB_ISAC)
		                debugl1(cs, "enter:now PCI: release phys. BC %d in Amd LMR1", *chan);

                        cs->dc.amd7930.ph_command(cs, (cs->dc.amd7930.lmr1 & ~(*chan + 1)), "MDL_BC_RELEASE");
                        /* no b-channel active -> LED2 off */
                        if (!(cs->dc.amd7930.lmr1 & 3)) {
                                cs->hw.njet.auxd &= ~(TJ_AMD_IRQ << 2);
                                OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd);
                        }
                        break;
                default:
                        break;

	}
	return(0);
}