Click here to Skip to main content
15,891,372 members
Articles / Programming Languages / CUDA

Xilinx FPGA with AVRILOS

Rate me:
Please Sign up or sign in to vote.
4.87/5 (12 votes)
9 Nov 2011CDDL21 min read 50K   689   14  
How-To Embed Xilinx FPGA Configuration Data to AVRILOS
/***************************************************************************
 Project:		AVRILOS
 Title:			SST 49F020A Flash memory
 Author:		Ilias Alexopoulos
 Version:		2.00
 Last updated:	28-Oct-2010
 Target:		NA
 File:			sst.c

* Support E-mail:
* avrilos@ilialex.gr
* 
* license: See license.txt on root directory (CDDL)
*

* DESCRIPTION
* Flash SST 49F020A access routines using LPC bus 
* 
***************************************************************************/

#include "../includes/types.h"
#include "../includes/settings.h"

#include "../periphext/lpc.h"
#include "sst.h"

void f_SSTWrite(INT32U addr, INT8U data)
{
	f_LPC_Write(0x00005555,0xAA);
	f_LPC_Write(0x00002AAA,0x55);
	f_LPC_Write(0x00005555,0xA0);
	f_LPC_Write(addr,data);
}

INT16U f_SSTID(void)
{
	INT16U id;
	
	/* Enter ID Mode */
	f_LPC_Write(0x00005555,0xAA);
	f_LPC_Write(0x00002AAA,0x55);
	f_LPC_Write(0x00005555,0x90);
	/* Get ID */
	id = f_LPC_Read(0x00000001);
	id = (id << 8) | f_LPC_Read(0x00000000);
	/* Exit ID Mode */
	f_LPC_Write(0x00005555,0xF0);
	return id;
}

/* 49F020 has 16 blocks (16KB each block -> 4 sectors 4KB each Sector) */
void f_SSTErase(INT16U base_addr, INT8U type)
{
	INT32U addr = base_addr;
	
	f_LPC_Write(0x00005555,0xAA);
	f_LPC_Write(0x00002AAA,0x55);
	f_LPC_Write(0x00005555,0x80);
	
	f_LPC_Write(0x00005555,0xAA);
	f_LPC_Write(0x00002AAA,0x55);
	
	if (type == c_SSTBLKERASE)			f_LPC_Write(addr, 0x50);
	else if (type == c_SSTSECERASE)		f_LPC_Write(addr, 0x30);
	else if (type == c_SSTCHIPERASE)	f_LPC_Write(addr, 0x10);
}



By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


Written By
Systems Engineer AI ZeroCaliber Ltd
Cyprus Cyprus
More than 15 year of Embedded Systems development designing both hardware & software.
Experience with Product Development,lab prototypes and Automated Testers, Sensors, motors and System Engineering. Have used numerous micro-controllers/processors, DSP & FPGAs.

Please check AI ZeroCaliber if you need any help.
You may find also my personal site: Ilialex and my blog site: Ilialex Blog

Comments and Discussions