Embedded Peripherals IP User Guide

ID 683130
Date 9/18/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

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

56.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 512.  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 513.  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 514.  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 515.  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 516.  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 517.  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 518.  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 519.  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.