コード例 #1
0
/* --------------------------------------------------------------------------
    Remove adapter directory and files in proc file system
   -------------------------------------------------------------------------- */
void remove_adapter_proc(diva_os_xdi_adapter_t * a)
{
	char tmp[16];

	if (a->proc_adapter_dir) {
		if (a->proc_d_l1_down) {
			remove_proc_entry(d_l1_down_proc_name,
					  (struct proc_dir_entry *) a->proc_adapter_dir);
		}
		if (a->proc_grp_opt) {
			remove_proc_entry(grp_opt_proc_name,
					  (struct proc_dir_entry *) a->proc_adapter_dir);
		}
		if (a->proc_info) {
			remove_proc_entry(info_proc_name,
					  (struct proc_dir_entry *) a->proc_adapter_dir);
		}
		sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
		remove_proc_entry(tmp, proc_net_eicon);
		DBG_TRC(("proc entry %s%d removed", adapter_dir_name,
			 a->controller));
	}
}
コード例 #2
0
/* -------------------------------------------------------------------------
  Stop Card Hardware
  ------------------------------------------------------------------------- */
static void stop_pri_hardware (PISDN_ADAPTER IoAdapter) {
 dword i;
 byte __iomem *p;
 dword volatile __iomem *cfgReg = (void __iomem *)DIVA_OS_MEM_ATTACH_CFG(IoAdapter);
 WRITE_DWORD(&cfgReg[3], 0);
 WRITE_DWORD(&cfgReg[1], 0);
 DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfgReg);
 IoAdapter->a.ram_out (&IoAdapter->a, &RAM->SWReg, SWREG_HALT_CPU) ;
 i = 0 ;
 while ( (i < 100) && (IoAdapter->a.ram_in (&IoAdapter->a, &RAM->SWReg) != 0) )
 {
  diva_os_wait (1) ;
  i++ ;
 }
 DBG_TRC(("%s: PRI stopped (%d)", IoAdapter->Name, i))
 cfgReg = (void __iomem *)DIVA_OS_MEM_ATTACH_CFG(IoAdapter);
 WRITE_DWORD(&cfgReg[0],((dword)(~0x03E00000)));
 DIVA_OS_MEM_DETACH_CFG(IoAdapter, cfgReg);
 diva_os_wait (1) ;
 p = DIVA_OS_MEM_ATTACH_RESET(IoAdapter);
 WRITE_BYTE(p, _MP_RISC_RESET | _MP_LED1 | _MP_LED2);
 DIVA_OS_MEM_DETACH_RESET(IoAdapter, p);
}
コード例 #3
0
/* --------------------------------------------------------------------------
    Create adapter directory and files in proc file system
   -------------------------------------------------------------------------- */
