Embedded Peripherals IP User Guide

ID 683130
Date 10/24/2025
Public
Document Table of Contents
1. Introduction 2. Avalon® -ST Serial Peripheral Interface Core 3. SPI Core 4. SPI Agent/JTAG to Avalon® Host Bridge Cores 5. Intel eSPI Agent Core 6. eSPI to LPC Bridge Core 7. Ethernet MDIO Core 8. Intel FPGA 16550 Compatible UART Core 9. UART Core 10. Lightweight 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. EPCS/EPCQA Serial Flash Controller Core 17. Intel FPGA Serial Flash Controller Core 18. Intel FPGA Serial Flash Controller II Core 19. Intel FPGA Generic QUAD SPI Controller Core 20. Intel FPGA Generic QUAD SPI Controller II Core 21. Interval Timer Core 22. Intel FPGA Avalon FIFO Memory Core 23. On-Chip Memory (RAM and ROM) Intel FPGA IP 24. On-Chip Memory II (RAM or ROM) Intel FPGA IP 25. PIO Core 26. PLL Cores 27. DMA Controller Core 28. Modular Scatter-Gather DMA Core 29. Scatter-Gather DMA Controller Core 30. Video Sync Generator and Pixel Converter Cores 31. Intel FPGA Interrupt Latency Counter Core 32. Performance Counter Unit Core 33. Vectored Interrupt Controller Core 34. System ID Peripheral Core 35. Intel FPGA GMII to RGMII Converter Core 36. HPS GMII to RGMII Adapter IP 37. Intel FPGA MII to RMII Converter Core 38. HPS GMII to TSE 1000BASE-X/SGMII PCS Bridge Core IP 39. Intel FPGA HPS EMAC to Multi-rate PHY GMII Adapter Core 40. Intel FPGA MSI to GIC Generator Core 41. Cache Coherency Translator IP 42. Altera ACE5-Lite Cache Coherency Translator

10.5.1.1.1. UART API

Lightweight UART (RS-232 Serial Port) is inheriting APIs on previous Altera Avalon UART. The following tables list the APIs.
Note:
  1. Lightweight UART is a character device. Instead of calling public API directly, you must use the system function, so that the device is access correctly. System functions are C standard library functions such as fopen, fclose, fread, read, fwrite, write, and fprintf.
  2. If small driver is set up in BSP Editor, only read and write API will be available.
Table 96.  intel_lw_uart_read_fd
Prototype intel_lw_uart_read_fd (alt_fd* fd, char* ptr, int len);
Include <intel_lw_uart_fd.h>
Parameters
  • fd - the UART device file descriptor.
  • ptr - destination address.
  • len - maximum length of the data to read.
Return

Number of bytes read if successful and otherwise return:

  • -EWOULDBLOCK to indicate that the read operation would have blocked, but the file descriptor was placed in non-blocking mode.
  • -ETIME for read timeout. (Invalid for small driver)
Description

This is a wrapper function to redirect system call to driver function

intel_lw_uart_read should be called indirectly by using system function fread or read.

Table 97.  intel_lw_uart_write_fd
Prototype intel_lw_uart_write_fd(alt_fd* fd, const char* buffer, int len);
Include <intel_lw_uart_fd.h>
Parameters
  • fd - the UART device file descriptor.
  • ptr - source address.
  • len - length of the data to write.
Return

Number of bytes written if successful and otherwise return:

  • -EWOULDBLOCK to indicate that the write operation would have blocked, but the file descriptor was placed in non-blocking mode.
  • -ETIME for write timeout. (invalid for small driver)
Description

This is a wrapper function to redirect system call to driver function

intel_lw_uart_write. Should be called indirectly by using system function fwrite, write or fprintf.

Table 98.  intel_lw_uart_close_fd
Prototype int intel_lw_uart_close_fd (alt_fd* fd);
Include <intel_lw_uart_fd.h>
Parameters
  • fd - the UART device file descriptor
Return

Return 0 if successful and otherwise return:

  • -EWOULDBLOCK to the file descriptor was placed in blocking mode, but file is closed before the transmit data is empty.
Description

This is a wrapper function to redirect system call to driver function

intel_lw_uart_close. Should be called indirectly by using system function fclose or close.

Table 99.  intel_lw_uart_ioctl_fd
Prototype intel_lw_uart_ioctl_fd (alt_fd* fd, int req, void* arg);
Include <intel_lw_uart.h>
Parameters
  • fd - the UART device file descriptor.
  • reg – IOCTL request: TIOCMGET, TIOCMSET, TIOCEXCL, TIOCNXCL.
  • arg – input termios structure.
Return

Return 0 if successful and otherwise return:

  • -ENOTTY for not supported request.
  • -EIO for unsupported termios setting.
Description This is a wrapper function to redirect system call to driver function intel_lw_uart_ioctl. Should be called indirectly by using system function ioctl.
Table 100.  intel_lw_uart_init_eop
Prototype

intel_lw_uart_init_eop (const int file, const EOP_Callback eop_cb_in,

const alt_u8 eop);

Include <intel_lw_uart.h>
Parameters
  • file – the uart file descriptor. Can be obtained by using system function open.
  • eop_cb_in – user-defined function, that is called in EOP interrupt.
  • eop – character to trigger eop interrupt.
Return

Return 0 if successful and otherwise return:

  • -1 for error: invalid file descriptor or call back function is null or EOP option disabled.
  • -EACCES if file descriptor is read only.
Description Call this in the init function of your application to enable and use the EOP feature and add custom call back.
Table 101.  intel_lw_uart_init_eh
Prototype intel_lw_uart_init_eh (const int file, const EH_Callback eh_cb_in)
Include <intel_lw_uart.h>
Parameters
  • file – the uart file descriptor. Can be obtained by using system function open.
  • eh_cb_in – user-defined function, that is called in EH interrupt.
Return

Return 0 if successful and otherwise return:

  • -1 for error: invalid file descriptor or call back function is null.
  • -EACCES if file descriptor is read only.
Description Call this in the init function of your application to enable exception handling and add custom call back.
Table 102.  intel_lw_uart_init
Prototype intel_lw_uart_init(intel_lw_uart_state* sp, alt_u32 irq_controller_id, alt_u32 irq);
Include <intel_lw_uart.h>
Parameters
  • sp - pointer to the LW UART device state.
  • irq_controller_id -interrupt controller id.
  • irq – interrupt number.
Return None.
Description Called by the auto-generated function alt_sys_init() for each UART in the system.
Table 103.  intel_lw_uart_set_trbk
Prototype intel_lw_uart_set_trbk (const int file, const alt_u8 enable);
Include <intel_lw_uart.h>
Parameters
  • file – the uart file descriptor. Can be obtained by using system function open.
  • enable - set INTEL_LW_UART_TRBK_ENABLE or INTEL_LW_UART_TRBK_DISABLE.
Return

Return 0 if successful and otherwise return:

  • -1 for error: invalid file descriptor or invalid enable.
  • -EACCES if file descriptor is read only.
Description Called by the user application to transmit a break character over the TXD output.