Exemple #1
0
BOOL DK_LM3S9B96_BlockStorage_Driver::Memset(void* context, ByteAddress Address, UINT8 Data, UINT32 NumBytes)
{
    CHIP_WORD chipData;

    memset(&chipData, Data, sizeof(CHIP_WORD));
    
    return WriteX(context, Address, NumBytes, (BYTE*)&chipData, TRUE, FALSE);
}
Exemple #2
0
BOOL __section(SectionForFlashOperations) SAM7X_BS_Driver::Memset(void* context, ByteAddress Address, UINT8 Data, UINT32 NumBytes)
{
    CHIP_WORD chipData;

    memset(&chipData, Data, sizeof(CHIP_WORD));
    
    return WriteX(context, Address, NumBytes, (BYTE*)&chipData, TRUE, FALSE);
}
BOOL __section(SectionForFlashOperations) AM29DL_32_BS_Driver::Memset(void* context, ByteAddress address, UINT8 data, UINT32 numBytes)
{
    NATIVE_PROFILE_PAL_FLASH();

    CHIP_WORD chipData;

    memset(&chipData, data, sizeof(CHIP_WORD));

    return WriteX(context, address, numBytes, (BYTE*)&chipData, TRUE, FALSE);
}
BOOL  SH7216_INTERNAL_FLASH_Driver::Write(void* context, ByteAddress address, UINT32 numBytes,BYTE * pSectorBuff, BOOL ReadModifyWrite)
{
    BOOL result = TRUE;
    NATIVE_PROFILE_PAL_FLASH();
    FLASH_BEGIN_PROGRAMMING_FAST();
    result = WriteX(context, address, numBytes, pSectorBuff, ReadModifyWrite, TRUE);
    FLASH_END_PROGRAMMING_FAST( "SH7216 INTERNAL FLASH WriteWord", address );    

    return result;
}
BOOL  SH7216_INTERNAL_FLASH_Driver::Memset(void* context, ByteAddress address, UINT8 data, UINT32 numBytes)
{
   BOOL result = TRUE;
   NATIVE_PROFILE_PAL_FLASH();

    CHIP_WORD chipData;

    memset(&chipData, data, sizeof(CHIP_WORD));

    FLASH_BEGIN_PROGRAMMING_FAST();
    result = WriteX(context, address, numBytes, (BYTE*)&chipData, TRUE, FALSE);
    FLASH_END_PROGRAMMING_FAST( "SH7216 INTERNAL FLASH WriteWord", address );    
    
    return result;
}
BOOL __section("SectionForFlashOperations")I28F_16_BS_Driver::Memset(void* context, ByteAddress Address, UINT8 Data, UINT32 NumBytes)
{
    NATIVE_PROFILE_PAL_FLASH();

    CHIP_WORD chipData;

    memset(&chipData, Data, sizeof(CHIP_WORD));

    if(Data != 0)
    {
        // TODO: ERASE before memset - currently we only use this to set everything to zero for FS so no need to worry
        ASSERT(FALSE);
    }

    return WriteX(context, Address, NumBytes, (BYTE*)&chipData, TRUE, FALSE);
}
Exemple #7
0
int main(int argc, char **argv) 
{
   PBITMAP  tiff;

   if ( argc < 3 || (argc > 1 && argv[1][0]=='-') )
   {
      /* User tried to specify an option, so just print help text. */
      printf( "tiff2pix tiff_filename X_filename\n"                      \
          "   tiff_filename     TIFF file to read from.\n"               \
          "   X_filename        X windows bitmap file.\n" );
      return 1;
   }
   
   /* Check that the input file name doesn't match the output file name. */
   if (!strcmp(argv[1],argv[2]))
   {
      fprintf( stderr, "Filenames can not refer to the same file: \"%s\".\n", 
              argv[1] );
      return 1;            
   }

   tiff = ReadTiff( argv[1], 0 );
   if (!tiff)
   {
      fprintf( stderr, "Can't read %s\n", argv[1] );
      return 1;
   }
   tiff = OrientBitmap( tiff, BITMAP_TOPLEFT );

   if (tiff->nsamples!=1 && tiff->bitspersample!=1)
   {
      fprintf( stderr, "Requires data to be 1 bit per pixel.\n" );
      return 1;
   }     

   if (WriteX( tiff, argv[2] ))
   {
      fprintf( stderr, "Can't write %s\n", argv[2] );
      return 1;
   }

   DestroyBitmap( tiff );
   
   return 0;
}
int main(){
        void WriteX(unsigned,ofstream&);
	void WriteMX1(unsigned,ofstream&);
	void WriteR(unsigned,ofstream&);
	void WriteRO(ofstream&);
	void WriteP(unsigned,ofstream&);
	void WriteA(unsigned,ofstream&);
	void WriteL(unsigned,ofstream&);
	void WriteN(ofstream&);
	void WriteB(unsigned,ofstream&);
	unsigned dimension;
	string file;
	ofstream sfile;
	cout<<"This file is used to write the connections of the nodes in the .mx file"<<endl;
	cout<<"Give one of the dimensions of the MX1 matrix"<<endl;
	cin>>dimension;
	cout<<"Cool thanks"<<endl;
	cout<<"Please give a file name "<<endl;
	cin>>file;
	file = file + ".mx";
	sfile.open(file,ios::app);
	if(sfile.fail()){
		cerr<<"this file '"<<file<<"' does not exist in the form of .mx"<<endl;
		return false;
	}
	else{
		cout<<"file "<<file<<" is k"<<endl;
		cout<<"On to the processing!!!"<<endl;
		//sfile<<"END CONNECTIONS"<<endl;
		WriteX(dimension,sfile);
		WriteMX1(dimension,sfile);
		WriteR(dimension,sfile);
		WriteRO(sfile);
		WriteP(dimension,sfile);
		WriteA(dimension,sfile);
		WriteL(dimension,sfile);
		WriteN(sfile);
		WriteB(dimension,sfile);
		sfile<<"END CONNECTIONS"<<endl;
		sfile.close();
	}
	cout<<"File closed. TERMINATING....."<<endl;
	return 0;
}
BOOL __section(SectionForFlashOperations) AM29DL_32_BS_Driver::Write(void* context, ByteAddress address, UINT32 numBytes,BYTE * pSectorBuff, BOOL ReadModifyWrite)
{
    NATIVE_PROFILE_PAL_FLASH();
    return WriteX(context, address, numBytes, pSectorBuff, ReadModifyWrite, TRUE);
}
BOOL SF_BS_Driver::Memset(void *context, ByteAddress phyAddr, UINT8 Data, UINT32 NumBytes )
{
    NATIVE_PROFILE_PAL_FLASH();

    return WriteX( context, phyAddr, NumBytes, &Data, TRUE, FALSE );
}
BOOL SF_BS_Driver::Write(void *context, ByteAddress Address, UINT32 NumBytes, BYTE *pSectorBuff, BOOL ReadModifyWrite )
{
    NATIVE_PROFILE_PAL_FLASH();

    BYTE * pData;
    BYTE * pBuf = NULL;
    MEMORY_MAPPED_SERIAL_BLOCK_CONFIG* config = (MEMORY_MAPPED_SERIAL_BLOCK_CONFIG*)context;
    const BlockDeviceInfo * deviceInfo = config->BlockConfig.BlockDeviceInformation;
    
    UINT32 region, range;

    if(ReadModifyWrite) 
    {
        BOOL fRet = TRUE;
        
        if(!deviceInfo->FindRegionFromAddress(Address, region, range)) return FALSE;

        UINT32      bytesPerBlock   = deviceInfo->Regions[region].BytesPerBlock;
        UINT32      regionEnd       = deviceInfo->Regions[region].Start + deviceInfo->Regions[region].Size();
        UINT32      offset          = Address % bytesPerBlock;
        ByteAddress addr            = Address;
        ByteAddress addrEnd         = Address + NumBytes;
        UINT32      index           = 0;

        pBuf = (BYTE*)private_malloc(bytesPerBlock);

        if(pBuf == NULL)
        {
 
            return FALSE;
        }

        while(fRet && addr < addrEnd)
        {
            ByteAddress sectAddr = (addr - offset);
             
            if(offset == 0 && NumBytes >= bytesPerBlock)
            {
                pData = &pSectorBuff[index];
            }
            else
            {
                int bytes = __min(bytesPerBlock - offset, NumBytes); 
                
                //memcpy( &pBuf[0]     , (void*)sectAddr    , bytesPerBlock );
                Read(context, sectAddr, bytesPerBlock, (BYTE *)&pBuf[0]);
                memcpy( &pBuf[offset], &pSectorBuff[index], bytes         );

                pData = pBuf;
            }

            if(!EraseBlock( context, sectAddr ))
{
                fRet = FALSE;
                break;
            }

            fRet = WriteX(context, sectAddr, bytesPerBlock, pData, ReadModifyWrite, TRUE);

            NumBytes -= bytesPerBlock - offset;
            addr     += bytesPerBlock - offset;
            index    += bytesPerBlock - offset;
            offset    = 0;

            if(NumBytes > 0 && addr >= regionEnd)
            {
                region++;

                if(region >= deviceInfo->NumRegions)
                {
                    fRet = FALSE;
                }
                else
                {
                    regionEnd       = deviceInfo->Regions[region].Start + deviceInfo->Regions[region].Size();
                    bytesPerBlock   = deviceInfo->Regions[region].BytesPerBlock;

                    private_free(pBuf);

                    pBuf = (BYTE*)private_malloc(bytesPerBlock);

                    if(pBuf == NULL)
                    {
                        fRet = FALSE;
                    }
                }
            }
                
        }

        if(pBuf != NULL)
        {
            private_free(pBuf);
        }

        return fRet;            
    }
    else
    {
        return WriteX(context, Address, NumBytes, pSectorBuff, ReadModifyWrite, TRUE);
    }
}
Exemple #12
0
BOOL __section(SectionForFlashOperations) SAM7X_BS_Driver::Write( void* context, ByteAddress address, UINT32 numBytes, BYTE * pSectorBuff, BOOL ReadModifyWrite )
{
    return WriteX( context, address, numBytes, pSectorBuff, ReadModifyWrite, TRUE );
}
Exemple #13
0
BOOL DK_LM3S9B96_BlockStorage_Driver::Write(void* context, ByteAddress Address, UINT32 NumBytes, BYTE * pSectorBuff, BOOL ReadModifyWrite)
{
    return WriteX( context, Address, NumBytes, pSectorBuff, ReadModifyWrite, TRUE );
}
BOOL SD_BS_Driver::Write(void *context, ByteAddress phyAddr, UINT32 NumBytes, BYTE *pSectorBuff, BOOL ReadModifyWrite )
{
    NATIVE_PROFILE_PAL_FLASH();

    return WriteX( context, phyAddr, NumBytes, pSectorBuff, ReadModifyWrite, TRUE );
}