int create_adapter_proc(diva_os_xdi_adapter_t * a)
{
	struct proc_dir_entry *de, *pe;
	char tmp[16];

	sprintf(tmp, "%s%d", adapter_dir_name, a->controller);
	if (!(de = create_proc_entry(tmp, S_IFDIR, proc_net_eicon)))
		return (0);
	a->proc_adapter_dir = (void *) de;

	if (!(pe =
	     create_proc_entry(info_proc_name, S_IFREG | S_IRUGO | S_IWUSR, de)))
		return (0);
	a->proc_info = (void *) pe;
	pe->write_proc = info_write;
	pe->read_proc = info_read;
	pe->data = a;

	if ((pe = create_proc_entry(grp_opt_proc_name,
			       S_IFREG | S_IRUGO | S_IWUSR, de))) {
		a->proc_grp_opt = (void *) pe;
		pe->write_proc = write_grp_opt;
		pe->read_proc = read_grp_opt;
		pe->data = a;
	}
	if ((pe = create_proc_entry(d_l1_down_proc_name,
			       S_IFREG | S_IRUGO | S_IWUSR, de))) {
		a->proc_d_l1_down = (void *) pe;
		pe->write_proc = write_d_l1_down;
		pe->read_proc = read_d_l1_down;
		pe->data = a;
	}

	DBG_TRC(("proc entry %s created", tmp));

	return (1);
}
コード例 #4
0
/*------------------------------------------------------------------*/
static byte isdn_rc(ADAPTER *a,
		    byte Rc,
		    byte Id,
		    byte Ch,
		    word Ref,
		    dword extended_info_type,
		    dword extended_info)
{
	ENTITY *this;
	byte e_no;
	word i;
	int cancel_rc;
#ifdef USE_EXTENDED_DEBUGS
	{
		DBG_TRC(("<A%d Id=0x%x Rc=0x%x", ((ISDN_ADAPTER *)a->io)->ANum, Id, Rc))
			}
#else
	dbug(dprintf("isdn_rc(Rc=%x,Id=%x,Ch=%x)", Rc, Id, Ch));
#endif
	/* check for ready interrupt                                */
	if (Rc == READY_INT) {
		xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 0, 0);
		if (a->ReadyInt) {
			a->ReadyInt--;
			return 0;
		}
		return 2;
	}
	/* if we know this Id ...                                   */
	e_no = a->IdTable[Id];
	if (e_no) {
		this = entity_ptr(a, e_no);
		xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 0, a->IdTypeTable[this->No]);
		this->RcCh = Ch;
		/* if it is a return code to a REMOVE request, remove the   */
		/* Id from our table                                        */
		if ((a->misc_flags_table[e_no] & DIVA_MISC_FLAGS_REMOVE_PENDING) &&
		    (Rc == OK)) {
			if (a->IdTypeTable[e_no] == NL_ID) {
				if (a->RcExtensionSupported &&
				    (extended_info_type != DIVA_RC_TYPE_REMOVE_COMPLETE)) {
					dtrc(dprintf("XDI: N-REMOVE, A(%02x) Id:%02x, ignore RC=OK",
						     XDI_A_NR(a), Id));
					return (0);
				}
				if (extended_info_type == DIVA_RC_TYPE_REMOVE_COMPLETE)
					a->RcExtensionSupported = true;
			}
			a->misc_flags_table[e_no] &= ~DIVA_MISC_FLAGS_REMOVE_PENDING;
			a->misc_flags_table[e_no] &= ~DIVA_MISC_FLAGS_NO_RC_CANCELLING;
			free_entity(a, e_no);
			for (i = 0; i < 256; i++)
			{
				if (a->FlowControlIdTable[i] == Id)
					a->FlowControlIdTable[i] = 0;
			}
			a->IdTable[Id] = 0;
			this->Id = 0;
			/* ---------------------------------------------------------------
			   If we send N_DISC or N_DISK_ACK after we have received OK_FC
			   then the card will respond with OK_FC and later with RC==OK.
			   If we send N_REMOVE in this state we will receive only RC==OK
			   This will create the state in that the XDI is waiting for the
			   additional RC and does not delivery the RC to the client. This
			   code corrects the counter of outstanding RC's in this case.
			   --------------------------------------------------------------- */
			if ((this->More & XMOREC) > 1) {
				this->More &= ~XMOREC;
				this->More |= 1;
				dtrc(dprintf("XDI: correct MORE on REMOVE A(%02x) Id:%02x",
					     XDI_A_NR(a), Id));
			}
		}
		if (Rc == OK_FC) {
			a->FlowControlIdTable[Ch] = Id;
			a->FlowControlSkipTable[Ch] = false;
			this->Rc = Rc;
			this->More &= ~(XBUSY | XMOREC);
			this->complete = 0xff;
			xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
			CALLBACK(a, this);
			return 0;
		}
		/*
		  New protocol code sends return codes that comes from release
		  of flow control condition marked with DIVA_RC_TYPE_OK_FC extended
		  information element type.
		  If like return code arrives then application is able to process
		  all return codes self and XDI should not cances return codes.
		  This return code does not decrement XMOREC partial return code
		  counter due to fact that it was no request for this return code,
		  also XMOREC was not incremented.
		*/
		if (extended_info_type == DIVA_RC_TYPE_OK_FC) {
			a->misc_flags_table[e_no] |= DIVA_MISC_FLAGS_NO_RC_CANCELLING;
			this->Rc = Rc;
			this->complete = 0xff;
			xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
			DBG_TRC(("XDI OK_FC A(%02x) Id:%02x Ch:%02x Rc:%02x",
				 XDI_A_NR(a), Id, Ch, Rc))
				CALLBACK(a, this);
			return 0;
		}
		cancel_rc = !(a->misc_flags_table[e_no] & DIVA_MISC_FLAGS_NO_RC_CANCELLING);
		if (cancel_rc && (a->FlowControlIdTable[Ch] == Id))
		{
			a->FlowControlIdTable[Ch] = 0;
			if ((Rc != OK) || !a->FlowControlSkipTable[Ch])
			{
				this->Rc = Rc;
				if (Ch == this->ReqCh)
				{
					this->More &= ~(XBUSY | XMOREC);
					this->complete = 0xff;
				}
				xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
				CALLBACK(a, this);
			}
			return 0;
		}
		if (this->More & XMOREC)
			this->More--;
		/* call the application callback function                   */
		if (((!cancel_rc) || (this->More & XMOREF)) && !(this->More & XMOREC)) {
			this->Rc = Rc;
			this->More &= ~XBUSY;
			this->complete = 0xff;
			xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 1, a->IdTypeTable[this->No]);
			CALLBACK(a, this);
		}
		return 0;
	}
	/* if it's an ASSIGN return code check if it's a return     */
	/* code to an ASSIGN request from us                        */
	if ((Rc & 0xf0) == ASSIGN_RC) {
		e_no = get_assign(a, Ref);
		if (e_no) {
			this = entity_ptr(a, e_no);
			this->Id = Id;
			xdi_xlog_rc_event(XDI_A_NR(a), Id, Ch, Rc, 2, a->IdTypeTable[this->No]);
			/* call the application callback function                   */
			this->Rc = Rc;
			this->More &= ~XBUSY;
			this->complete = 0xff;
#if defined(DIVA_ISTREAM) /* { */
			if ((Rc == ASSIGN_OK) && a->ram_offset &&
			    (a->IdTypeTable[this->No] == NL_ID) &&
			    ((extended_info_type == DIVA_RC_TYPE_RX_DMA) ||
			     (extended_info_type == DIVA_RC_TYPE_CMA_PTR)) &&
			    extended_info) {
				dword offset = (*(a->ram_offset)) (a);
				dword tmp[2];
				extended_info -= offset;
#ifdef PLATFORM_GT_32BIT
				a->ram_in_dw(a, (void *)ULongToPtr(extended_info), (dword *)&tmp[0], 2);
#else
				a->ram_in_dw(a, (void *)extended_info, (dword *)&tmp[0], 2);
#endif
				a->tx_stream[Id]  = tmp[0];
				a->rx_stream[Id]  = tmp[1];
				if (extended_info_type == DIVA_RC_TYPE_RX_DMA) {
					DBG_TRC(("Id=0x%x RxDMA=%08x:%08x",
						 Id, a->tx_stream[Id], a->rx_stream[Id]))
						a->misc_flags_table[this->No] |= DIVA_MISC_FLAGS_RX_DMA;
				} else {
					DBG_TRC(("Id=0x%x CMA=%08x:%08x",
						 Id, a->tx_stream[Id], a->rx_stream[Id]))
						a->misc_flags_table[this->No] &= ~DIVA_MISC_FLAGS_RX_DMA;
					a->rx_pos[Id]     = 0;
					a->rx_stream[Id] -= offset;
				}
				a->tx_pos[Id]     = 0;
				a->tx_stream[Id] -= offset;
			} else {
				a->tx_stream[Id] = 0;
				a->rx_stream[Id] = 0;
				a->misc_flags_table[this->No] &= ~DIVA_MISC_FLAGS_RX_DMA;
			}
#endif /* } */
			CALLBACK(a, this);
			if (Rc == ASSIGN_OK) {
				a->IdTable[Id] = e_no;
			}
			else
			{
				free_entity(a, e_no);
				for (i = 0; i < 256; i++)
				{
					if (a->FlowControlIdTable[i] == Id)
						a->FlowControlIdTable[i] = 0;
				}
				a->IdTable[Id] = 0;
				this->Id = 0;
			}
			return 1;
		}
	}
	return 2;
}