Пример #1
0
signed char ioman_directSectorRead(IOManager *ioman,unsigned long address, unsigned char* buf)
{
	unsigned char* ibuf;
	signed short bp;
	
	if((bp=ioman_findSectorInCache(ioman,address))!=-1){
		ibuf=ioman_getPtr(ioman,bp);
		memCpy(ibuf,buf,512);
		return(0);
	}
	
	if((bp=ioman_findFreeSpot(ioman))!=-1){
		if((ioman_putSectorInCache(ioman,address,bp))){
			return(-1);
		}
		ibuf=ioman_getPtr(ioman,bp);
		memCpy(ibuf,buf,512);
		return(0);
	}

	if(ioman_readSector(ioman,address,buf)){
		return(-1);
	}

	return(0);
}
Пример #2
0
esint8 ioman_directSectorRead(IOManager *ioman,euint32 address, euint8* buf)
{
	euint8* ibuf;
	esint16 bp;
	
	if((bp=ioman_findSectorInCache(ioman,address))!=-1){
		ibuf=ioman_getPtr(ioman,bp);
		memCpy(ibuf,buf,512);
		return(0);
	}
	
	if((bp=ioman_findFreeSpot(ioman))!=-1){
		if((ioman_putSectorInCache(ioman,address,bp))){
			return(-1);
		}
		ibuf=ioman_getPtr(ioman,bp);
		memCpy(ibuf,buf,512);
		return(0);
	}

	if(ioman_readSector(ioman,address,buf)){
		return(-1);
	}

	return(0);
}
Пример #3
0
esint8 ioman_putSectorInCache(IOManager *ioman, euint32 address, euint16 bufplace)
{
	euint8* buf;
	
	if((buf = ioman_getPtr(ioman,bufplace))==0)return(-1);
	if((ioman_readSector(ioman,address,buf)))return(-1);
	ioman_setValid(bufplace);
	ioman->sector[bufplace]=address;
	return(0);
}
Пример #4
0
signed char ioman_putSectorInCache(IOManager *ioman, unsigned long address, unsigned short bufplace)
{
	unsigned char* buf;
	
	if((buf = ioman_getPtr(ioman,bufplace))==0){
		ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE);
		return(-1);
	}
	if((ioman_readSector(ioman,address,buf))){
		ioman_setError(ioman,IOMAN_ERR_READFAIL);
		return(-1);
	}
	ioman_setValid(bufplace);
	ioman->sector[bufplace]=address;
	return(0);
}
Пример #5
0
esint8 ioman_putSectorInCache(IOManager *ioman, euint32 address, euint16 bufplace)
{
	euint8* buf;
	
	if((buf = ioman_getPtr(ioman,bufplace))==0){
		ioman_setError(ioman,IOMAN_ERR_CACHEPTROUTOFRANGE);
		return(-1);
	}
	if((ioman_readSector(ioman,address,buf))){
		ioman_setError(ioman,IOMAN_ERR_READFAIL);
		return(-1);
	}
	ioman_setValid(bufplace);
	ioman->sector[bufplace]=address;
	return(0);
}