5.2.2. intel_ssgdma.c
Prototype |
intel_ssgdma_dev *intel_ssgdma_open(const char *name) |
Include |
<intel_ssgdma.h> |
Parameters |
name - Character pointer to name of ssgdma device. |
Return |
intel_ssgdma_dev *dev - Success. Null - Invalid name or device is not registered. |
Description |
Retrieve a pointer to the ssgdma device instance of the given name. For this api to work properly, instance must be within the scope, where this function is called. |
Prototype |
void intel_ssgdma_init(intel_ssgdma_dev *const dev, const FPGA_INTERRUPT_HANDLE irq_controller_id, const FPGA_INTERRUPT_HANDLE irq, const FPGA_MMIO_INTERFACE_HANDLE mmio_handle, const uint16_t num_D2H_ST_device_ports, const uint16_t num_H2D_ST_device_ports, const uint16_t num_H2D_MM_device_ports, const uint16_t total_device_ports, const bool restrict_unaligned_access) |
Include |
<intel_ssgdma.h> |
Parameters |
|
Return |
None |
Description |
Initializes the Scalable Scatter-Gather DMA controller. This routine is called from the INTEL_SSGDMA_INIT macro and is called automatically by alt_sys_init.c in HAL system. |
Prototype |
intel_ssgdma_return_e intel_ssgdma_register_global_error_callback( intel_ssgdma_dev *dev, intel_ssgdma_global_error_callback callback, void *user_context) |
Include |
<intel_ssgdma.h> |
Parameters |
|
Return |
E_INTEL_SSGDMA_OK : 0 -> Success. E_INTEL_SSGDMA_INVALID_ARGUMENT : -1 -> Invalid arguments. |
Description |
Function is set user callback function for ISR from application. User may use this function to handle global errors.
Notes: When defining global error callback, user should set a flag in user_context to initiate device global reset flow. Please do not call the API directly in the callback, as most of the API blocks until the hw is stopped or reset. The user callback is called directly in the intel_ssgdma_irq.
Suggested global reset flow:
|
Callback Details |
typedef void (*intel_ssgdma_global_error_callback)(void *user_context, const FPGA_MMIO_INTERFACE_HANDLE csr_base, const uint32_t global_status);
Callback Arguments:
|
Prototype |
intel_ssgdma_return_e intel_ssgdma_register_queue_error_callback( intel_ssgdma_dev *dev, intel_ssgdma_queue_error_callback callback, void *user_context) |
Include |
<intel_ssgdma.h> |
Parameters |
|
Return |
E_INTEL_SSGDMA_OK : 0 -> Success. E_INTEL_SSGDMA_INVALID_ARGUMENT : -1 -> Invalid arguments. |
Description |
Function is set user callback function for ISR from application. User may use this function to handle device port or descriptor errors.
Notes: When defining queue error callback, user should set a flag in user_context to initiate device port reset flow. Please do not call the API directly in the callback, as most of the API blocks until the hw is stopped or reset. The user callback is called directly in intel_ssgdma_irq.
Suggested device port reset flow:
|
Callback Details |
typedef void (*intel_ssgdma_queue_error_callback)(void *user_context, const FPGA_MMIO_INTERFACE_HANDLE csr_base, const intel_ssgdma_port_type_e port_type, const uint16_t port_num, const uint32_t q_status);
Callback Arguments:
|
Prototype |
intel_ssgdma_return_e intel_ssgdma_register_complete_callback( intel_ssgdma_dev *dev, intel_ssgdma_complete_callback callback, void *user_context) |
Include |
<intel_ssgdma.h> |
Parameters |
|
Return |
E_INTEL_SSGDMA_OK : 0 -> Success. E_INTEL_SSGDMA_INVALID_ARGUMENT : -1 -> Invalid arguments. |
Description |
Function is set to user callback function for ISR from application. You may use this function to handle responder completed event. Notes: When defining completion callback, user should set a flag in user_context to signal transfer completion. Please do not call the API directly in the callback, as most of the API blocks until the hw is stopped or reset. The user callback is called by intel_ssgdma_service_all_completed_resp in intel_ssgdma_irq. |
Callback Details |
typedef void (*intel_ssgdma_complete_callback)(void *user_context, const FPGA_MMIO_INTERFACE_HANDLE csr_base, const intel_ssgdma_port_type_e port_type, const uint16_t port_num, const uint16_t completed_resp_num);
Callback Arguments:
|
Prototype |
intel_ssgdma_return_e intel_ssgdma_register_video_flushing_callback( intel_ssgdma_dev *dev, intel_ssgdma_video_flushing_callback callback, void *user_context) |
Include |
<intel_ssgdma.h> |
Parameters |
|
Return |
E_INTEL_SSGDMA_OK : 0 -> Success. E_INTEL_SSGDMA_INVALID_ARGUMENT : -1 -> Invalid arguments. |
Description |
Function is set user callback function for ISR from application. You may use this function to handle video flushing event. Notes: When defining video flushing callback, you should set a flag in user_context to signal transfer completion. Please do not call the API directly in the callback, as most of the API blocks until the hw is stopped or reset. The user callback is called by intel_ssgdma_video_flushing_event in intel_ssgdma_irq. |
Callback Details |
typedef void (*intel_ssgdma_video_flushing_callback)(void *user_context, const FPGA_MMIO_INTERFACE_HANDLE csr_base, const intel_ssgdma_port_type_e port_type, const uint16_t port_num, const uint16_t next_pend_desc_hw_idx, const uint32_t q_bytessent, const uint32_t q_total_bytessent); Callback Arguments: - user_context - user defined callback context - csr_base - Base address to identify the interrupting device. - port_type - port type to identify the interrupting device port. - port_num - port num to identify the interrupting device port. - next_pend_desc_hw_idx - hw index of the descriptor, that is being flushed. - q_bytessent - bytes sent during flushing event. - q_total_bytessent - total byte sent since first flushing event. |
Prototype |
intel_ssgdma_return_e intel_ssgdma_cal_host_mem_size( intel_ssgdma_dev *dev, uint16_t total_desc_block, uint16_t total_resp_block, size_t *total_alloc_bytes) |
Include |
<intel_ssgdma.h> |
Parameters |
|
Return |
E_INTEL_SSGDMA_OK : 0 → Success. E_INTEL_SSGDMA_INVALID_ARGUMENT : -1 → Invalid arguments. E_INTEL_SSGDMA_ALREADY_SETUP : -9 → Already calculated. Please reset before calling this function. |
Description |
Calculates required host memory allocation to hold descriptors and responders for dma operations. You are advised to allocate at least 1 descriptor block to each device port. This function can only be called once. Please call intel_ssgdma_global_soft_reset to start again. After this you should use total_alloc_bytes to allocate host memory and call intel_ssgdma_set_desc_start to assign the memory to the driver. |
Prototype |
intel_ssgdma_return_e intel_ssgdma_cal_host_mem_size( intel_ssgdma_dev *dev, uint16_t total_desc_block, uint16_t total_resp_block, size_t *total_alloc_bytes) |
Include |
<intel_ssgdma.h> |
Parameters |
|
Return |
E_INTEL_SSGDMA_OK : 0 → Success. E_INTEL_SSGDMA_INVALID_ARGUMENT : -1 → Invalid arguments. E_INTEL_SSGDMA_MEMALLOC_ERROR : -4 → Given desc_start is null pointer or unaligned address. E_INTEL_SSGDMA_ALREADY_SETUP: -9 → Already assigned. Please reset before calling this function. |
Description |
Assign the allocated host memory as the address of the first descriptor of the device port. This function can only be called once. Please call intel_ssgdma_global_soft_reset to start again.. Before this function, you must first call intel_ssgdma_cal_host_mem_size. |