15 #error "Don't include this file directly, only via enc28j60.h" 18 #ifndef __ENC28J60_STRUCT_H 19 #define __ENC28J60_STRUCT_H 26 #define ENC28J60_ERROR_TOO_MANY_COLLISIONS -0x900 31 #define ENC28J60_ERROR_RX_TIMED_OUT -0x901 34 #define ENC28J60_HAS_ADVANCED_DRIVER 48 #define ENC28J60_TIMER_TICK_PER_SECOND 1000 53 #define ENC28J60_CALC_REMAINING_TICKS(GOAL, CUR) ((int16_t) (GOAL) - (int16_t) (CUR)) 77 uint16_t retry_count_reg;
105 #ifdef ENC28J60_HAS_ADVANCED_DRIVER 148 int enc28j60_spi_transfer(
int enc28j60_delay(enc28j60 *ins, enc28j60_tick ticks)
Wait until given number of ticks passes.
char * frame
Used internally when asynchronous request is called and error happens to retry the request if needed...
Definition: enc28j60-struct.example.h:66
uint16_t erxst
Saved ERXSTL:ERXSTH register value.
Definition: enc28j60-struct.example.h:89
uint16_t enc28j60_tick
TODO: Change it to uint32_t or uint8_t, depending on the timer resolution.
Definition: enc28j60-struct.example.h:42
uint8_t current_action
Indicates if current/previous operation is/was RX or TX.
Definition: enc28j60-struct.example.h:96
void(* enc28j60_spi_callback)(enc28j60 *instance, int custom_error_code)
Callback used internally and externally.
Definition: enc28j60.h:372
uint16_t cur_rx_frame
Pointer where the currently-processed received frame starts.
Definition: enc28j60-struct.example.h:80
int enc28j60_spi_advanced_transfer(enc28j60 *instance, const char *tx1, char *rx1, unsigned length1, const char *tx2, char *rx2, unsigned length2, enc28j60_spi_callback on_finish)
This function performs (using DMA or blocking I/O) parallely transmision from 'tx1' buffer and recept...
enc28j60_spi_callback callback
Callback to be called when transfer finishes.
Definition: enc28j60-struct.example.h:62
uint16_t retry_count
How many retries were there before this call to spi_transfer.
Definition: enc28j60-struct.example.h:76
uint8_t bank
Low/Least significant 2 bits contain which bank is currently used (0-3).
Definition: enc28j60-struct.example.h:94
uint16_t current_pointer
Pointer to where currently transmitted ethernet frame starts (pointing to the zero control frame) ...
Definition: enc28j60-struct.example.h:86
uint16_t erxnd
Saved ERXNDL:ERXNDH register value.
Definition: enc28j60-struct.example.h:91
bool enc28j60_spi_error_handler(enc28j60 *instance, int error_code, uint16_t retry)
This function is called before callback when non-zero error code is received from enc28j60_spi_transf...
int enc28j60_getticks(enc28j60 *ins, enc28j60_tick *ticks)
Get current number of ticks.
uint16_t next_rx_frame
Pointer where the next received frame starts.
Definition: enc28j60-struct.example.h:82
int enc28j60_spi_transfer_join(enc28j60 *instance)
This function should wait until SPI operation in progress (if any) finishes and then return...
unsigned length
Used internally when asynchronous request is called and error happens to retry the request if needed...
Definition: enc28j60-struct.example.h:71
uint16_t rxstatus
Status read from buffer.
Definition: enc28j60-struct.example.h:74
Structure holding important informations about enc28j60 and about the latest transmission performed...
Definition: enc28j60-struct.example.h:60