Lines Matching defs:ifbp
104 HCF_STATIC int cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 );
105 HCF_STATIC int init( IFBP ifbp );
106 HCF_STATIC int put_info( IFBP ifbp, LTVP ltvp );
108 HCF_STATIC int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp );
112 void calc_mic_rx_frag( IFBP ifbp, wci_bufp p, int len );
113 void calc_mic_tx_frag( IFBP ifbp, wci_bufp p, int len );
114 HCF_STATIC int check_mic( IFBP ifbp );
117 HCF_STATIC void calibrate( IFBP ifbp );
118 HCF_STATIC int cmd_cmpl( IFBP ifbp );
119 HCF_STATIC hcf_16 get_fid( IFBP ifbp );
120 HCF_STATIC void isr_info( IFBP ifbp );
122 HCF_STATIC DESC_STRCT* get_frame_lst(IFBP ifbp, int tx_rx_flag);
124 HCF_STATIC void get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ); //char*, byte count (usually even)
126 HCF_STATIC void put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag );
128 HCF_STATIC void put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) );
129 HCF_STATIC void put_frag_finalize( IFBP ifbp );
130 HCF_STATIC int setup_bap( IFBP ifbp, hcf_16 fid, int offset, int type );
132 static int fw_printf(IFBP ifbp, CFG_FW_PRINTF_STRCT FAR *ltvp);
135 HCF_STATIC int download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp );
517 *.MODULE int hcf_action( IFBP ifbp, hcf_16 action )
522 * ifbp address of the Interface Block
629 * - ifbp has a recognizable out-of-range value.
660 *4: The construction "if ( ifbp->IFB_IntOffCnt-- == 0 )" is optimal (in the sense of shortest/quickest
701 hcf_action( IFBP ifbp, hcf_16 action )
705 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
709 HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE || action == HCF_ACT_INT_OFF,
710 MERGE_2( action, ifbp->IFB_IntOffCnt ) )
712 HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, action )
714 HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFF ||
716 HCFASSERT( ifbp->IFB_IntOffCnt <= 16 || ifbp->IFB_IntOffCnt >= 0xFFFE,
717 MERGE_2( action, ifbp->IFB_IntOffCnt ) ) //nesting more than 16 deep seems unreasonable
725 if ( ifbp->IFB_IntOffCnt == 0xFFFE ) { // WakeUp test ;?tie this to the "new" super-LinkStat
726 ifbp->IFB_IntOffCnt++; // restore conventional I/F
731 //OOR if ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_DS_OOR ) { // OutOfRange
733 // hcf_cntl( ifbp, HCF_CNTL_ENABLE );
735 // ifbp->IFB_DSLinkStat &= ~( CFG_LINK_STAT_DS_IR | CFG_LINK_STAT_DS_OOR); //clear IR/OOR state
738 /*2*/ ifbp->IFB_IntOffCnt++;
752 ifbp->IFB_IntOffCnt = 0;
756 /*4*/ if ( ifbp->IFB_IntOffCnt-- == 0 && ifbp->IFB_CardStat == 0 ) {
759 if ( ifbp->IFB_CntlOpt & USE_DMA ) {
765 if ( ifbp->IFB_RscInd == 0 ) {
773 ifbp->IFB_IntOffCnt--; //becomes 0xFFFE
787 hcf_cntl( ifbp, HCF_CNTL_DISABLE );
788 cmd_exe( ifbp, HCMD_SLEEP, 0 );
791 // HCFASSERT( ifbp->IFB_IntOffCnt == 0xFFFE, ifbp->IFB_IntOffCnt )
792 // ifbp->IFB_IntOffCnt++; // restore conventional I/F
795 // rc = hcf_action( ifbp, HCF_ACT_INT_OFF ); /*bogus, IFB_IntOffCnt == 0xFFFF, so if you carefully look
806 ifbp->IFB_CKIPStat = action;
811 /*6*/ if ( ifbp->IFB_RxFID ) {
814 ifbp->IFB_RxFID = ifbp->IFB_RxLen = 0;
826 cmd_exe( ifbp, HCMD_INQUIRE, action - HCF_ACT_TALLIES + CFG_TALLIES );
842 *.MODULE int hcf_cntl( IFBP ifbp, hcf_16 cmd )
851 * ifbp address of the Interface Block
932 * - ifbp has a recognizable out-of-range value.
951 hcf_cntl( IFBP ifbp, hcf_16 cmd )
957 else if ( (x == HCMD_DISABLE || x == HCMD_ENABLE) && ifbp->IFB_FWIdentity.comp_id == COMP_ID_FW_AP ) {
965 // HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, cmd )
968 if ( ifbp->IFB_CardStat == 0 ) { /*2*/
969 /*6*/ rc = cmd_exe( ifbp, cmd, 0 );
971 ifbp->IFB_TickCnt = 0; //start 2 second period (with 1 tick uncertanty)
978 if ( ifbp->IFB_CntlOpt & USE_DMA ) {
979 hcf_io io_port = ifbp->IFB_IOBase;
983 ifbp->IFB_CntlOpt &= ~DMA_ENABLED;
987 /* ;? by rewriting hcf_dma_rx_put you can probably just call hcf_dma_rx_put( ifbp->IFB_FirstDesc[DMA_RX] )
990 ifbp->IFB_CntlOpt |= DMA_ENABLED;
993 p = ifbp->IFB_FirstDesc[DMA_RX];
997 put_frame_lst( ifbp, ifbp->IFB_FirstDesc[DMA_RX], DMA_RX );
998 if ( ifbp->IFB_FirstDesc[DMA_RX] ) {
999 put_frame_lst( ifbp, ifbp->IFB_FirstDesc[DMA_RX]->next_desc_addr, DMA_RX );
1008 p = ifbp->IFB_FirstDesc[DMA_RX];
1023 *.MODULE int hcf_connect( IFBP ifbp, hcf_io io_base )
1028 * ifbp (near) address of the Interface Block
1077 * - ifbp is not properly aligned ( ref chapter HCF_ALIGN in 4.1.1)
1133 * based on IFB_MBSize, IFB_MBWp and ifbp->IFB_MBRp. This has ramifications on the initialization of the
1140 * "HCFASSERT( (ifbp->IFB_AssertTrace & HCF_ASSERT_CONNECT) == 0, 0 )" is not useful because IFB contents
1149 hcf_connect( IFBP ifbp, hcf_io io_base )
1157 hcf_16 xa = ifbp->IFB_FWIdentity.typ;
1166 io_addr = ifbp->IFB_IOBase;
1179 for ( q = (hcf_8*)(&ifbp->IFB_Magic); q > (hcf_8*)ifbp; *--q = 0 ) /*NOP*/; /* 4 */
1180 ifbp->IFB_Magic = HCF_MAGIC;
1181 ifbp->IFB_Version = IFB_VERSION;
1187 ifbp->IFB_TallyLen = 1 + 2 * (HCF_NIC_TAL_CNT + HCF_HCF_TAL_CNT); //convert # of Tallies to L value for LTV
1188 ifbp->IFB_TallyTyp = CFG_TALLIES; //IFB_TallyTyp: set T value
1190 ifbp->IFB_IOBase = io_addr; //set IO_Base asap, so asserts via HREG_SW_2 don't harm
1191 ifbp->IFB_IORange = HREG_IO_RANGE;
1192 ifbp->IFB_CntlOpt = USE_16BIT;
1194 assert_ifbp = ifbp;
1195 ifbp->IFB_AssertLvl = 1;
1198 ifbp->IFB_AssertRtn = (MSF_ASSERT_RTNP)msf_assert; /* 6 */
1202 ifbp->IFB_AssertStrct.len = sizeof(ifbp->IFB_AssertStrct)/sizeof(hcf_16) - 1;
1203 ifbp->IFB_AssertStrct.typ = CFG_MB_INFO;
1204 ifbp->IFB_AssertStrct.base_typ = CFG_MB_ASSERT;
1205 ifbp->IFB_AssertStrct.frag_cnt = 1;
1206 ifbp->IFB_AssertStrct.frag_buf[0].frag_len =
1208 ifbp->IFB_AssertStrct.frag_buf[0].frag_addr = &ifbp->IFB_AssertLine;
1211 IF_PROT_TIME( prot_cnt = ifbp->IFB_TickIni = INI_TICK_INI; )
1217 IF_PROT_TIME( if ( prot_cnt ) prot_cnt = ifbp->IFB_TickIni; )
1222 HCFASSERT( ((hcf_32)(void*)ifbp & (HCF_ALIGN-1) ) == 0, (hcf_32)(void*)ifbp )
1235 (void)cmd_exe( ifbp, HCMD_INI, 0 );
1238 rc = init( ifbp ); /*14*/
1242 (void)hcf_get_info( ifbp, &x );
1243 ifbp->IFB_BusType = x.val[0];
1247 ifbp->IFB_CntlOpt &= ~USE_16BIT; //reset USE_16BIT
1250 ifbp->IFB_CntlOpt |= USE_DMA; //SET DMA
1252 ifbp->IFB_IORange = 0x40 /*i.s.o. HREG_IO_RANGE*/;
1256 } else HCFASSERT( ( ifbp->IFB_Magic ^= HCF_MAGIC ) == 0, ifbp->IFB_Magic ) /*NOP*/;
1258 ifbp->IFB_IOBase = io_base; /* 0*/
1295 get_frame_lst( IFBP ifbp, int tx_rx_flag )
1298 DESC_STRCT *head = ifbp->IFB_FirstDesc[tx_rx_flag];
1307 if ( ( ifbp->IFB_CntlOpt & DMA_ENABLED ) == 0 ) { //clear control bits when disabled
1314 if ( ifbp->IFB_CntlOpt & DMA_ENABLED ) {
1328 /*;?ifbp->IFB_LastDesc[tx_rx_flag] =*/ ifbp->IFB_FirstDesc[tx_rx_flag] = NULL;
1351 ifbp->IFB_FirstDesc[tx_rx_flag] = p;
1396 put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag )
1401 HCFASSERT( ifbp->IFB_CntlOpt & USE_DMA, ifbp->IFB_CntlOpt) //only hcf_dma_tx_put must also be DMA_ENABLED
1420 HCFASSERT( ifbp->IFB_FirstDesc[tx_rx_flag] == NULL, (hcf_32)ifbp->IFB_FirstDesc[tx_rx_flag])
1421 HCFASSERT( ifbp->IFB_LastDesc[tx_rx_flag] == NULL, (hcf_32)ifbp->IFB_LastDesc[tx_rx_flag])
1423 ifbp->IFB_FirstDesc[tx_rx_flag] = descp;
1424 // part of alternative ifbp->IFB_LastDesc[tx_rx_flag] = ifbp->IFB_FirstDesc[tx_rx_flag] = descp;
1430 HCFASSERT( ifbp->IFB_FirstDesc[tx_rx_flag], (hcf_32)descp )
1431 HCFASSERT( ifbp->IFB_LastDesc[tx_rx_flag], (hcf_32)descp )
1432 HCFASSERT( ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr == NULL,
1433 (hcf_32)ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr)
1435 ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr = descp;
1436 ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_phys_addr = descp->desc_phys_addr;
1443 OUT_PORT_DWORD( (ifbp->IFB_IOBase + port), descp->desc_phys_addr );
1445 ifbp->IFB_LastDesc[tx_rx_flag] = p;
1454 *.MODULE DESC_STRCT* hcf_dma_rx_get( IFBP ifbp )
1459 * ifbp address of the Interface Block
1501 hcf_dma_rx_get (IFBP ifbp)
1505 descp = get_frame_lst( ifbp, DMA_RX );
1511 if ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF )
1535 if ( descp == NULL ) ifbp->IFB_DmaPackets &= (hcf_16)~HREG_EV_RDMAD; //;?could be integrated into get_frame_lst
1543 *.MODULE void hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp )
1548 * ifbp address of the Interface Block
1562 * - ifbp has a recognizable out-of-range value.
1587 hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp )
1591 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
1594 put_frame_lst( ifbp, descp, DMA_RX );
1609 *.MODULE DESC_STRCT* hcf_dma_tx_get( IFBP ifbp )
1615 * ifbp address of the Interface Block
1634 hcf_dma_tx_get( IFBP ifbp )
1638 descp = get_frame_lst( ifbp, DMA_TX );
1652 ifbp->IFB_DmaPackets &= (hcf_16)~HREG_EV_TDMAD;
1661 *.MODULE void hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )
1666 * ifbp address of the Interface Block
1723 * - ifbp has a recognizable out-of-range value.
1775 hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )
1781 int x = ifbp->IFB_FWIdentity.comp_id == COMP_ID_FW_AP ? tx_cntl & ~HFS_TX_CNTL_PORT : tx_cntl;
1785 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
1787 HCFASSERT( ( ifbp->IFB_CntlOpt & (USE_DMA|DMA_ENABLED) ) == (USE_DMA|DMA_ENABLED), ifbp->IFB_CntlOpt)
1799 if ( ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_ON ) ||
1800 ( ( p->BUF_CNT >= 20 ) && ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) &&
1843 put_frame_lst( ifbp, descp, DMA_TX );
1914 *.MODULE int hcf_get_info( IFBP ifbp, LTVP ltvp )
1918 * ifbp address of the Interface Block
1954 * - ifbp has a recognizable out-of-range value.
2017 hcf_get_info( IFBP ifbp, LTVP ltvp )
2030 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
2041 (void)hcf_action( ifbp, HCF_ACT_TALLIES );
2042 q = (hcf_16*)&ifbp->IFB_TallyLen;
2047 if ( ifbp->IFB_MBInfoLen ) {
2048 if ( ifbp->IFB_MBp[ifbp->IFB_MBRp] == 0xFFFF ) {
2049 ifbp->IFB_MBRp = 0; //;?Probably superfluous
2051 q = &ifbp->IFB_MBp[ifbp->IFB_MBRp];
2052 ifbp->IFB_MBRp += *q + 1; //update read pointer
2053 if ( ifbp->IFB_MBp[ifbp->IFB_MBRp] == 0xFFFF ) {
2054 ifbp->IFB_MBRp = 0;
2056 ifbp->IFB_MBInfoLen = ifbp->IFB_MBp[ifbp->IFB_MBRp];
2065 if ( q > &ifbp->IFB_TallyTyp && type == CFG_TALLIES ) {
2074 ltvp->val[0] = ifbp->IFB_CntlOpt;
2081 io_port = ifbp->IFB_IOBase + HREG_AUX_DATA; //to prevent side effects of the MSF-defined macro
2092 HCFASSERT( P->mode < ifbp->IFB_IOBase, P->mode ) //Check Register space
2100 rc = fw_printf(ifbp, (CFG_FW_PRINTF_STRCT*)ltvp);
2106 /*17*/ if ( ( rc = cmd_exe( ifbp, HCMD_ACCESS, type ) ) == HCF_SUCCESS &&
2107 ( rc = setup_bap( ifbp, type, 0, IO_IN ) ) == HCF_SUCCESS ) {
2108 get_frag( ifbp, (wci_bufp)<vp->len, 2*len+2 BE_PAR(2) );
2122 HCFASSERT( rc == HCF_SUCCESS || ( rc == HCF_ERR_LEN && ifbp->IFB_AssertTrace & 1<<HCF_TRACE_PUT_INFO ),
2131 *.MODULE int hcf_put_info( IFBP ifbp, LTVP ltvp )
2135 * ifbp address of the Interface Block
2175 * - ifbp has a recognizable out-of-range value.
2200 hcf_put_info( IFBP ifbp, LTVP ltvp )
2205 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
2224 ifbp->IFB_MICTxCntl = (hcf_16)( HFS_TX_CNTL_MIC | (i & KEY_ID )<<8 );
2225 ifbp->IFB_MICTxKey[0] = CNV_LONGP_TO_LITTLE( key_p );
2226 ifbp->IFB_MICTxKey[1] = CNV_LONGP_TO_LITTLE( (key_p+1) );
2229 ifbp->IFB_MICRxKey[i] = CNV_LONGP_TO_LITTLE( (key_p+2) );
2230 ifbp->IFB_MICRxKey[i+1] = CNV_LONGP_TO_LITTLE( (key_p+3) );
2235 ( (ifbp->IFB_MICTxCntl >> 8) & KEY_ID ) == CNV_SHORT_TO_LITTLE(P->tkip_key_id )
2237 ) { ifbp->IFB_MICTxCntl = 0; } //disable MIC-engine
2243 rc = download( ifbp, (CFG_PROG_STRCT FAR *)ltvp );
2248 ifbp->IFB_AssertRtn = P->rtnp;
2249 // ifbp->IFB_AssertLvl = P->lvl; //TODO not yet supported so default is set in hcf_connect
2256 ifbp->IFB_RIDLogp = ((CFG_RID_LOG_STRCT FAR*)ltvp)->recordp;
2261 if ( ( ltvp->val[0] & USE_DMA ) == 0 ) ifbp->IFB_CntlOpt &= ~USE_DMA;
2262 ifbp->IFB_CntlOpt |= ltvp->val[0] & USE_16BIT;
2269 ifbp->IFB_MBp = P->mb_addr;
2271 ifbp->IFB_MBSize = ifbp->IFB_MBp == NULL ? 0 : P->mb_size;
2272 ifbp->IFB_MBWp = ifbp->IFB_MBRp = 0;
2273 ifbp->IFB_MBp[0] = 0; //flag the MailBox as empty
2274 ifbp->IFB_MBInfoLen = 0;
2275 HCFASSERT( ifbp->IFB_MBSize >= 60 || ifbp->IFB_MBp == NULL, ifbp->IFB_MBSize )
2279 rc = put_info_mb( ifbp, (CFG_MB_INFO_STRCT FAR *)ltvp );
2288 rc = cmd_exe( ifbp, P->cmd, P->parm0 );
2294 P->ifb_err_cmd = ifbp->IFB_ErrCmd;
2295 P->ifb_err_qualifier = ifbp->IFB_ErrQualifier;
2302 HCFASSERT( P->mode < ifbp->IFB_IOBase, P->mode ) //Check Register space
2311 ifbp->IFB_FwPfBuff = *(CFG_FW_PRINTF_BUFFER_LOCATION_STRCT*)ltvp;
2316 rc = put_info( ifbp, ltvp );
2327 *.MODULE int hcf_rcv_msg( IFBP ifbp, DESC_STRCT *descp, unsigned int offset )
2334 * ifbp address of the Interface Block
2411 * - ifbp has a recognizable out-of-range value
2432 hcf_rcv_msg( IFBP ifbp, DESC_STRCT *descp, unsigned int offset )
2437 int tot_len = ifbp->IFB_RxLen - offset; //total length
2438 wci_bufp lap = ifbp->IFB_lap + offset; //start address in LookAhead Buffer
2439 hcf_16 lal = ifbp->IFB_lal - offset; //available data within LookAhead Buffer
2443 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
2446 HCFASSERT( ifbp->IFB_RxLen, HCF_TRACE_RCV_MSG )
2447 HCFASSERT( ifbp->IFB_RxLen >= offset, MERGE_2( offset, ifbp->IFB_RxLen ) )
2448 HCFASSERT( ifbp->IFB_lal >= offset, offset )
2449 HCFASSERT( (ifbp->IFB_CntlOpt & USE_DMA) == 0, 0xDADA )
2470 get_frag( ifbp, cp, j BE_PAR(0) );
2475 if ( ifbp->IFB_RxFID ) {
2476 rc = check_mic( ifbp ); //prevents MIC error report if hcf_service_nic already consumed all
2479 (void)hcf_action( ifbp, HCF_ACT_RX_ACK ); //only 1 shot to get the data, so free the resources in the NIC
2490 *.MODULE int hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )
2496 * ifbp address of the Interface Block
2592 * - ifbp has a recognizable out-of-range value
2643 hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )
2652 HCFASSERT( ifbp->IFB_RscInd || descp == NULL, ifbp->IFB_RscInd )
2653 HCFASSERT( (ifbp->IFB_CntlOpt & USE_DMA) == 0, 0xDADB )
2656 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
2662 { int x = ifbp->IFB_FWIdentity.comp_id == COMP_ID_FW_AP ? tx_cntl & ~HFS_TX_CNTL_PORT : tx_cntl;
2667 if ( descp ) ifbp->IFB_TxFID = 0; //cancel a pre-put message
2671 fid = get_fid(ifbp);
2674 (void)setup_bap( ifbp, fid, 0, IO_OUT );
2679 put_frag( ifbp, p->buf_addr, p->BUF_CNT BE_PAR(0) );
2681 rc = cmd_exe( ifbp, HCMD_THESEUS | HCMD_BUSY | HCMD_STARTPREAMBLE, fid );
2682 if ( ifbp->IFB_RscInd == 0 ) {
2683 ifbp->IFB_RscInd = get_fid( ifbp );
2696 tx_cntl |= ifbp->IFB_MICTxCntl;
2698 fid = ifbp->IFB_TxFID;
2699 if (fid == 0 && ( fid = get_fid( ifbp ) ) != 0 ) /* 4 */
2711 /*7*/ (void)setup_bap( ifbp, fid, HFS_TX_CNTL, IO_OUT );
2716 ifbp->IFB_TxFID = fid;
2729 /*10*/ put_frag( ifbp, p->buf_addr, HCF_DASA_SIZE BE_PAR(0) ); //write DA, SA with MIC calculation
2734 if(( ifbp->IFB_CKIPStat == HCF_ACT_CCX_ON ) ||
2735 ((GET_BUF_CNT(p) >= 20 ) && ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) &&
2746 put_frag( ifbp, &p->buf_addr[i], GET_BUF_CNT(p) - i BE_PAR(0) );
2757 put_frag( ifbp, snap_header, sizeof(snap_header) BE_PAR(0) );
2767 put_frag( ifbp, &p->buf_addr[i], p->BUF_CNT - i BE_PAR(0) );
2775 put_frag( ifbp, p->buf_addr, p->BUF_CNT BE_PAR(0) );
2779 put_frag_finalize( ifbp );
2782 /*16*/ rc = cmd_exe( ifbp, HCMD_BUSY | HCMD_TX | HCMD_RECL, fid );
2783 ifbp->IFB_TxFID = 0;
2789 /*20*/ if ( ifbp->IFB_RscInd == 0 ) {
2790 ifbp->IFB_RscInd = get_fid( ifbp );
2794 // HCFASSERT( level::ifbp->IFB_RscInd, ifbp->IFB_RscInd )
2804 *.MODULE int hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len )
2810 * ifbp address of the Interface Block
2929 * - ifbp is zero or other recognizable out-of-range value.
3054 hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len )
3062 HCFLOGENTRY( HCF_TRACE_SERVICE_NIC, ifbp->IFB_IntOffCnt )
3063 HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic )
3066 ifbp->IFB_LinkStat = 0; // ;? to be obsoleted ASAP /* 1*/
3067 ifbp->IFB_DSLinkStat &= ~CFG_LINK_STAT_CHANGE; /* 1*/
3068 (void)hcf_action( ifbp, HCF_ACT_RX_ACK ); /* 2*/
3069 if ( ifbp->IFB_CardStat == 0 && ( stat = IPW( HREG_EV_STAT ) ) != 0xFFFF ) { /* 4*/
3075 if ( ifbp->IFB_RscInd == 0 && stat & HREG_EV_ALLOC ) { //Note: IFB_RscInd is ALWAYS 1 for DMA
3076 ifbp->IFB_RscInd = 1;
3078 IF_TALLY( if ( stat & HREG_EV_INFO_DROP ) ifbp->IFB_HCF_Tallies.NoBufInfo++; )
3081 ifbp->IFB_TickCnt++;
3085 isr_info( ifbp );
3090 (void)setup_bap( ifbp, i, 0, IO_IN );
3091 get_frag( ifbp, &ifbp->IFB_TxFsStat, HFS_SWSUP BE_PAR(1) );
3096 if ( !( ifbp->IFB_CntlOpt & USE_DMA ) ) //!! be aware of the logical indentations
3098 /*16*/ if ( stat & HREG_EV_RX && ( ifbp->IFB_RxFID = IPW( HREG_RX_FID ) ) != 0 ) { //if 0 then DAWA_ACK
3102 HCFASSERT( ifbp->IFB_RxFID < CFG_PROD_DATA, ifbp->IFB_RxFID)
3103 (void)setup_bap( ifbp, ifbp->IFB_RxFID, 0, IO_IN );
3104 get_frag( ifbp, bufp, HFS_ADDR_DEST BE_PAR(1) );
3105 ifbp->IFB_lap = buf_addr = bufp + HFS_ADDR_DEST;
3106 ifbp->IFB_RxLen = (hcf_16)(bufp[HFS_DAT_LEN] + (bufp[HFS_DAT_LEN+1]<<8) + 2*6 + 2);
3107 /*26*/ if ( ifbp->IFB_RxLen >= 22 ) { // convenient for MIC calculation (5 DWs + 1 "skipped" W)
3109 /*30*/ get_frag( ifbp, buf_addr, 22 BE_PAR(0) );
3117 if( ifbp->IFB_CKIPStat != HCF_ACT_CCX_ON )
3129 ifbp->IFB_RxLen -= (HFS_TYPE - HFS_LEN);
3135 /*40*/ ifbp->IFB_lal = min( (hcf_16)(len - HFS_ADDR_DEST), ifbp->IFB_RxLen );
3136 i = ifbp->IFB_lal - ( buf_addr - ( bufp + HFS_ADDR_DEST ) );
3137 get_frag( ifbp, buf_addr, i BE_PAR(0) );
3140 if ( ifbp->IFB_lal == ifbp->IFB_RxLen ) {
3141 rc = check_mic( ifbp );
3144 /*44*/ if ( len - HFS_ADDR_DEST >= ifbp->IFB_RxLen ) {
3145 ifbp->IFB_RxFID = 0;
3151 IF_USE_DMA( ifbp->IFB_DmaPackets |= stat & ( HREG_EV_RDMAD | HREG_EV_TDMAD ); )
3228 *.SUBMODULE void calc_mic_rx_frag( IFBP ifbp, wci_bufp p, int len )
3232 * ifbp address of the Interface Block
3253 calc_mic_rx_frag( IFBP ifbp, wci_bufp p, int len )
3266 ifbp->IFB_MICRxCarry = 0xFFFF; //suppress MIC calculation
3268 ifbp->IFB_MICRxCarry = 0;
3272 ifbp->IFB_MICRx[0] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICRxKey[i ]);
3273 ifbp->IFB_MICRx[1] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICRxKey[i+1]);
3276 if ( ifbp->IFB_MICRxCarry == 0 ) {
3280 ifbp->IFB_MICRxCarry = (hcf_16)len;
3282 ifbp->IFB_MICRxCarry = 4;
3285 } else while ( ifbp->IFB_MICRxCarry < 4 && len ) { //note for hcf_16 applies: 0xFFFF > 4
3286 x.x8[ifbp->IFB_MICRxCarry++] = *p++;
3289 while ( ifbp->IFB_MICRxCarry == 4 ) { //contrived so we have only 1 call to calc_mic so we could bring it in-line
3290 calc_mic( ifbp->IFB_MICRx, x.x32 );
3294 ifbp->IFB_MICRxCarry = (hcf_16)len;
3306 *.SUBMODULE void calc_mic_tx_frag( IFBP ifbp, wci_bufp p, int len )
3310 * ifbp address of the Interface Block
3331 calc_mic_tx_frag( IFBP ifbp, wci_bufp p, int len )
3338 ifbp->IFB_MICTxCarry = 0xFFFF;
3340 if ( ifbp->IFB_MICTxCntl ) {
3342 ifbp->IFB_MICTxCarry = 0;
3344 ifbp->IFB_MICTx[0] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICTxKey[0]); /*Tx always uses Key 0 */
3345 ifbp->IFB_MICTx[1] = CNV_LONG_TO_LITTLE(ifbp->IFB_MICTxKey[1]);
3351 if ( ifbp->IFB_MICTxCarry == 0 ) {
3360 ifbp->IFB_MICTxCarry = (hcf_16)len;
3364 ifbp->IFB_MICTxCarry = 4;
3371 } else while ( ifbp->IFB_MICTxCarry < 4 && len ) { /* note for hcf_16 applies: 0xFFFF > 4 */
3372 x.x8[ifbp->IFB_MICTxCarry++] = *p++;
3377 while ( ifbp->IFB_MICTxCarry == 4 ) {
3379 calc_mic( ifbp->IFB_MICTx, x.x32 );
3388 ifbp->IFB_MICTxCarry = (hcf_16)len;
3401 *.SUBMODULE void calibrate( IFBP ifbp )
3405 * ifbp address of the Interface Block
3437 *8: ifbp->IFB_TickIni is multiplied to scale the found value back to the requested range as explained under 2.
3466 calibrate( IFBP ifbp )
3471 HCFTRACE( ifbp, HCF_TRACE_CALIBRATE );
3472 if ( ifbp->IFB_TickIni == INI_TICK_INI ) { /*1*/
3473 ifbp->IFB_TickIni = 0; /*2*/
3478 ifbp->IFB_TickIni++;
3481 ifbp->IFB_TickIni = INI_TICK_INI;
3482 ifbp->IFB_DefunctStat = HCF_ERR_DEFUNCT_TIMER;
3483 ifbp->IFB_CardStat |= CARD_STAT_DEFUNCT;
3487 ifbp->IFB_TickIni <<= HCF_PROT_TIME_SHFT; /*8*/
3489 HCFTRACE( ifbp, HCF_TRACE_CALIBRATE | HCF_TRACE_EXIT );
3498 *.SUBMODULE int check_mic( IFBP ifbp )
3502 * ifbp address of the Interface Block
3521 check_mic( IFBP ifbp )
3527 if ( *(wci_recordp)&ifbp->IFB_lap[-HFS_ADDR_DEST] & HFS_STAT_MIC ) {
3528 //or if ( ifbp->IFB_MICRxCarry != 0xFFFF )
3530 get_frag( ifbp, (wci_bufp)x32, 8 BE_PAR(0));//. get 8 byte MIC from NIC
3533 /*14*/ if ( x32[0] != CNV_LITTLE_TO_LONG(ifbp->IFB_MICRx[0]) ||
3534 x32[1] != CNV_LITTLE_TO_LONG(ifbp->IFB_MICRx[1]) ) {
3547 *.SUBMODULE int cmd_cmpl( IFBP ifbp )
3551 * ifbp address of the Interface Block
3591 cmd_cmpl( IFBP ifbp )
3598 HCFLOGENTRY( HCF_TRACE_CMD_CPL, ifbp->IFB_Cmd )
3599 ifbp->IFB_Cmd &= ~HCMD_BUSY; /* 2 */
3604 IF_TALLY( ifbp->IFB_HCF_Tallies.MiscErr++; )
3606 HCFASSERT( DO_ASSERT, ifbp->IFB_Cmd )
3611 /*4*/ if ( stat != (ifbp->IFB_Cmd & HCMD_CMD_CODE) ) {
3612 /*8*/ if ( ( (stat ^ ifbp->IFB_Cmd ) & HCMD_CMD_CODE) != 0 ) {
3613 rc = ifbp->IFB_DefunctStat = HCF_ERR_DEFUNCT_CMD_SEQ;
3614 ifbp->IFB_CardStat |= CARD_STAT_DEFUNCT;
3616 IF_TALLY( ifbp->IFB_HCF_Tallies.MiscErr++; )
3617 ifbp->IFB_ErrCmd = stat;
3618 ifbp->IFB_ErrQualifier = IPW( HREG_RESP_0 );
3619 HCFASSERT( DO_ASSERT, MERGE_2( IPW( HREG_PARAM_0 ), ifbp->IFB_Cmd ) )
3620 HCFASSERT( DO_ASSERT, MERGE_2( ifbp->IFB_ErrQualifier, ifbp->IFB_ErrCmd ) )
3631 *.SUBMODULE int cmd_exe( IFBP ifbp, int cmd_code, int par_0 )
3635 * ifbp address of the Interface Block
3679 cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 ) //if HCMD_BUSY of cmd_code set, then do NOT wait for completion
3687 rc = ifbp->IFB_DefunctStat;
3692 /*2*/ if ( ifbp->IFB_Cmd & HCMD_BUSY ) {
3693 rc = cmd_cmpl( ifbp );
3697 ifbp->IFB_Cmd = cmd_code;
3699 rc = cmd_cmpl( ifbp );
3710 *.SUBMODULE int download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp )
3714 * ifbp address of the Interface Block
3734 download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp ) //Hermes-II download (volatile only)
3739 hcf_io io_port = ifbp->IFB_IOBase + HREG_AUX_DATA;
3746 if ( ifbp->IFB_DLMode == CFG_PROG_STOP && ltvp->mode == CFG_PROG_VOLATILE) {
3749 rc = cmd_exe( ifbp, HCMD_INI, 0 ); /* HCMD_INI can not be part of init() because that is called on
3751 rc = init( ifbp );
3754 if ( ltvp->mode == CFG_PROG_STOP && ifbp->IFB_DLMode == CFG_PROG_VOLATILE) {
3757 rc = cmd_exe( ifbp, HCMD_EXECUTE, (hcf_16) ltvp->nic_addr );
3759 rc = init( ifbp ); /*;? do we really want to skip init if cmd_exe failed, i.e.
3779 ifbp->IFB_DLMode = ltvp->mode; //save state in IFB_DLMode
3795 fw_printf(IFBP ifbp, CFG_FW_PRINTF_STRCT FAR *ltvp)
3802 CFG_FW_PRINTF_BUFFER_LOCATION_STRCT *p = &ifbp->IFB_FwPfBuff;
3809 if ( fw_cnt != ifbp->IFB_DbgPrintF_Cnt ) {
3810 // DbgPrint("fw_cnt=%d IFB_DbgPrintF_Cnt=%d\n", fw_cnt, ifbp->IFB_DbgPrintF_Cnt);
3811 DbMsgBuffer = p->DbMsgBuffer + ifbp->IFB_DbgPrintF_Cnt * 6; // each entry is 3 words
3818 ifbp->IFB_DbgPrintF_Cnt++;
3819 ifbp->IFB_DbgPrintF_Cnt &= (p->DbMsgSize - 1);
3830 *.SUBMODULE hcf_16 get_fid( IFBP ifbp )
3834 * ifbp address of the Interface Block
3859 get_fid( IFBP ifbp )
3867 IF_DMA( HCFASSERT(!(ifbp->IFB_CntlOpt & USE_DMA), ifbp->IFB_CntlOpt) )
3871 HCFASSERT( fid, ifbp->IFB_RscInd )
3879 if ( ifbp->IFB_RscInd == 1 ) {
3880 ifbp->IFB_RscInd = 0;
3885 fid = ifbp->IFB_RscInd;
3887 ifbp->IFB_RscInd = 0;
3896 *.SUBMODULE void get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) )
3900 * ifbp address of the Interface Block
3930 get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) )
3932 hcf_io io_port = ifbp->IFB_IOBase + HREG_DATA_1; //BAP data register
3946 if ( i && ifbp->IFB_CarryIn ) {
3949 *p++ = (hcf_8)(ifbp->IFB_CarryIn>>8);
3952 ifbp->IFB_CarryIn = 0;
3957 if ( !(ifbp->IFB_CntlOpt & USE_16BIT) && i >= 6 ) {
3985 ifbp->IFB_CarryIn = IN_PORT_WORD( io_port );
3987 bufp[len-1] = (hcf_8)ifbp->IFB_CarryIn;
3989 ifbp->IFB_CarryIn |= 0x1;
4013 init( IFBP ifbp )
4020 ifbp->IFB_CardStat = 0; /* 2*/
4022 IF_PROT_TIME( calibrate( ifbp ); ) /*10*/
4023 ifbp->IFB_FWIdentity.len = sizeof(CFG_FW_IDENTITY_STRCT)/sizeof(hcf_16) - 1;
4024 ifbp->IFB_FWIdentity.typ = CFG_FW_IDENTITY;
4025 rc = hcf_get_info( ifbp, (LTVP)&ifbp->IFB_FWIdentity.len );
4028 ifbp->IFB_FWIdentity.comp_id = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.comp_id );
4029 ifbp->IFB_FWIdentity.variant = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.variant );
4030 ifbp->IFB_FWIdentity.version_major = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.version_major );
4031 ifbp->IFB_FWIdentity.version_minor = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWIdentity.version_minor );
4035 ifbp->IFB_HSISup.len = sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1;
4036 ifbp->IFB_HSISup.typ = CFG_NIC_HSI_SUP_RANGE;
4037 rc = hcf_get_info( ifbp, (LTVP)&ifbp->IFB_HSISup.len );
4043 ifbp->IFB_HSISup.role = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.role );
4044 ifbp->IFB_HSISup.id = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.id );
4045 ifbp->IFB_HSISup.variant = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.variant );
4046 ifbp->IFB_HSISup.bottom = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.bottom );
4047 ifbp->IFB_HSISup.top = CNV_LITTLE_TO_SHORT( ifbp->IFB_HSISup.top );
4049 ifbp->IFB_FWSup.len = sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1;
4050 ifbp->IFB_FWSup.typ = CFG_FW_SUP_RANGE;
4051 (void)hcf_get_info( ifbp, (LTVP)&ifbp->IFB_FWSup.len );
4054 ifbp->IFB_FWSup.role = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.role );
4055 ifbp->IFB_FWSup.id = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.id );
4056 ifbp->IFB_FWSup.variant = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.variant );
4057 ifbp->IFB_FWSup.bottom = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.bottom );
4058 ifbp->IFB_FWSup.top = CNV_LITTLE_TO_SHORT( ifbp->IFB_FWSup.top );
4061 if ( ifbp->IFB_FWSup.id == COMP_ID_PRI ) { /* 20*/
4063 while ( i-- ) ((hcf_8*)(&ifbp->IFB_PRIIdentity))[i] = ((hcf_8*)(&ifbp->IFB_FWIdentity))[i];
4064 ifbp->IFB_PRIIdentity.typ = CFG_PRI_IDENTITY;
4065 ifbp->IFB_PRISup.typ = CFG_PRI_SUP_RANGE;
4066 xxxx[xxxx_PRI_IDENTITY_OFFSET] = &ifbp->IFB_PRIIdentity.len;
4067 xxxx[xxxx_PRI_IDENTITY_OFFSET+1] = &ifbp->IFB_PRISup.len;
4069 if ( !mmd_check_comp( (void*)&cfg_drv_act_ranges_hsi, &ifbp->IFB_HSISup) /* 22*/
4072 || !mmd_check_comp( (void*)&cfg_drv_act_ranges_pri, &ifbp->IFB_PRISup)
4075 ifbp->IFB_CardStat = CARD_STAT_INCOMP_PRI;
4078 if ( ( ifbp->IFB_FWSup.id == COMP_ID_STA && !mmd_check_comp( (void*)&cfg_drv_act_ranges_sta, &ifbp->IFB_FWSup) ) ||
4079 ( ifbp->IFB_FWSup.id == COMP_ID_APF && !mmd_check_comp( (void*)&cfg_drv_act_ranges_apf, &ifbp->IFB_FWSup) )
4081 ifbp->IFB_CardStat |= CARD_STAT_INCOMP_FW;
4087 if ( rc == HCF_SUCCESS && ifbp->IFB_FWIdentity.comp_id >= COMP_ID_FW_STA ) {
4093 rc = cmd_exe( ifbp, HCMD_ALLOC, 0 );
4095 // ifbp->IFB_RscInd = 1; //let's hope that by the time hcf_send_msg isa called, there will be a FID
4101 if ( ! ( ifbp->IFB_CntlOpt & USE_DMA ) )
4104 ifbp->IFB_RscInd = get_fid( ifbp );
4105 HCFASSERT( ifbp->IFB_RscInd, 0 )
4106 cmd_exe( ifbp, HCMD_ALLOC, 0 );
4121 *.SUBMODULE void isr_info( IFBP ifbp )
4125 * ifbp address of the Interface Block
4152 isr_info( IFBP ifbp )
4156 RID_LOGP ridp = ifbp->IFB_RIDLogp; //NULL or pointer to array of RID_LOG structures (terminated by zero typ)
4159 HCFTRACE( ifbp, HCF_TRACE_ISR_INFO ); /* 1 */
4163 (void)setup_bap( ifbp, fid, 0, IO_IN );
4164 get_frag( ifbp, (wci_bufp)info, 4 BE_PAR(2) );
4172 p = (hcf_32*)&ifbp->IFB_NIC_Tallies;
4179 ifbp->IFB_LinkStat = IPW( HREG_DATA_1 );
4188 get_frag( ifbp, (wci_bufp)&ridp->bufp[2], (ridp->bufp[0] - 1)*2 BE_PAR(0) );
4196 HCFTRACE( ifbp, HCF_TRACE_ISR_INFO | HCF_TRACE_EXIT );
4206 // ifbp->IFB_DSLinkStat = IPW( HREG_DATA_1 ) | CFG_LINK_STAT_CHANGE; //corrupts BAP !! ;?
4207 // ifbp->IFB_LinkStat = ifbp->IFB_DSLinkStat & CFG_LINK_STAT_FW; //;? to be obsoleted
4208 // printk( "<4>linkstatus: %04x\n", ifbp->IFB_DSLinkStat ); //;?remove me 1 day
4210 // if ( ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_CONNECTED ) == 0 ) { //even values are disconnected etc.
4211 // ifbp->IFB_TickCnt = 0; //start 2 second period (with 1 tick uncertanty)
4221 // (void)setup_bap( ifbp, fid, 2, IO_IN ); //restore BAP for tallies, linkstat and specific type followed by wild card
4223 // get_frag( ifbp, (wci_bufp)&ridp->bufp[1], ridp->bufp[0]*2 BE_PAR(0) );
4231 // HCFTRACE( ifbp, HCF_TRACE_ISR_INFO | HCF_TRACE_EXIT );
4243 *.SUBMODULE void mdd_assert( IFBP ifbp, unsigned int line_number, hcf_32 q )
4247 * ifbp address of the Interface Block
4275 mdd_assert( IFBP ifbp, unsigned int line_number, hcf_32 q )
4277 hcf_16 run_time_flag = ifbp->IFB_AssertLvl;
4280 ifbp->IFB_AssertQualifier = q;
4281 ifbp->IFB_AssertLine = (hcf_16)line_number;
4283 if ( ifbp->IFB_AssertRtn ) {
4284 ifbp->IFB_AssertRtn( line_number, ifbp->IFB_AssertTrace, q );
4289 OPW( HREG_SW_2, ifbp->IFB_AssertTrace );
4295 ifbp->IFB_AssertLvl = 0; // prevent recursive behavior
4296 hcf_put_info( ifbp, (LTVP)&ifbp->IFB_AssertStrct );
4297 ifbp->IFB_AssertLvl = run_time_flag; // restore appropriate filter level
4306 *.SUBMODULE void put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) )
4310 * ifbp address of the Interface Block
4332 put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) )
4334 hcf_io io_port = ifbp->IFB_IOBase + HREG_DATA_1; //BAP data register
4361 if ( i && ifbp->IFB_CarryOut ) { //skip zero-length
4362 j = ((*bufp)<<8) + ( ifbp->IFB_CarryOut & 0xFF );
4365 ifbp->IFB_CarryOut = 0;
4370 if ( !(ifbp->IFB_CntlOpt & USE_16BIT) && i >= 6 ) {
4395 ifbp->IFB_CarryOut = (hcf_16)bufp[i-1] | 0x0100; //note that i and bufp are always simultaneously modified, &bufp[i-1] is invariant
4406 *.SUBMODULE void put_frag_finalize( IFBP ifbp )
4410 * ifbp address of the Interface Block
4434 put_frag_finalize( IFBP ifbp )
4437 if ( ifbp->IFB_MICTxCarry != 0xFFFF) { //if MIC calculation active
4440 put_frag( ifbp, (wci_bufp)ifbp->IFB_MICTx, 8 BE_PAR(0) );
4443 put_frag( ifbp, null_addr, 1 BE_PAR(0) ); //write (possibly) trailing data or MIC byte
4449 *.SUBMODULE int put_info( IFBP ifbp, LTVP ltvp )
4453 * ifbp address of the Interface Block
4484 put_info( IFBP ifbp, LTVP ltvp )
4489 HCFASSERT( ifbp->IFB_CardStat == 0, MERGE_2( ltvp->typ, ifbp->IFB_CardStat ) )
4492 if ( ifbp->IFB_CardStat == 0 && /* 20*/
4499 hcf_get_info( ifbp, (LTVP)&x );
4513 rc = setup_bap( ifbp, ltvp->typ, 0, IO_OUT );
4514 put_frag( ifbp, (wci_bufp)ltvp, 2*ltvp->len + 2 BE_PAR(2) );
4516 rc = cmd_exe( ifbp, HCMD_ACCESS + HCMD_ACCESS_WRITE, ltvp->typ );
4526 *.SUBMODULE int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp )
4530 * ifbp address of the Interface Block
4581 put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp )
4591 if ( ifbp->IFB_MBp == NULL ) return rc; //;?not sufficient
4592 HCFASSERT( ifbp->IFB_MBp != NULL, 0 ) //!!!be careful, don't get into an endless recursion
4593 HCFASSERT( ifbp->IFB_MBSize, 0 )
4599 if ( ifbp->IFB_MBRp > ifbp->IFB_MBWp ) {
4600 tlen = ifbp->IFB_MBRp - ifbp->IFB_MBWp; /* 2a*/
4602 if ( ifbp->IFB_MBRp == ifbp->IFB_MBWp ) {
4603 ifbp->IFB_MBRp = ifbp->IFB_MBWp = 0; // optimize Wrapping
4605 tlen = ifbp->IFB_MBSize - ifbp->IFB_MBWp; /* 2b*/
4606 if ( ( tlen <= len + 2 ) && ( len + 2 < ifbp->IFB_MBRp ) ) { //if trailing space is too small but
4608 ifbp->IFB_MBp[ifbp->IFB_MBWp] = 0xFFFF; //flag dummy LTV to fill the trailing space
4609 ifbp->IFB_MBWp = 0; //reset WritePointer to begin of MailBox
4610 tlen = ifbp->IFB_MBRp; //get new available space size
4613 dp = &ifbp->IFB_MBp[ifbp->IFB_MBWp];
4619 IF_TALLY( ifbp->IFB_HCF_Tallies.NoBufMB++; ) /*NOP to cover against analomies with empty compound*/;
4624 ifbp->IFB_MBWp += len + 1; //update WritePointer of MailBox
4630 ifbp->IFB_MBp[ifbp->IFB_MBWp] = 0; //to assure get_info for CFG_MB_INFO stops
4631 ifbp->IFB_MBInfoLen = ifbp->IFB_MBp[ifbp->IFB_MBRp]; /* 8 */
4641 setup_bap( IFBP ifbp, hcf_16 fid, int offset, int type )
4646 HCFTRACE( ifbp, HCF_TRACE_STRIO );
4647 rc = ifbp->IFB_DefunctStat;
4652 ifbp->IFB_CarryIn = 0;
4654 else ifbp->IFB_CarryOut = 0;
4659 rc = ifbp->IFB_DefunctStat = HCF_ERR_DEFUNCT_TIME_OUT;
4660 ifbp->IFB_CardStat |= CARD_STAT_DEFUNCT;
4663 HCFTRACE( ifbp, HCF_TRACE_STRIO | HCF_TRACE_EXIT );