void sspInit(void)
{
PCONP |= (1<<10);
PINSEL0 |= (2<<(7*2)) | (2<<(8*2)) | (2<<(9*2)) | (2<<(6*2));
SSP1CR1 = 0x0 ;
SSP1CR0 = (8-1);
SSP1CPSR = 8;
SSP1IMSC = 0;
SSP1DMACR = 0;
SSP1CR1 = (1<<1);
}
int flashGetJEDEC(void)
{
char flash_jedec_manufactured;
char flash_jedec_memtype;
char flash_jedec_capacity;
FIO0CLR = (1<<5);
SSP1DR = 0x9F;
SSP1DR = 0xFF;
SSP1DR = 0xFF;
SSP1DR = 0xFF;
while ( (SSP1SR & (1<<4)) );
int dummy = SSP1DR;
flash_jedec_manufactured = SSP1DR;
flash_jedec_memtype = SSP1DR;
flash_jedec_capacity = SSP1DR;
FIO0SET = (1<<5);
return (flash_jedec_manufactured<<16) | (flash_jedec_memtype<<8) | flash_jedec_capacity;
}