Presentation is loading. Please wait.

Presentation is loading. Please wait.

1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.

Similar presentations


Presentation on theme: "1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s."— Presentation transcript:

1 1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s

2 1-2 Embedded Network Interface (ENI) Allows sharing of NET+ARM’s memory system Useful for dual processor system Second Processor must push / pull data –NET+ARM is a slave in ENI mode Can use either FIFO mode or Shared Ram mode –FIFO is fast, but have less control over data –Shared RAM is slower, but have more control –ENI must become BUS Master to use Shared RAM ENI is muxed with Parallel Ports (one or the other)

3 1-3 ENI Concept NetARM (Slave) host ENI Port Data + Addr Bus RAM External uP System (Master) client Data + Addr Bus

4 1-4 Shared RAM Mode Allow external device (client) to random access external memory which is controlled by the the NET+ARM (host) 8/16-bit interface Size of Shared RAM is can be one of the following –4K, 8K, 16. 32, or 64K Location of RAM must be a multiple of the size selected –E.g. ram size of 8k must on located on a 8k boundary

5 1-5 FIFO Mode Data-streaming interface between the NET+ARM and the external device 8/16-bit interface Two 32-byte FIFOs used to transmit and receive data DMA 3 is used to transfer receive data from FIFO to external memory DMA 4 is used to transfer transmit data from external memory to FIFO DMA buffers must start and end on a 32-bit boundary Data must be padded to conform to buffer requirement 8K of shared memory can be accessed

6 1-6 ENI Driver DMA Driver Module ENI Driver Application ENI Hardware Module

7 1-7 ENI Library API sources are located in \netos\src\devices\eni –eni_mod.ccode to handle API –eni_host.ccode to run on host side (NET+ARM) –eni_client.ccode to run on client side (external device) –eni_reg.ccode contain table of ENI register information –eni_host.hlocal header file for host code –eni_client.hlocal header file for client code Header file is located in \netos\h\ –eni_api.hheader file to include in application to support API

8 1-8 ENI API’s eniLoadDriver () eniOpenChannel () eniCloseChannel () eniEnableFIFO () eniDisableFIFO () eniSupplyFIFO () eniReadFIFO () eniWriteFIFO () eniFlushFIFO () (*eniTransmitType)() (*eniReceiveType)() (*eniTriggerType)() eniTriggerInterrupt () eniEnableTrigger () eniDisableTrigger () eniGetSharedRAM ()

9 1-9 ENI API’s eniLoadDriver () –loads the ENI driver by initializing the ENI channel. eniOpenChannel () –opens a channel for the ENI peripheral; there is only one ENI channel supported. –shared RAM is configured and ENI interrupt handler is registered. –If selected, the FIFO channel is setup for receiving and transmitting messages to the external device. –The ENI driver will override one of the 4 ENI modes configured by hardware. –The channel cannot be opened if it is configured for IEEE1284 HOST PORT. eniCloseChannel () –Close the ENI channel. –Channel cannot be close if the ENI driver is still holding buffers owned by the application. –Channel must be flushed before it is permitted to close.

10 1-10 ENI API’s eniEnableFIFO () –Enable the FIFO channel. –Data activity in the channel will resume where it was left off before it was halted. eniDisableFIFO () –Disable the FIFO channel. –Data activity in the channel will be halted until the channel is enabled again. –Disable FIFO by clearing the erx or etx bit in General Control Register eniSupplyFIFO () –supply messages to the ENI driver used to store incoming data from the external device –buffer must be aligned on a 32-bit boundary. –buffer size must be a multiple of 4 bytes. –maximum number of messages queued will depend on the size of the receive queue configured

11 1-11 ENI API’s eniReadFIFO () –Retrieve data received from the FIFO channel. –If no message is pending, the application can specify the amount of time to poll for incoming data. –Data can be read from the FIFO channel if it is disabled. –This routine cannot be used to retrieve messages if the receive callback is defined. eniWriteFIFO () –transmit a message through the ENI peripheral. –a buffer must be 32-bit aligned;buffer size must be a multiple of 4 bytes.. –number of messages will handle depends on the transmit queue size configured –ENI driver owns the message until it has been transmitted. –Data cannot be written to the FIFO, if the channel is disabled. –A chained message is treat not as one message but as multiple messages. There must be enough space in the transmit queue for each message in the chain. Otherwise message will be rejected.

12 1-12 ENI API’s eniFlushFIFO () –flush any application buffers from the ENI driver –channel must be disabled before it can be flushed. – Messages pending in the transmit channel are release to the application by using the eniTransmiteRtn callback. –The allocated buffers supplied to the receive channels are returned automatically by using the eniReceiveRtn callback if defined. Otherwise the application is required to manually retrieve the buffers back by calling eniReadFIFO (). –Each message that has been abort will contain the ENI_DATA_FLUSHED in the message’s status field. –Channel must be disabled before it can be flushed eniTriggerInterrupt () –Trigger an ENI interrupt to the external device. –The interrupt is a way to synchronize information or communication between two processes. –Trigger interrupt to external device by enabling stsint in ENI Shared Register –Inactive if trigger callback is undefined

13 1-13 ENI API’s eniEnableTrigger () –Allow an external device to trigger an interrupt to the NET+ARM. –If no callback routine is defined, then this routine is inactive –Enable ENI interrupt by setting the eni_port3 in Interrupt Enable Register eniDisableTrigger () –Don’t allow an external device triggering an interrupt to the NET+ARM. –If no callback routine is defined, then this routine is inactive –Disable ENI interrupt by clearing the eni_port3 in Interrupt Enable Register eniGetSharedRam () –location and size of the ENI shared memory location configured.

14 1-14 ENI API’s (*eniTransmitType)() –This callback routine is provided by the application. It is used by the ENI driver to release the message after it has been transmitted. Once the ENI driver returns the it back, the application is able to reuse the buffer. –This routine is called within an ISR routine. Function calls, which require long execution time, cannot be used. This includes sleep time and waiting for semaphores. Return message back in free pool (* eniReceiveType)() –This callback routine is provided by the application to process incoming data. The ENI driver will calls this routine whenever it receives data from the FIFO channel. Since this routine is called within an interrupt, instructions that require extensive execution time cannot be used. –Upon return of this routine, the ENI driver no longer owns the message. It is the responsibility of the application to release the buffer after it is done with it. –If the application does not want to process incoming data immediately, it can delay processing by not defining this routine. The application can access pending data by calling eniReadFIFO () whenever it has time to process it. Must free the message when it is done with it

15 1-15 ENI API’s (* eniTriggerType)() –This callback routine is provided by the application. It is called whenever an ENI interrupt is received. –The interrupt is triggered by an external device to synchronize communication between the two processes. – The ENI interrupt is cleared and reset upon return of this routine. Function calls, which require long execution time, cannot be used.


Download ppt "1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s."

Similar presentations


Ads by Google