2 #include <linux/types.h>
5 extern int spi_channel_read (unsigned long dev_id,unsigned char *buffer_ptr,int len);
6 extern int spi_channel_write (unsigned long dev_id,unsigned char *buffer_ptr,int len);
7 extern void spi_channel_open (unsigned long phy_id,unsigned long mode,unsigned long tx_bit_length);
8 extern void dump_spi_registers(unsigned long phy_id);
9 extern int spi_channel_status(void);
11 void SPI_channel_open(void)
13 spi_channel_open(0,1,32);
14 dump_spi_registers(0);
17 /******************************************************************************
18 ** Description: This function is used to read data from MODEM by SPI BUS.
19 ** Author: jiayong.yang
20 ** parameter: buffer is used to save data from MODEM
21 ** len is length of data to be read.
22 ******************************************************************************/
23 int SPI_channel_read(unsigned char *buffer,int len)
27 do{status = req_clk_status();}while(status==0);
28 ret = spi_channel_read (SPI_PORT,buffer,len);
29 do{status = req_clk_status();}while(status);
32 /******************************************************************************
33 ** Description: This function is used to send data to MODEM by SPI BUS.
34 ** Author: jiayong.yang
35 ** parameter: buffer is used to save data from MODEM
36 ** len is length of data to be read.
37 ******************************************************************************/
38 int SPI_channel_write(unsigned char *buffer,int len)
42 do{status = req_clk_status();}while(status==0);
43 ret = spi_channel_write (SPI_PORT,buffer,len);
44 do{status = req_clk_status();}while(status);
47 void SPI_channel_close(void)