Visible to Intel only — GUID: kaq1655798632893
Ixiasoft
Visible to Intel only — GUID: kaq1655798632893
Ixiasoft
8.7.1.1. Create a Device Instance
For a device to be made available as a character mode device, it must provide an instance of the alt_dev structure. The alt_dev structure, defined in <Intel Quartus Prime installation directory>/ip/altera/soft_processor/altera_hal2/HAL/inc/sys/alt_dev.h , is essentially a collection of function pointers. These functions are called in response to application accesses to the HAL file system. For example, if you call the function open() with a file name that corresponds to this device, the result is a call to the open() function provided in this structure.
alt_dev Structure
typedef struct { alt_llist llist; /* for internal use */ const char* name; int (*open) (alt_fd* fd, const char* name, int flags, int mode); int (*close) (alt_fd* fd); int (*read) (alt_fd* fd, char* ptr, int len); int (*write) (alt_fd* fd, const char* ptr, int len); int (*lseek) (alt_fd* fd, int ptr, int dir); int (*fstat) (alt_fd* fd, struct stat* buf); int (*ioctl) (alt_fd* fd, int req, void* arg); } alt_dev;
For more information about open(), close(), read(), write(), lseek(), fstat(), and ioctl(), refer to the HAL API Reference section.