Exemple #1
0
static __inline__ int __flashwritecommand(s32 chn, u32 flashaddress, u8 flashdata)
{
	s32 ret = 0;
	u32 val = 0xE0000000|(flashaddress<<9)|(flashdata<<1);

	if (flashaddress > 0x7FFFF)
		return 0;

	if(!EXI_Select(chn,EXI_DEVICE_0,EXI_SPEED16MHZ)) ret |= 0x01;
	if(!EXI_ImmEx(chn,&val,sizeof(u32),EXI_WRITE)) ret |= 0x02;
	if(!EXI_ImmEx(chn,&val,sizeof(u32),EXI_WRITE)) ret |= 0x04;
	if(!EXI_Deselect(chn)) ret |= 0x08;

	if(ret) return 0;
	return 1;
}
Exemple #2
0
static __inline__ int __flashreadcommand(s32 chn, u32 flashaddress, u8 *flashdata)
{
	s32 ret = 0;
	u32 val = 0xF0000000|(flashaddress<<9);

	if (flashaddress > 0x7FFFF)
		return 0;

	if(!EXI_Select(chn,EXI_DEVICE_0,EXI_SPEED16MHZ)) ret |= 0x01;
	if(!EXI_ImmEx(chn,&val,sizeof(u32),EXI_WRITE)) ret |= 0x02;
	if(!EXI_ImmEx(chn,&val,sizeof(u32),EXI_READ)) ret |= 0x04;
	if(!EXI_Deselect(chn)) ret |= 0x08;

	if(ret) return 0;
	*flashdata = val>>23;
	return 1;
}
Exemple #3
0
static u32 __SRAM_Write(void *buffer, u32 loc, u32 length)
{
	u32 command = 0xA0000100 + (loc << 6);

	EXI_Select(0, 1, 3);
	EXI_Imm(0, &command, 4, EXI_WRITE, 0);
	EXI_Sync(0);
	EXI_ImmEx(0, buffer, 64, EXI_WRITE);
	EXI_Sync(0);
	EXI_Deselect(0);		

	return 0;
}
Exemple #4
0
static u32 __SRAM_Read(void *buffer)
{
	u32 command = 0x20000100;

	EXI_Select(0, 1, 3); 
	EXI_Imm(0, &command, 4, EXI_WRITE, 0);
	EXI_Sync(0);
	EXI_ImmEx(0, buffer, 64, EXI_READ);
	EXI_Sync(0);
	EXI_Deselect(0);
	
	return 0;
}