drivers, wiznet5k: Change SPI interface to read/write multiple bytes.
This commit is contained in:
parent
812cf62f43
commit
79d17e3e7d
|
@ -96,13 +96,13 @@ void wizchip_bus_writebyte(uint32_t AddrSel, uint8_t wb) { *((volatile uint8_t
|
|||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
uint8_t wizchip_spi_readbyte(void) {return 0;};
|
||||
void wizchip_spi_readbytes(uint8_t *buf, uint32_t len) {}
|
||||
/**
|
||||
* @brief Default function to write in SPI interface.
|
||||
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
|
||||
* null function is called.
|
||||
*/
|
||||
void wizchip_spi_writebyte(uint8_t wb) {};
|
||||
void wizchip_spi_writebytes(const uint8_t *buf, uint32_t len) {}
|
||||
|
||||
/**
|
||||
* @\ref _WIZCHIP instance
|
||||
|
@ -168,19 +168,19 @@ void reg_wizchip_bus_cbfunc(uint8_t(*bus_rb)(uint32_t addr), void (*bus_wb)(uint
|
|||
}
|
||||
}
|
||||
|
||||
void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb))
|
||||
void reg_wizchip_spi_cbfunc((void (*spi_rb)(uint8_t *, uint32_t), void (*spi_wb)(const uint8_t *, uint32_t))
|
||||
{
|
||||
while(!(WIZCHIP.if_mode & _WIZCHIP_IO_MODE_SPI_));
|
||||
|
||||
if(!spi_rb || !spi_wb)
|
||||
{
|
||||
WIZCHIP.IF.SPI._read_byte = wizchip_spi_readbyte;
|
||||
WIZCHIP.IF.SPI._write_byte = wizchip_spi_writebyte;
|
||||
WIZCHIP.IF.SPI._read_bytes = wizchip_spi_readbytes;
|
||||
WIZCHIP.IF.SPI._write_bytes = wizchip_spi_writebytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
WIZCHIP.IF.SPI._read_byte = spi_rb;
|
||||
WIZCHIP.IF.SPI._write_byte = spi_wb;
|
||||
WIZCHIP.IF.SPI._read_bytes = spi_rb;
|
||||
WIZCHIP.IF.SPI._write_bytes = spi_wb;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
*/
|
||||
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_
|
||||
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_
|
||||
#include "W5200/w5200.h"
|
||||
#include "w5200/w5200.h"
|
||||
#elif (_WIZCHIP_ == 5500)
|
||||
#define _WIZCHIP_ID_ "W5500\0"
|
||||
|
||||
|
@ -111,7 +111,7 @@
|
|||
*/
|
||||
//#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_FDM_
|
||||
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_VDM_
|
||||
#include "W5500/w5500.h"
|
||||
#include "w5500/w5500.h"
|
||||
#else
|
||||
#error "Unknown defined _WIZCHIP_. You should define one of 5100, 5200, and 5500 !!!"
|
||||
#endif
|
||||
|
@ -186,8 +186,8 @@ typedef struct __WIZCHIP
|
|||
*/
|
||||
struct
|
||||
{
|
||||
uint8_t (*_read_byte) (void);
|
||||
void (*_write_byte) (uint8_t wb);
|
||||
void (*_read_bytes) (uint8_t *buf, uint32_t len);
|
||||
void (*_write_bytes) (const uint8_t *buf, uint32_t len);
|
||||
}SPI;
|
||||
// To be added
|
||||
//
|
||||
|
@ -393,7 +393,7 @@ void reg_wizchip_bus_cbfunc(uint8_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uin
|
|||
*or register your functions.
|
||||
*@note If you do not describe or register, null function is called.
|
||||
*/
|
||||
void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb));
|
||||
void reg_wizchip_spi_cbfunc(void (*spi_rb)(uint8_t *, uint32_t), void (*spi_wb)(const uint8_t *, uint32_t));
|
||||
|
||||
/**
|
||||
* @ingroup extra_functions
|
||||
|
|
Loading…
Reference in New Issue