drivers/storage/spi_sdcard.c
/*
 * sd_spi_read - helper function to read SPI datad
 *
 * @buffer - the place where we store SPI input data. It should be
 *           big enough to fit expected_len bytes.
 * @expected_len - the size of the expected read
 *
 */
helper function to read SPI datad
@buffer - the place where we store SPI input data. It should be
big enough to fit expected_len bytes.
@expected_len - the size of the expected read
helper function to read SPI datad @buffer - the place where we store SPI input data . It should be big enough to fit expected_len bytes . @expected_len - the size of the expected read
static void sd_spi_read(uint8_t *buffer, size_t expected_len)
{
  int n = 9;
  int i = 0;
  uint8_t resp = 0xFF;
  do {
    resp = sd_spi_write(0xFF);
    if (resp != 0xFF && i < expected_len) {
      buffer[i++] = resp;
      n = 9;
    }
  } while (--n > 0 && i < expected_len);
}
static void sd_spi_read ( uint8_t * buffer , size_t expected_len ) { int n = 9 ; int i = 0 ; uint8_t resp = 0xFF ; do { resp = sd_spi_write ( 0xFF ) ; if ( resp != 0xFF && i < expected_len ) { buffer [ i ++ ] = resp ; n = 9 ; } } while ( -- n > 0 && i < expected_len ) ; }
sd_spi_read - helper function to read SPI datad
 @buffer - the place where we store SPI input data.
sd_spi_read - helper function to read SPI datad @buffer - the place where we store SPI input data .