Specifications

Register a Flash Device
After creating an instance of the alt_flash_dev structure, you must make the device available to the
HAL system by calling the following function:
int alt_flash_device_register( alt_flash_fd* fd)
This function takes a single input argument, which is the device structure to register. The return value is
zero upon success. A negative return value indicates that the device cannot be registered.
DMA Device Drivers
The HAL models a DMA transaction as being controlled by two endpoint devices: a receive channel and a
transmit channel.
For more information about a complete description of the HAL DMA device model, refer to “Using DMA
Devices” in the "Developing Programs Using the Hardware Abstraction Layer" chapter of the Nios II
Software Developer’s Handbook.
The DMA device driver interface is defined in sys/alt_dma_dev.h.
Related Information
Developing Device Drivers for the Hardware Abstraction Layer
DMA Transmit Channel
Example 7–2. alt_dma_txchan Structure
typedef struct alt_dma_txchan_dev_s alt_dma_txchan_dev;
struct alt_dma_txchan_dev_s
{
alt_llist llist;
const char* name;
int (*space) (alt_dma_txchan dma);
int (*send) (alt_dma_txchan dma,
const void* from,
alt_u32 len,
alt_txchan_done* done,
void* handle);
int (*ioctl) (alt_dma_txchan dma, int req, void* arg);
};
DMA Receive Channel
Example 7–3. alt_dma_rxchan Structure
typedef alt_dma_rxchan_dev_s alt_dma_rxchan;
struct alt_dma_rxchan_dev_s
{
alt_llist list;
const char* name;
alt_u32 depth;
int (*prepare) (alt_dma_rxchan dma,
void* data,
alt_u32 len,
alt_rxchan_done* done,
void* handle);
int (*ioctl) (alt_dma_rxchan dma, int req, void* arg);
};
7-10
Register a Flash Device
NII5V2
2015.05.14
Altera Corporation
Developing Device Drivers for the Hardware Abstraction Layer
Send Feedback