if (scvalq(k)) 
if (FPT_scvalq(k)) 
void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up){#if defined(SCAM_LEV_2)   UCHAR loser,assigned_id;#endif#if defined(DOS)   USHORT p_port;#else   ULONG p_port;#endif   UCHAR i,k,ScamFlg ;   PSCCBcard currCard;	PNVRamInfo pCurrNvRam;   currCard = &BL_Card[p_card];   p_port = currCard->ioPort;	pCurrNvRam = currCard->pNvRamInfo;	if(pCurrNvRam){		ScamFlg = pCurrNvRam->niScamConf;		i = pCurrNvRam->niSysConf;	}	else{	   ScamFlg = (UCHAR) utilEERead(p_port, SCAM_CONFIG/2);	   i = (UCHAR)(utilEERead(p_port, (SYSTEM_CONFIG/2)));	}	if(!(i & 0x02))	/* check if reset bus in AutoSCSI parameter set */		return;   inisci(p_card,p_port, p_our_id);   /* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW      too slow to return to SCAM selection */   /* if (p_power_up)         Wait1Second(p_port);      else         Wait(p_port, TO_250ms); */   Wait1Second(p_port);#if defined(SCAM_LEV_2)   if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2))      {      while (!(scarb(p_port,INIT_SELTD))) {}      scsel(p_port);      do {         scxferc(p_port,SYNC_PTRN);         scxferc(p_port,DOM_MSTR);         loser = scsendi(p_port,&scamInfo[p_our_id].id_string[0]);         } while ( loser == 0xFF );      scbusf(p_port);      if ((p_power_up) && (!loser))         {         sresb(p_port,p_card);         Wait(p_port, TO_250ms);         while (!(scarb(p_port,INIT_SELTD))) {}         scsel(p_port);         do {            scxferc(p_port, SYNC_PTRN);            scxferc(p_port, DOM_MSTR);            loser = scsendi(p_port,&scamInfo[p_our_id].               id_string[0]);            } while ( loser == 0xFF );         scbusf(p_port);         }      }   else      {      loser = FALSE;      }   if (!loser)      {#endif  /* SCAM_LEV_2 */      scamInfo[p_our_id].state = ID_ASSIGNED;		if (ScamFlg & SCAM_ENABLED)		{	      for (i=0; i < MAX_SCSI_TAR; i++)  		   {      	   if ((scamInfo[i].state == ID_UNASSIGNED) ||  	      	   (scamInfo[i].state == ID_UNUSED))	  	      {   	     	   if (scsell(p_port,i))      	  	   {            	   scamInfo[i].state = LEGACY;  	            	if ((scamInfo[i].id_string[0] != 0xFF) ||     	            	(scamInfo[i].id_string[1] != 0xFA))	     	         {   	        	      scamInfo[i].id_string[0] = 0xFF;      	        	   scamInfo[i].id_string[1] = 0xFA;							if(pCurrNvRam == NULL)	         	         currCard->globalFlags |= F_UPDATE_EEPROM;               	}	  	         }   	  	   }      	}	      sresb(p_port,p_card);      	Wait1Second(p_port);         while (!(scarb(p_port,INIT_SELTD))) {}         scsel(p_port);         scasid(p_card, p_port);         }#if defined(SCAM_LEV_2)      }   else if ((loser) && (ScamFlg & SCAM_ENABLED))      {      scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0;      assigned_id = FALSE;      scwtsel(p_port);      do {         while (scxferc(p_port,0x00) != SYNC_PTRN) {}         i = scxferc(p_port,0x00);         if (i == ASSIGN_ID)            {            if (!(scsendi(p_port,&scamInfo[p_our_id].id_string[0])))                  {                  i = scxferc(p_port,0x00);                  if (scvalq(i))                     {                     k = scxferc(p_port,0x00);                     if (scvalq(k))                        {                        currCard->ourId =                           ((UCHAR)(i<<3)+(k & (UCHAR)7)) & (UCHAR) 0x3F;                        inisci(p_card, p_port, p_our_id);                        scamInfo[currCard->ourId].state = ID_ASSIGNED;                        scamInfo[currCard->ourId].id_string[0]                           = SLV_TYPE_CODE0;                        assigned_id = TRUE;                        }                     }                  }            }         else if (i == SET_P_FLAG)            {               if (!(scsendi(p_port,                        &scamInfo[p_our_id].id_string[0])))                        scamInfo[p_our_id].id_string[0] |= 0x80;            }         }while (!assigned_id);      while (scxferc(p_port,0x00) != CFG_CMPLT) {}      }#endif   /* SCAM_LEV_2 */   if (ScamFlg & SCAM_ENABLED)      {      scbusf(p_port);      if (currCard->globalFlags & F_UPDATE_EEPROM)         {         scsavdi(p_card, p_port);         currCard->globalFlags &= ~F_UPDATE_EEPROM;         }      }#if defined(DOS)   for (i=0; i < MAX_SCSI_TAR; i++)   {     	if (((ScamFlg & SCAM_ENABLED) && (scamInfo[i].state == LEGACY))			|| (i != p_our_id))        	{         scsellDOS(p_port,i);  	      }  	}#endif/*   for (i=0,k=0; i < MAX_SCSI_TAR; i++)      {      if ((scamInfo[i].state == ID_ASSIGNED) ||         (scamInfo[i].state == LEGACY))         k++;      }   if (k==2)      currCard->globalFlags |= F_SINGLE_DEVICE;   else      currCard->globalFlags &= ~F_SINGLE_DEVICE;*/}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/47b5d69c4aa753fcfc9b2b8d28c0660a1e25c129/FlashPoint.c/buggy/drivers/scsi/FlashPoint.c