kernel/sdcard.c
static int read_OCR(void) {
	uint64 result;
	uint8 ocr[4];

	int timeout;

	timeout = 0xff;
	while (--timeout) {
		sd_send_cmd(SD_CMD58, 0, 0);
		result = sd_get_response_R1();
		sd_get_response_R3_rest(ocr);
		sd_end_cmd();

		if (
			0x01 == result && // R1 response in idle status 
			(ocr[1] & 0x1f) && (ocr[2] & 0x80) 	// voltage range valid 
		) {
			return 0;
		}
	}

	// timeout!
	printf("read_OCR() timeout!\n");
	printf("result = %d\n", result);
	return 0xff;
}
// read OCR register to check if the voltage range is valid 
// this step is not mandotary, but I advise to use it 
read OCR register to check if the voltage range is valid
this step is not mandotary, but I advise to use it
read OCR register to check if the voltage range is valid this step is not mandotary but I advise to use it
static int read_OCR(void) {
	uint64 result;
	uint8 ocr[4];
	int timeout;
	timeout = 0xff;
	while (--timeout) {
		sd_send_cmd(SD_CMD58, 0, 0);
		result = sd_get_response_R1();
		sd_get_response_R3_rest(ocr);
		sd_end_cmd();
		if (
			0x01 == result && 
			(ocr[1] & 0x1f) && (ocr[2] & 0x80) 	
		) {
			return 0;
		}
	}
	printf("read_OCR() timeout!\n");
	printf("result = %d\n", result);
	return 0xff;
}
static int read_OCR ( void ) { uint64 result ; uint8 ocr [ 4 ] ; int timeout ; timeout = 0xff ; while ( -- timeout ) { sd_send_cmd ( SD_CMD58 , 0 , 0 ) ; result = sd_get_response_R1 ( ) ; sd_get_response_R3_rest ( ocr ) ; sd_end_cmd ( ) ; if ( 0x01 == result && ( ocr [ 1 ] & 0x1f ) && ( ocr [ 2 ] & 0x80 ) ) { return 0 ; } } printf ( " \n " ) ; printf ( " \n " , result ) ; return 0xff ; }
read OCR register to check if the voltage range is valid
this step is not mandotary, but I advise to use it
read OCR register to check if the voltage range is valid this step is not mandotary but I advise to use it
// R1 response in idle status  // voltage range valid  // timeout!