Go to the documentation of this file.
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
76 TRACE_INFO(
"Initializing NCN26010 Ethernet controller...\r\n");
79 interface->spiDriver->init();
82 if(interface->extIntDriver != NULL)
84 interface->extIntDriver->init();
138 interface->macAddr.b[0] =
value & 0xFF;
139 interface->macAddr.b[1] = (
value >> 8) & 0xFF;
140 interface->macAddr.b[2] = (
value >> 16) & 0xFF;
146 interface->macAddr.b[5] =
value & 0xFF;
147 interface->macAddr.b[4] = (
value >> 8) & 0xFF;
153 interface->macAddr.b[3] =
value & 0xFF;
186 interface->nicEvent =
TRUE;
202 #if (NCN26010_PLCA_SUPPORT == ENABLED)
237 if(linkState && !interface->linkState)
244 interface->linkState =
TRUE;
250 else if(!linkState && interface->linkState)
253 interface->linkState =
FALSE;
269 if(interface->extIntDriver != NULL)
271 interface->extIntDriver->enableIrq();
284 if(interface->extIntDriver != NULL)
286 interface->extIntDriver->disableIrq();
301 interface->nicEvent =
TRUE;
417 interface->spiDriver->assertCs();
422 chunk[j] = interface->spiDriver->transfer(chunk[j]);
426 interface->spiDriver->deassertCs();
436 interface->nicEvent =
TRUE;
503 interface->spiDriver->assertCs();
508 chunk[i] = interface->spiDriver->transfer(chunk[i]);
512 interface->spiDriver->deassertCs();
603 (interface->macAddr.b[2] << 24) | (interface->macAddr.b[3] << 16) |
604 (interface->macAddr.b[4] << 8) | interface->macAddr.b[5]);
608 (interface->macAddr.b[0] << 8) | interface->macAddr.b[1]);
616 acceptMulticast =
FALSE;
623 entry = &interface->macAddrFilter[i];
632 acceptMulticast =
TRUE;
640 unicastMacAddr[j++] = entry->
addr;
651 (unicastMacAddr[0].
b[2] << 24) | (unicastMacAddr[0].
b[3] << 16) |
652 (unicastMacAddr[0].
b[4] << 8) | unicastMacAddr[0].
b[5]);
656 (unicastMacAddr[0].
b[0] << 8) | unicastMacAddr[0].
b[1]);
669 (unicastMacAddr[1].
b[2] << 24) | (unicastMacAddr[1].
b[3] << 16) |
670 (unicastMacAddr[1].
b[4] << 8) | unicastMacAddr[1].
b[5]);
674 (unicastMacAddr[1].
b[0] << 8) | unicastMacAddr[1].
b[1]);
687 (unicastMacAddr[2].
b[2] << 24) | (unicastMacAddr[2].
b[3] << 16) |
688 (unicastMacAddr[2].
b[4] << 8) | unicastMacAddr[2].
b[5]);
692 (unicastMacAddr[2].
b[0] << 8) | unicastMacAddr[2].
b[1]);
757 interface->spiDriver->assertCs();
760 interface->spiDriver->transfer((header >> 24) & 0xFF);
761 interface->spiDriver->transfer((header >> 16) & 0xFF);
762 interface->spiDriver->transfer((header >> 8) & 0xFF);
763 interface->spiDriver->transfer(header & 0xFF);
766 interface->spiDriver->transfer((
data >> 24) & 0xFF);
767 interface->spiDriver->transfer((
data >> 16) & 0xFF);
768 interface->spiDriver->transfer((
data >> 8) & 0xFF);
769 interface->spiDriver->transfer(
data & 0xFF);
772 interface->spiDriver->transfer(0x00);
773 interface->spiDriver->transfer(0x00);
774 interface->spiDriver->transfer(0x00);
775 interface->spiDriver->transfer(0x00);
778 interface->spiDriver->deassertCs();
812 interface->spiDriver->assertCs();
815 interface->spiDriver->transfer((header >> 24) & 0xFF);
816 interface->spiDriver->transfer((header >> 16) & 0xFF);
817 interface->spiDriver->transfer((header >> 8) & 0xFF);
818 interface->spiDriver->transfer(header & 0xFF);
821 interface->spiDriver->transfer(0x00);
822 interface->spiDriver->transfer(0x00);
823 interface->spiDriver->transfer(0x00);
824 interface->spiDriver->transfer(0x00);
827 data = interface->spiDriver->transfer(0x00) << 24;
828 data |= interface->spiDriver->transfer(0x00) << 16;
829 data |= interface->spiDriver->transfer(0x00) << 8;
830 data |= interface->spiDriver->transfer(0x00);
833 interface->spiDriver->deassertCs();
854 for(i = 0; i < num; i++)
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
void nicNotifyLinkChange(NetInterface *interface)
Process link state change notification.
#define NCN26010_TX_HEADER_EV
#define NCN26010_PHYSTATUS
#define NCN26010_PLCACTRL1_ID
#define NCN26010_CONFIG0_CSARFE
#define NCN26010_CONFIG0_ZARFE
void macAddrToEui64(const MacAddr *macAddr, Eui64 *interfaceId)
Map a MAC address to the IPv6 modified EUI-64 identifier.
size_t netBufferRead(void *dest, const NetBuffer *src, size_t srcOffset, size_t length)
Read data from a multi-part buffer.
#define NCN26010_TX_HEADER_SV
Structure describing a buffer that spans multiple chunks.
#define MAC_ADDR_FILTER_SIZE
#define NCN26010_MACCTRL0
#define NCN26010_ADDRFILT1L
uint_t refCount
Reference count for the current entry.
#define NCN26010_CONFIG0_TXCTHRESH_16_CREDITS
#define NCN26010_MACCTRL0_BCSF
#define NCN26010_ETH_RX_BUFFER_SIZE
bool_t ncn26010IrqHandler(NetInterface *interface)
NCN26010 interrupt service routine.
#define NCN26010_PLCACTRL1_NCNT
#define NCN26010_CTRL_HEADER_P
#define NCN26010_MACCTRL0_TXEN
#define NCN26010_ADDRFILT0H
#define NCN26010_PLCABURST
#define NCN26010_LOCAL_ID
#define NCN26010_CTRL_HEADER_LEN
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
#define macIsMulticastAddr(macAddr)
#define NCN26010_TX_HEADER_DNC
#define NCN26010_STATUS0_RESETC
#define NCN26010_RX_FOOTER_EV
void ncn26010WriteReg(NetInterface *interface, uint8_t mms, uint16_t address, uint32_t data)
Write register.
#define NCN26010_BUFSTS_TXC
#define osMemcpy(dest, src, length)
#define NCN26010_TX_HEADER_DV
#define NCN26010_RX_FOOTER_SV
#define NCN26010_PLCACTRL1
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
#define NCN26010_DIOCFG_FN0_LED_TX
#define NCN26010_PLCABURST_MAXBC_DEFAULT
#define NCN26010_ADDRFILT1H
#define NCN26010_ADDRFILT0L
#define NCN26010_DIOCFG_SLEW_RATE_0
#define NCN26010_RESET_RESET
void ncn26010EventHandler(NetInterface *interface)
NCN26010 event handler.
#define NCN26010_PLCACTRL0
#define NCN26010_MACCTRL0_ADRF
uint32_t ncn26010ReadReg(NetInterface *interface, uint8_t mms, uint16_t address)
Read register.
void ncn26010Tick(NetInterface *interface)
NCN26010 timer handler.
#define NCN26010_ADDRFILT3L
error_t ncn26010Init(NetInterface *interface)
NCN26010 controller initialization.
#define NCN26010_NODE_COUNT
uint32_t ncn26010CalcParity(uint32_t data)
Calculate parity bit over a 32-bit data.
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
#define NCN26010_CTRL_HEADER_MMS
#define NCN26010_RX_FOOTER_RCA
const NicDriver ncn26010Driver
NCN26010 driver.
#define NCN26010_ADDRFILT2L
#define NCN26010_MACCTRL0_RXEN
#define NCN26010_TX_HEADER_NORX
#define NCN26010_PLCABURST_BTMR_DEFAULT
__weak_func void ncn26010InitHook(NetInterface *interface)
NCN26010 custom configuration.
#define NCN26010_DIOCFG_SLEW_RATE_1
#define NCN26010_CONFIG0_SYNC
#define NCN26010_CTRL_HEADER_ADDR
#define NCN26010_ADDRFILTnH_EN
error_t ncn26010ReceivePacket(NetInterface *interface)
Receive a packet.
#define NCN26010_CHUNK_PAYLOAD_SIZE
#define NCN26010_PLCACTRL0_PCLA_EN
Onsemi NCN26010 10Base-T1S Ethernet controller.
#define NCN26010_DIOCFG_FN1_LED_RX
#define macCompAddr(macAddr1, macAddr2)
#define NCN26010_RX_FOOTER_DV
#define NCN26010_DIOCFG_VAL1
uint32_t reverseInt32(uint32_t value)
Reverse bit order in a 32-bit word.
void ncn26010EnableIrq(NetInterface *interface)
Enable interrupts.
#define NCN26010_ADDRFILT2H
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
#define NCN26010_RX_FOOTER_EBO
error_t ncn26010UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
#define NCN26010_MACCTRL0_MCSF
#define NCN26010_MACCTRL0_FCSA
#define NCN26010_PHYCTRL_LINK_CONTROL
#define osMemset(p, value, length)
#define NCN26010_TX_HEADER_EBO
#define NCN26010_DIOCFG_VAL0
void ncn26010DumpReg(NetInterface *interface, uint8_t mms, uint16_t address, uint_t num)
Dump registers for debugging purpose.
#define NCN26010_CTRL_HEADER_WNR
void ncn26010DisableIrq(NetInterface *interface)
Disable interrupts.
#define NCN26010_ADDRFILT3H
#define NCN26010_PHYSTATUS_LINK_STATUS
#define NCN26010_CONFIG0_CPS_64_BYTES
#define NCN26010_BUFSTS_RCA
#define NCN26010_CTRL_HEADER_AID
const MacAddr MAC_UNSPECIFIED_ADDR
error_t ncn26010SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
@ NIC_TYPE_ETHERNET
Ethernet interface.