Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

static void mxc_nand_read_buf ( struct mtd_info *  mtd,
u_char *  buf,
int  len 
) [static]

This function id is used to read the data buffer from the NAND Flash. To read the data from NAND Flash first the data output cycle is initiated by the NFC, which copies the data to RAMbuffer. This data of length len is then copied to buffer buf.

Parameters:
mtd MTD structure for the NAND Flash
buf data to be read from NAND Flash
len number of bytes to be read

Definition at line 618 of file mxc_nd2.c.

{
      u16 col = g_nandfc_info.colAddr;

      if (mtd->writesize) {

            int j = mtd->writesize - col;
            int n = mtd->oobsize + j;

            n = min(n, len);

            if (j > 0) {
                  if (n > j) {
                        memcpy(buf, &data_buf[col], j);
                        memcpy(buf + j, &oob_buf[0], n - j);
                  } else {
                        memcpy(buf, &data_buf[col], n);
                  }
            } else {
                  col -= mtd->writesize;
                  memcpy(buf, &oob_buf[col], len);
            }

            /* update */
            g_nandfc_info.colAddr += n;

      } else {
            /* At flash identify phase,
             * mtd->writesize has not been
             * set correctly, it should
             * be zero.And len will less 2
             */
            memcpy(buf, &data_buf[col], len);

            /* update */
            g_nandfc_info.colAddr += len;
      }

}


Generated by  Doxygen 1.6.0   Back to index