Пример #1
0
E_NANDERRORCODE Nand_ReadSector_Exnftl(T_PNANDFLASH pNand, T_U32 nChip, T_U32 nPlaneCnt, T_U32 nBlock, T_U32 nPage, T_U8 *pMain, T_U8 *pAdd , T_U32 nAddLen, T_U32 nPageCnt)
{
    E_NANDERRORCODE ret;
    T_U32 i;

    for(i = 0; i < nPageCnt; i++)
    {
        ret = Read_Page(nChip, nBlock, nPage, pMain, pAdd, nAddLen, AREA_FSA);

        if(NF_FAIL == ret)
        {
           goto L_EXIT;
        }

        nPage++;
        pMain += g_nPageSize;
        pAdd += nAddLen;
    }
    
L_EXIT:
    return  ret;
}
Пример #2
0
E_NANDERRORCODE Nand_ReadSector(T_PNANDFLASH pNand, T_U32 nChip, T_U32 nBlock, T_U32 nPage, T_U8 *pMain, T_U8 *pAdd , T_U32 nAddLen)
{
    return Read_Page(nChip, nBlock, nPage, pMain, pAdd, nAddLen, ASA_ADD_LEN ==  nAddLen ? AREA_ASA : AREA_FSA);
}
Пример #3
0
//----------------------------------------------------------------------
//  ExtRead, reads extended file structure files.  It is designed such
//  that if a file is contiguous then it is not reset between the reading
//  of each page packet.  The bitmap BM has a page bit cleared when a
//  page is read correctly.  The varialbe maxlen is the max number of
//  bytes that can be fit into the buffer 'buf'.  If maxlen is set to
//  -1 then the file is read but it is not copied over into buf.
//
// portnum    the port number of the port being used for the
//            1-Wire Network.
// SNum       the serial number for the part that the read is
//            to be done on.
// file       location of the file to write
// start_page the starting page for the file
// maxlen     the maximum length the file buffer can handle
// del        tell weather to delete the file or not.
// BM         the bitmap
// fl_len     the length of the file that was read
//
// return TRUE if the read was successful
//
SMALLINT ExtRead(int portnum, uchar *SNum, uchar *file, int start_page,
						 int maxlen, uchar del, uchar *BM, int *fl_len)

{
	SMALLINT  bank;
	int       done = FALSE;
	int       buff_len = 0;
	PAGE_TYPE pg;
	uchar     pgbuf[34];
	int       len = 0;
	int       i;
	int       flag;

	pg = start_page;
	
   // loop to read in pages of the extended file
   do
   {	
      if(!Read_Page(portnum,SNum,&pgbuf[0],REGMEM,&pg,&len))
      	return FALSE;
      	      
      // add page segment to buffer
      if (maxlen != -1)   // don't add to buff in maxlen is -1
      {
      	if((buff_len+len) > maxlen)
      	{
      		OWERROR(OWERROR_BUFFER_TOO_SMALL);
      		return FALSE;
      	}
      	
      	for(i=0;i<(len-1);i++)
      		file[buff_len++] = pgbuf[i];
      }
                                
      bank = getBank(portnum,SNum,pg,REGMEM);
      
      // flag to indicate that the page should be cleared in the BM
      flag = FALSE;
      // do if have a NVRAM device 
      if(owIsReadWrite(bank,portnum,SNum) && 
         owIsGeneralPurposeMemory(bank,SNum)) 
          flag = TRUE;
         
      // or non written buffered eprom page 
      if(isJob(portnum,SNum))
      {
         // see if page set to write but has not started yet
         if(isJobWritten(portnum,SNum,pg) && del)
         {
            flag = TRUE;
         }
      }
                              
      // clear bit in bitmap     
      if(flag)
      {
         if(!BitMapChange(portnum,SNum,pg,0,BM))
            return FALSE;
      }
                                                                             
      // check on continuation pointer
      if (pgbuf[len-1] == 0)
      {
      	*fl_len = buff_len;
         done = TRUE; // all done
      }
      else
         pg = pgbuf[len-1];
   } 
   while(!done);
   
   return TRUE;
}