Embedded Peripherals IP User Guide

ID 683130
Date 8/11/2025
Public
Document Table of Contents
1. Introduction 2. Avalon® -ST Single-Clock and Dual-Clock FIFO Cores 3. Avalon® -ST Serial Peripheral Interface Core 4. SPI Core 5. SPI Agent/JTAG to Avalon® Host Bridge Cores 6. Intel eSPI Agent Core 7. eSPI to LPC Bridge Core 8. Ethernet MDIO Core 9. Intel FPGA 16550 Compatible UART Core 10. UART Core 11. JTAG UART Core 12. Intel FPGA Avalon® Mailbox Core 13. Intel FPGA Avalon® Mutex Core 14. Intel FPGA Avalon® I2C (Host) Core 15. Intel FPGA I2C Agent to Avalon® -MM Host Bridge Core 16. Intel FPGA Avalon® Compact Flash Core 17. EPCS/EPCQA Serial Flash Controller Core 18. Intel FPGA Serial Flash Controller Core 19. Intel FPGA Serial Flash Controller II Core 20. Intel FPGA Generic QUAD SPI Controller Core 21. Intel FPGA Generic QUAD SPI Controller II Core 22. Interval Timer Core 23. Intel FPGA Avalon FIFO Memory Core 24. On-Chip Memory (RAM and ROM) Intel FPGA IP 25. On-Chip Memory II (RAM or ROM) Intel FPGA IP 26. Optrex 16207 LCD Controller Core 27. PIO Core 28. PLL Cores 29. DMA Controller Core 30. Modular Scatter-Gather DMA Core 31. Scatter-Gather DMA Controller Core 32. SDRAM Controller Core 33. Tri-State SDRAM Core 34. Video Sync Generator and Pixel Converter Cores 35. Intel FPGA Interrupt Latency Counter Core 36. Performance Counter Unit Core 37. Vectored Interrupt Controller Core 38. Avalon® -ST Data Pattern Generator and Checker Cores 39. Avalon® -ST Test Pattern Generator and Checker Cores 40. System ID Peripheral Core 41. Avalon® Packets to Transactions Converter Core 42. Avalon® -ST Multiplexer and Demultiplexer Cores 43. Avalon® -ST Bytes to Packets and Packets to Bytes Converter IP 44. Avalon® -ST Delay Core 45. Avalon® -ST Round Robin Scheduler Core 46. Avalon® -ST Splitter Core 47. Avalon® -MM DDR Memory Half Rate Bridge Core 48. Intel FPGA GMII to RGMII Converter Core 49. HPS GMII to RGMII Adapter Intel® FPGA IP 50. Intel FPGA MII to RMII Converter Core 51. HPS GMII to TSE 1000BASE-X/SGMII PCS Bridge Core Intel® FPGA IP 52. Intel FPGA HPS EMAC to Multi-rate PHY GMII Adapter Core 53. Intel FPGA MSI to GIC Generator Core 54. Cache Coherency Translator Intel® FPGA IP 55. Altera ACE5-Lite Cache Coherency Translator 56. Lightweight UART Core

12.4.1.2. Driver Implementation

An opened Mailbox instance will register a sender/receiver interrupt service routine (ISR), if interrupts are supported with sender/receiver callbacks. When a Mailbox interrupt is disabled, an ISR will not register and polling mode will need to be used. You must close the Mailbox driver when it is unused.

Table 109.  Mailbox APIs
Function Name Description
altera_avalon_mailbox_send Send message to Mailbox
altera_avalon_mailbox_status Query current state of Mailbox
altera_avalon_mailbox_retrieve_poll Read from Mailbox pointer register to retrieve messages
altera_avalon_mailbox_open Claims a handle to a Mailbox, enabling all the other functions to access the Mailbox core
altera_avalon_mailbox_close Close the handle to a Mailbox
Table 110.  altera_avalon_mailbox_open
Prototype: altera_avalon_mailbox_dev* altera_avalon_mailbox_open (const char* name, altera_mailbox_tx_cb tx_callback, altera_mailbox_rx_cb rx_callback)
Include: <altera_avalon_mailbox_simple.h>
Parameters:

Name — The Mailbox device name to open.

