⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wvlan_hcf.c

📁 pcmcia source code
💻 C
📖 第 1 页 / 共 5 页
字号:
//int		i, j;//hcf_16	scratch[2];		switch (action) {	  case HCF_ACT_INT_OFF:						// Disable Interrupt generation		ifbp->IFB_IntOffCnt++;																			/* 2 */		if ( ifbp->IFB_CardStat & CARD_STAT_PRESENT ) {			OUT_PORT_WORD( ifbp->IFB_IOBase + HREG_INT_EN, 0 ); 										/* 4 */			if ( IN_PORT_WORD( ifbp->IFB_IOBase + HREG_EV_STAT ) & ifbp->IFB_IntEnMask ) {				/* 5 */				rc = HCF_INT_PENDING;			}		}		break;			  case HCF_ACT_INT_ON:						// Enable Interrupt generation		if ( --ifbp->IFB_IntOffCnt == 0 ) {																/* 6 */			if ( ifbp->IFB_CardStat & CARD_STAT_PRESENT ) {				OUT_PORT_WORD( ifbp->IFB_IOBase + HREG_INT_EN, ifbp->IFB_IntEnMask );			}		}		rc = ifbp->IFB_IntOffCnt;		break;			  case  HCF_ACT_CARD_IN:					// MSF reported Card insertion							/* 7 */		ifbp->IFB_CardStat = CARD_STAT_PRESENT;		hcf_initialize ( ifbp );		if ( ifbp->IFB_CardStat & CARD_STAT_ENABLED ) {		  (void)hcf_enable( ifbp, 0 );		}		break;		  case 	HCF_ACT_CARD_OUT:  					// MSF reported Card removal							/* 9 */		ifbp->IFB_CardStat = 0;		break;					  case 	HCF_ACT_TALLIES:					// Hermes Inquire Tallies (F100) command				/*12 */		action = (hcf_action_cmd)(action - HCF_ACT_TALLIES + CFG_TALLIES);		if ( ifbp->IFB_CardStat & CARD_STAT_ENABLED ) {		  rc = cmd_wait( ifbp, HCMD_INQUIRE, action );		}  				break;							  default:		break;	}	return rc;}/* hcf_action *//*******************************************************************************************************************.MODULE			hcf_connect.LIBRARY 		HCF.TYPE 			function.SYSTEM			msdos.SYSTEM			unix.SYSTEM			NW4.APPLICATION	Card Initialization Group for WaveLAN based drivers and utilities.DESCRIPTION	Initializes Card and HCF housekeeping.ARGUMENTS  void hcf_connect( IFBP ifbp, hcf_io io_base ).RETURNS	n.a.  MSF-accessible fields of Result Block:	IFB_IOBase				entry parameter io_base	IFB_IORange				HREG_IO_RANGE (0x40)	IFB_HCFVersionMajor		the major part of the PVCS maintained version number	IFB_HCFVersionMinor		the minor part of the PVCS maintained version number	IFB_Version				version of the IFB layout (0x01 for this release)	.NARRATIVE Parameters:	ifbp		address of the Interface Block	io_base		I/O Base address of the NIC  Hcf_connect grants access right for the HCF to the IFB and initializes the HCF housekeeping part of the  IFB. Hcf_connect does not perform any I/O.  The HCF-Version fields are set dynamically, because I do not know of any C mechanism to have the compiler  and the version control system (PVCS) cooperate to achieve this at compile time.  The HCFVersions fields are  constructed by collecting and shifting the low order nibbles of the PVCS controlled ASCII representation.  Note that the low order nibble of a space (0x20) nicely coincides with the low order nibble of an ASCII '0'  (0x30). Also note that the code breaks when major or minor number exceeds 99..DIAGRAM 1:	patch_catch is called as early in the flow as the C-entry code allows to help the HCF debugger as much as	possible.  The philosophy behind patch_catch versus a simple direct usage of the INT_3 macro is explained	in the description of patch_catch 2:	The IFB is zero-filled. 	This presets IFB_CardStat and IFB_TickIni at appropriate values for hcf_initialize.10: In addition to the MSF readable fields mentioned in the description section, the following HCF specific	fields are given their actual value:	  -	a number of fields as side effect of the calls of hcf_action (see item 14)	  -	IFB_Magic	IFB_VERSION, which reflects the version of the IFB layout, is defined in HCF.H14:	Hcf_connect defaults to "no interrupt generation" (by calling hcf_action with the appropriate parameter),	"802.3 frame type" and "no card present" (implicitly achieved by the zero-filling of the IFB).	Depending on HCFL, the 802.3 frame type is either initialized in line or by calling hcf_action.	.NOTICE  If io_base ever needs to be dynamic, it may be more logical to pass	- io_base at hcf_enable or	- have a separate hcf_put_config command or	- demand a hcf_disconnect - hcf_connect sequence	.NOTICE  On platforms where the NULL-pointer is not a bit-pattern of all zeros, the zero-filling of the IFB results  in an seemingly incorrect initialization of IFB_MBp. The implementation of the MailBox manipulation in  put_mb_info protects against the absence of a MailBox based on IFB_MBSize, IFB_MBWp and ifbp->IFB_MBRp. This  has ramifications on the initialization of the MailBox via hcf_put_info with the CFG_REG_MB type..ENDOC				END DOCUMENTATION-------------------------------------------------------------------------------------------------------------*/void hcf_connect( IFBP ifbp, 					//address of the Interface Block				  hcf_io io_base				//I/O Base address of the NIC				) {hcf_8 *q;#if defined _M_I86TM#endif // _M_I86TM		for ( q = (hcf_8*)&ifbp[1]; q > (hcf_8*)ifbp; *--q = 0) /*NOP*/;									/* 2 */	ifbp->IFB_Version	= IFB_VERSION;					  												/* 10*/	ifbp->IFB_IOBase	= io_base;	ifbp->IFB_IORange	= HREG_IO_RANGE;	ifbp->IFB_Magic		= HCF_MAGIC;	ifbp->IFB_HCFVersionMajor	= (hcf_8)( (hcf_rev[REV_OFFSET] << 4 | hcf_rev[REV_OFFSET+1]) & 0x0F );	ifbp->IFB_HCFVersionMinor	= (hcf_8)( hcf_rev[REV_OFFSET+4] == ' ' ?								  		   hcf_rev[REV_OFFSET+3] & 0x0F :								  		   (hcf_rev[REV_OFFSET+3] << 4 | hcf_rev[REV_OFFSET+4]) & 0x0F );	(void)hcf_action(ifbp, HCF_ACT_INT_OFF );															/* 14*/    ifbp->IFB_FSBase = HFS_ADDR_DEST_ABS;	return;}/* hcf_connect	*//*******************************************************************************************************************.MODULE			hcf_disable.LIBRARY 		HCF.TYPE 			function.SYSTEM			msdos.SYSTEM			unix.SYSTEM			NW4.APPLICATION	Card Initialization Group for WaveLAN based drivers and utilities.DESCRIPTION    Disables data transmission and reception.ARGUMENTS  int hcf_disable( IFBP ifbp, hcf_16 port ).RETURNS	HCF_SUCCESS	HCF_ERR_NO_NIC	HCF_ERR_TIME_OUT (via cmd_wait)	HCF_FAILURE (via cmd_wait)	  MSF-accessible fields of Result Block:   	IFB_CardStat  -	reset CARD_STAT_ENABLED bit iff at completion no port enabled anymore.NARRATIVE  Parameters:	ifbp		address of the Interface Block  Condition Settings:	Card Interrupts	  - Unchanged					  -	Disabled (Note that the value of IFB_IntOffCnt is unchanged)					    					  .NOTICE o  hcf_disable may disable the card interrupts, however it does NOT influence IFB_IntOffCnt.	This way it is symmetrical with hcf_enable, which does NOT enable the card interrupts.		**************************************************************************************************************/int hcf_disable( IFBP ifbp, hcf_16 port ) {int					rc;//hcf_16				p_bit;		rc = cmd_wait( ifbp, HCMD_DISABLE | (port << 8 ), 0 );		ifbp->IFB_CardStat &= (hcf_16)~CARD_STAT_ENABLED;		(void)hcf_action( ifbp, HCF_ACT_INT_OFF );														/* 40 */		ifbp->IFB_IntOffCnt--;	return rc;}/* hcf_disable *//*******************************************************************************************************************.MODULE			hcf_disconnect.LIBRARY 		HCF.TYPE 			function.SYSTEM			msdos.SYSTEM			NW4.APPLICATION	Card Connection for WaveLAN based drivers and utilities.DESCRIPTION  Disable transmission and reception, release the IFB.ARGUMENTS  void hcf_disconnect( IFBP ifbp ).RETURNS  void  MSF-accessible fields of Result Block:  	IFB_CardStat	cleared.NARRATIVE  Parameters:	ifbp		address of the Interface Block  Description:	Brings the NIC in quiescent state by calling hcf_initialize, thus preventing any interrupts in the future..DIAGRAM 1:	hcf_initialize gives a justification to execute the Hermes Initialize command only when really needed. 	Despite this basic philosophy and although the HCF can determine whether the NIC is initialized based 	on IFB_CardStat, the minimal set of actions to initialize the Hermes is always done by calling 	ini_hermes. 5:	clear all IFB fields 	The clearing of IFB_CardStat prevents I/O on any subsequent hcf_function.ENDOC				END DOCUMENTATION-------------------------------------------------------------------------------------------------------------*/void hcf_disconnect( IFBP ifbp ) {hcf_8 *q;	ini_hermes( ifbp );	for ( q = (hcf_8*)&ifbp[1]; q > (hcf_8*)ifbp; *--q = 0) /*NOP*/;									/* 5 */}/* hcf_disconnect *//*******************************************************************************************************************.MODULE			hcf_enable.LIBRARY 		HCF.TYPE 			function.SYSTEM			msdos.SYSTEM			unix.SYSTEM			NW4.APPLICATION	Card Initialization Group for WaveLAN based drivers and utilities.DESCRIPTION    Enables data transmission and reception.ARGUMENTS  int hcf_enable( IFBP ifbp, hcf_16 port ).RETURNS	HCF_SUCCESS	HCF_ERR_TIME_OUT (via cmd_wait)	HCF_FAILURE (via cmd_wait)  MSF-accessible fields of Result Block  Condition Settings:	Card Interrupts: Off if IFB_IntOffCnt > 0; On if IFB_IntOffCnt == 0					 (Note that the value of IFB_IntOffCnt is unchanged).NARRATIVE  Parameters:  	ifbp	address of the Interface Block  Description:	hcf_enable takes successively the following actions: 6:	If the requested port is disabled and if the NIC is present, the Hermes Enable command is executed.	If CARD_STAT_PRESENT is off, the body of hcf_enable must be skipped to prevent I/O because the I/O space	may no longer owned by the HCF, due to a card swap.	The IFB_IntEnMask is set to allow Info events, Receive events and Allocate events to generate interrupts	and effectuated if appropriate based on IFB_IntOffCnt by calling enable_int.	Note that since the effect of interrupt enabling has no effect on IFB_IntOffCnt, this code may

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -