fatfs/mmcbb.c
static
int rcvr_datablock (	/* 1:OK, 0:Failed */
	BYTE *buff,			/* Data buffer to store received data */
	UINT btr			/* Byte count */
)
{
	BYTE d[2];
	UINT tmr;

	for (tmr = 1000; tmr; tmr--) {	/* Wait for data packet in timeout of 100ms */
		rcvr_mmc(d, 1);
		if (d[0] != 0xFF) break;
		DLY_US(100);
	}

	if (d[0] != 0xFE) return 0;		/* If not valid data token, return with error */

	rcvr_mmc(buff, btr);			/* Receive the data block into buffer */
	rcvr_mmc(d, 2);					/* Discard CRC */

	return 1;						/* Return with success */
}
/*-----------------------------------------------------------------------*/
/* Receive a data packet from the card                                   */
/*-----------------------------------------------------------------------*/
Receive a data packet from the card
Receive a data packet from the card
static
int rcvr_datablock (	
	BYTE *buff,			
	UINT btr			
)
{
	BYTE d[2];
	UINT tmr;
	for (tmr = 1000; tmr; tmr--) {	
		rcvr_mmc(d, 1);
		if (d[0] != 0xFF) break;
		DLY_US(100);
	}
	if (d[0] != 0xFE) return 0;		
	rcvr_mmc(buff, btr);			
	rcvr_mmc(d, 2);					
	return 1;						
}
static int rcvr_datablock ( BYTE * buff , UINT btr ) { BYTE d [ 2 ] ; UINT tmr ; for ( tmr = 1000 ; tmr ; tmr -- ) { rcvr_mmc ( d , 1 ) ; if ( d [ 0 ] != 0xFF ) break ; DLY_US ( 100 ) ; } if ( d [ 0 ] != 0xFE ) return 0 ; rcvr_mmc ( buff , btr ) ; rcvr_mmc ( d , 2 ) ; return 1 ; }
Receive a data packet from the card
Receive a data packet from the card
/* 1:OK, 0:Failed */ /* Data buffer to store received data */ /* Byte count */ /* Wait for data packet in timeout of 100ms */ /* If not valid data token, return with error */ /* Receive the data block into buffer */ /* Discard CRC */ /* Return with success */