/*----------------------------------------------------------------------------*/ /* Company : ADLINK */ /* Date : 2008/03/04 */ /* */ /* This sample performs SPI operation of 7350. */ /* It tests SPI EEPROM read/write operations. */ /* In 7350, AFI0, AFI1, AFI2, and AFI3/4/5(Slave0/1/2) are used for SPI while */ /* performing SPI operation, so AFI0, AFI1, AFI2, and AFI3/4/5(Slave0/1/2) */ /* will be set to SPI mode automatically if SPI is enabled. */ /* */ /* Note: */ /* Procedures of SPI are depanding on your SPI device, */ /* and the sample is developed for ATMEL AT25128A. */ /*----------------------------------------------------------------------------*/ #include #include #include #include #include #include "dask.h" #define SPI_WRTCNT 256 int main(int argc, char **argv) { I16 card, err; U16 card_num; U16 SPI_WriteCmdAddrBits = 24; U16 SPI_WriteDataBits = 8; U32 SPI_WriteCmdAddr = 0x20000; U32 SPI_WriteData[SPI_WRTCNT]; U16 SPI_ReadCmdAddrBits = 24; U16 SPI_ReadDataBits = 8; U32 SPI_ReadCmdAddr = 0x30000; U32 SPI_ReadData = 0; U32 vi = 0; printf("This sample tests SPI Read/Write Operations.\n"); printf("SPI Procedures are depending on the SPI Device.\n"); printf("It is developed for ATMEL AT25128A.\n"); printf("It will write a byte-data to and then read from 0 ~ %d Cmd/Addr.\n", SPI_WRTCNT-1); printf("Card Number? "); scanf(" %hd", &card_num); /*Open and initialize device*/ card = Register_Card( PCI_7350, /*Card type*/ card_num /*Card number*/ ); if(card<0){ printf("Register_Card Error: %d\n", card); exit(1); } /*randon write data*/ srand(time(NULL)); for(vi=0; vi