Skip to content

Commit 79d17e3

Browse files
committed
drivers, wiznet5k: Change SPI interface to read/write multiple bytes.
1 parent 812cf62 commit 79d17e3

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

drivers/wiznet5k/ethernet/wizchip_conf.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ void wizchip_bus_writebyte(uint32_t AddrSel, uint8_t wb) { *((volatile uint8_t
9696
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
9797
* null function is called.
9898
*/
99-
uint8_t wizchip_spi_readbyte(void) {return 0;};
99+
void wizchip_spi_readbytes(uint8_t *buf, uint32_t len) {}
100100
/**
101101
* @brief Default function to write in SPI interface.
102102
* @note This function help not to access wrong address. If you do not describe this function or register any functions,
103103
* null function is called.
104104
*/
105-
void wizchip_spi_writebyte(uint8_t wb) {};
105+
void wizchip_spi_writebytes(const uint8_t *buf, uint32_t len) {}
106106

107107
/**
108108
* @\ref _WIZCHIP instance
@@ -168,19 +168,19 @@ void reg_wizchip_bus_cbfunc(uint8_t(*bus_rb)(uint32_t addr), void (*bus_wb)(uint
168168
}
169169
}
170170

171-
void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb))
171+
void reg_wizchip_spi_cbfunc((void (*spi_rb)(uint8_t *, uint32_t), void (*spi_wb)(const uint8_t *, uint32_t))
172172
{
173173
while(!(WIZCHIP.if_mode & _WIZCHIP_IO_MODE_SPI_));
174174

175175
if(!spi_rb || !spi_wb)
176176
{
177-
WIZCHIP.IF.SPI._read_byte = wizchip_spi_readbyte;
178-
WIZCHIP.IF.SPI._write_byte = wizchip_spi_writebyte;
177+
WIZCHIP.IF.SPI._read_bytes = wizchip_spi_readbytes;
178+
WIZCHIP.IF.SPI._write_bytes = wizchip_spi_writebytes;
179179
}
180180
else
181181
{
182-
WIZCHIP.IF.SPI._read_byte = spi_rb;
183-
WIZCHIP.IF.SPI._write_byte = spi_wb;
182+
WIZCHIP.IF.SPI._read_bytes = spi_rb;
183+
WIZCHIP.IF.SPI._write_bytes = spi_wb;
184184
}
185185
}
186186

drivers/wiznet5k/ethernet/wizchip_conf.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
*/
9393
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_
9494
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_
95-
#include "W5200/w5200.h"
95+
#include "w5200/w5200.h"
9696
#elif (_WIZCHIP_ == 5500)
9797
#define _WIZCHIP_ID_ "W5500\0"
9898

@@ -111,7 +111,7 @@
111111
*/
112112
//#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_FDM_
113113
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_VDM_
114-
#include "W5500/w5500.h"
114+
#include "w5500/w5500.h"
115115
#else
116116
#error "Unknown defined _WIZCHIP_. You should define one of 5100, 5200, and 5500 !!!"
117117
#endif
@@ -186,8 +186,8 @@ typedef struct __WIZCHIP
186186
*/
187187
struct
188188
{
189-
uint8_t (*_read_byte) (void);
190-
void (*_write_byte) (uint8_t wb);
189+
void (*_read_bytes) (uint8_t *buf, uint32_t len);
190+
void (*_write_bytes) (const uint8_t *buf, uint32_t len);
191191
}SPI;
192192
// To be added
193193
//
@@ -393,7 +393,7 @@ void reg_wizchip_bus_cbfunc(uint8_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uin
393393
*or register your functions.
394394
*@note If you do not describe or register, null function is called.
395395
*/
396-
void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb));
396+
void reg_wizchip_spi_cbfunc(void (*spi_rb)(uint8_t *, uint32_t), void (*spi_wb)(const uint8_t *, uint32_t));
397397

398398
/**
399399
* @ingroup extra_functions

0 commit comments

Comments
 (0)