tx_callback – User to provide callback function to notify when a sending message is completed.

rx_callback – User to provide callback function to notify when a receive a message.
Returns: Pointer to mailbox
Description:

altera_avalon_mailbox_open() find and register the Mailbox device pointer. This function also registers the interrupt handler and user callback function for a interrupt enabled Mailbox.

Table 111.  altera_avalon_mailbox_close
Prototype: void altera_avalon_mailbox_close (altera_avalon_mailbox_dev* dev);
Include: <altera_avalon_mailbox_simple.h>
Parameters: dev—The Mailbox to close.
Returns: Null
Description: alt_avalon_mailbox_close() closes the mailbox de-registering interrupt handler and callback functions and masking Mailbox interrupt.
Table 112.  altera_avalon_mailbox_send
Prototype: int altera_avalon_mailbox_send (altera_avalon_mailbox_dev* dev, void* message, int timeout, EventType event)
Include: <altera_avalon_mailbox_simple.h>
Parameters:

*message – Pointer to message command and pointer structure.

Timeout – Specifies number of loops before sending a message. Give a ‘0’ value to wait until the message is transferred.

EventType – set ‘POLL’ or ‘ISR’.

Returns: Return 0 on success and 1 for fail.
Description:

altera_avalon_mailbox_send () sends a message to the mailbox. This is a blocking function when the sender interrupt is disabled.

This function is in non-blocking when interrupt is enabled.

Table 113.  altera_avalon_mailbox_retrieve_poll
Prototype: int altera_avalon_mailbox_retrieve_poll (altera_avalon_mailbox_dev* dev,alt_u32* msg_ptr, alt_u32 timeout)
Include: <altera_avalon_mailbox_simple.h>
Parameters:

dev - The Mailbox device to read message from.

timeout – Specifies number loops before sending a message. Give a ‘0’ value to wait until a message is retrieved.

msg_ptr – A pointer to an array of two Dwords which are for the command and message pointer. This pointer will be populated with a receive message if successful or NULL if error.
Returns: Return pointer to message and command. Return ‘NULL’ in messages if timeout. This is a blocking function.
Description:

altera_avalon_mailbox_retrieve_poll () reads a message pointer and command to Mailbox structure from the Mailbox and notifies through callback.

Table 114.  altera_avalon_mailbox_status
Prototype: alt_u32 altera_avalon_mailbox_status (altera_avalon_mailbox_dev* dev)
Include: <altera_avalon_mailbox_simple.h>
Parameters:

dev -The Mailbox device to read status from

Returns:

For a receiving Mailbox:

- 0 for no message pending

- 1 for message pending

For a sending Mailbox:

- 0 for Mailbox empty (ready to send)

- 1 for Mailbox full (not ready to send)

Description:

Indicates to sender Mailbox it is full or empty for transfer.

Indicates to receiver Mailbox has a message pending or not.

Device structure

// Callback routine type definition
typedef void(*altera_mailbox_rx_cb)(void *message);
typedefvoid (*altera_mailbox_tx_cb)(void *message,int status);

typedef enum mbox_type { MBOX_TX = 0,MBOX_RX } MboxType;
typedef enum event_type { ISR = 0, POLL } EventType;

typedef struct altera_avalon_mailbox_dev
{    
	alt_dev                 dev;                  
	/* Device linke-list entry */
    
	alt_u32                 base;                 
	/* Base address of Mailbox */
    
	alt_u32                 mailbox_irq;          
	/* Mailbox IRQ */
    
	alt_u32                 mailbox_intr_ctrl_id; 
	/* Mailbox IRQ ID */  
  
	altera_mailbox_tx_cb    tx_cb;                
	/* Callback routine pointer */ 
   
	altera_mailbox_rx_cb    rx_cb;                
	/* Callback routine pointer */   
 
	MboxType                mbox_type;            
	/* Mailbox direction */  
  
	alt_u32*                mbox_msg;             
	/* a pointer to message array to be received or sent */
    
	alt_u8                  lock;                 
	/* Token to indicate mbox_msg already taken */ 
   
	ALT_SEM                 (write_lock)          
	/* Semaphore used to control access to the write in multi-threaded mode */
} 
altera_avalon_mailbox_dev;