Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Spi_Ethernet_doPacket
386
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Requires
Ethernet module has to be initialized. See Spi_Ethernet_Init.
Example
Spi_Ethernet_Disable(Spi_Ethernet_CRC or Spi_Ethernet_UNICAST);
// disable CRC checking and Unicast traffic
Prototype
function Spi_Ethernet_doPacket(): byte;
Returns
0
- upon successful packet processing (zero packets received or received 
packet processed successfully). 
1
- upon reception error or receive buffer corruption. 
ENC28J60
controller 
needs to be restarted. 
2
- received packet was not sent to us (not our IP, nor IP broadcast address). 
3
- received IP packet was not IPv4. 
4
- received packet was of type unknown to the library. 
Description
This is MAC module routine. It processes next received packet if such exists. Pack-
ets are processed in the following manner:
ARP & ICMP requests are replied automatically. 
upon TCP request the Spi_Ethernet_UserTCP function is called for further
processing. 
upon UDP request the Spi_Ethernet_UserUDP function is called for further
processing. 
Note: Spi_Ethernet_doPacket must be called as often as possible in user's code.
Requires
Ethernet module has to be initialized. See Spi_Ethernet_Init.
Example
while TRUE do
begin
Spi_Ethernet_doPacket(); // process received packets
end