#if defined(DOS) USHORT reg_offset; #else 
void busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB)#endif{   ULONG count,addr,tmpSGCnt;   UINT sg_index;   UCHAR sg_count, i;#if defined(DOS)   USHORT reg_offset;#else   ULONG reg_offset;#endif   if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {      count =  ((ULONG) HOST_RD_CMD)<<24;      }   else {      count =  ((ULONG) HOST_WRT_CMD)<<24;      }   sg_count = 0;   tmpSGCnt = 0;   sg_index = pcurrSCCB->Sccb_sgseg;   reg_offset = hp_aramBase;	i = (UCHAR) (RD_HARPOON(p_port+hp_page_ctrl) & ~(SGRAM_ARAM|SCATTER_EN));	WR_HARPOON(p_port+hp_page_ctrl, i);   while ((sg_count < (UCHAR)SG_BUF_CNT) &&      ((ULONG)(sg_index * (UINT)SG_ELEMENT_SIZE) < pcurrSCCB->DataLength) ) {#if defined(COMPILER_16_BIT) && !defined(DOS)      tmpSGCnt += *(((ULONG far *)pcurrSCCB->DataPointer)+         (sg_index * 2));      count |= *(((ULONG far *)pcurrSCCB->DataPointer)+         (sg_index * 2));      addr = *(((ULONG far *)pcurrSCCB->DataPointer)+         ((sg_index * 2) + 1));#else      tmpSGCnt += *(((ULONG *)pcurrSCCB->DataPointer)+         (sg_index * 2));      count |= *(((ULONG *)pcurrSCCB->DataPointer)+         (sg_index * 2));      addr = *(((ULONG *)pcurrSCCB->DataPointer)+         ((sg_index * 2) + 1));#endif      if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) {         addr += ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset);         count = (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset;         tmpSGCnt = count & 0x00FFFFFFL;         }      WR_HARP32(p_port,reg_offset,addr);      reg_offset +=4;      WR_HARP32(p_port,reg_offset,count);      reg_offset +=4;      count &= 0xFF000000L;      sg_index++;      sg_count++;      } /*End While */   pcurrSCCB->Sccb_XferCnt = tmpSGCnt;   WR_HARPOON(p_port+hp_sg_addr,(sg_count<<4));   if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {      WR_HARP32(p_port,hp_xfercnt_0,tmpSGCnt);      WR_HARPOON(p_port+hp_portctrl_0,(DMA_PORT | SCSI_PORT | SCSI_INBIT));      WR_HARPOON(p_port+hp_scsisig, S_DATAI_PH);      }   else {      if ((!(RD_HARPOON(p_port+hp_synctarg_0) & NARROW_SCSI)) &&         (tmpSGCnt & 0x000000001))         {         pcurrSCCB->Sccb_XferState |= F_ODD_BALL_CNT;         tmpSGCnt--;         }      WR_HARP32(p_port,hp_xfercnt_0,tmpSGCnt);      WR_HARPOON(p_port+hp_portctrl_0,(SCSI_PORT | DMA_PORT | DMA_RD));      WR_HARPOON(p_port+hp_scsisig, S_DATAO_PH);      }   WR_HARPOON(p_port+hp_page_ctrl, (UCHAR) (i | SCATTER_EN));}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/47b5d69c4aa753fcfc9b2b8d28c0660a1e25c129/FlashPoint.c/buggy/drivers/scsi/FlashPoint.c