|
int | FlxCard::dma_max_tlp_bytes () |
|
void | FlxCard::dma_to_host (u_int dma_id, u_long dst, size_t size, u_int flags) |
|
void | FlxCard::dma_from_host (u_int dma_id, u_long src, size_t size, u_int flags) |
|
bool | FlxCard::dma_enabled (u_int dma_id) |
|
void | FlxCard::dma_wait (u_int dma_id) |
|
void | FlxCard::dma_stop (u_int dma_id) |
|
void | FlxCard::dma_advance_ptr (u_int dma_id, u_long dst, size_t size, size_t bytes) |
|
void | FlxCard::dma_set_ptr (u_int dma_id, u_long dst) |
|
u_long | FlxCard::dma_get_ptr (u_int dma_id) |
|
u_long | FlxCard::dma_get_read_ptr (u_int dma_id) |
|
void | FlxCard::dma_reset () |
|
u_long | FlxCard::dma_get_fw_ptr (u_int dma_id) |
|
u_long | FlxCard::dma_get_current_address (u_int dma_id) |
|
bool | FlxCard::dma_cmp_even_bits (u_int dma_id) |
|
A set of functions to setup, start and stop DMA transfers and to interact with the circular buffer PC pointers.
◆ dma_max_tlp_bytes()
int FlxCard::dma_max_tlp_bytes |
( |
| ) |
|
|
inline |
Calls the flx driver in order to determine the maximum number of TLP bytes that the H/W can support.
Errors In case of an error, an exception is thrown.
◆ dma_to_host()
void FlxCard::dma_to_host |
( |
u_int | dma_id, |
|
|
u_long | dst, |
|
|
size_t | size, |
|
|
u_int | flags ) |
First stops the DMA channel identified by dma_id. It does not check if the channel is busy. Then it programs the channel and starts a new DMA from-device-to-host operation.
Note: The bits 10:0 of the DMA descriptor (bitfield NUM_WORDS in the Wupper documentation) will be set to the maximum TLP size supported by the system. Therefore, the transfer size has to be a multiple of that value.
Errors In case of an error, an exception is thrown.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
dst | The value for the start_address field of the descriptor. NOTE: You have to provide a physical memory address |
size | The size of the transfer in bytes |
flags | The value for the wrap_around field of the descriptor; "1" means: enable wrap around, i.e. use continuous DMA |
◆ dma_from_host()
void FlxCard::dma_from_host |
( |
u_int | dma_id, |
|
|
u_long | src, |
|
|
size_t | size, |
|
|
u_int | flags ) |
First stops the DMA channel identified by dma_id. It does not check if the channel is busy. Then it programs the channel and starts a new DMA from-host-to-device operation.
Note: The size of the transfer has to be a multiple of 32 bytes.
The method internally computes the optimal value for the bits 10:0 of the DMA descriptor (bitfield NUM_WORDS in the Wupper documentation).
The algorithm used is this:
- if transfersize % 32 != 0: error("number of bytes transferred must be a multiple of 32")
- tlp = get_max_tlp()
- if transfersize % tlp == 0: do transfer
- else: tlp = tlp >> 1 && goto 3
Note: The algorithm above is currently not used: the transfer unit size is set to the minimum of 32 bytes, to make sure small messages are always sent, in particular when continuous DMA is enabled. The upper 16 bits of the flags parameter can be used to force a transfer size unequal to (so larger than) 32 bytes (but must be a multiple of 32).
Errors In case of an error, an exception is thrown.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
src | The value for the start_address field of the descriptor. NOTE: You have to provide a physical memory address |
size | The size of the transfer in bytes |
flags | The value for the wrap_around field of the descriptor. “1” means: enable wrap around, i.e. use continuous DMA |
◆ dma_enabled()
bool FlxCard::dma_enabled |
( |
u_int | dma_id | ) |
|
Returns whether the DMA channel identified by dma_id is enabled or not.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
◆ dma_wait()
void FlxCard::dma_wait |
( |
u_int | dma_id | ) |
|
Is blocking. It returns once the DMA on channel dma_id has ended. The method has an internal (hard wired) time out of 1 second.
Errors In case the DMA has not ended after 1 second an exception is thrown.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
◆ dma_stop()
void FlxCard::dma_stop |
( |
u_int | dma_id | ) |
|
Clears the DMA channel identified by dma_id. It does not check the status of that channel.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
◆ dma_advance_ptr()
void FlxCard::dma_advance_ptr |
( |
u_int | dma_id, |
|
|
u_long | dst, |
|
|
size_t | size, |
|
|
size_t | bytes ) |
Advances the internal read pointer of the DMA channel by the number of bytes given. This is used when operating the DMA engine in "endless DMA" / "circular buffer" mode. This method is to be called by the user after processing data at the head of the circular buffer to free the buffer for DMA writes or reads of the FLX card again.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
dst | See below. NOTE: You have to provide a physical memory address |
size | If the value of the read_ptr field, after adding bytes is larger than dst + size, size will be subtracted from read_ptr |
bytes | This value will be added to the read_ptr field of the DMA descriptor |
◆ dma_set_ptr()
void FlxCard::dma_set_ptr |
( |
u_int | dma_id, |
|
|
u_long | dst ) |
Directly writes the read pointer of a DMA channel.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
dst | The read pointer register of the DMA channel will be set to the value in dst |
◆ dma_get_ptr()
u_long FlxCard::dma_get_ptr |
( |
u_int | dma_id | ) |
|
Returns the current value of the SW_POINTER. That is to say the bits 127:64 of the DMA_DESC_[0..7]a as defined in the Wupper documentation.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
◆ dma_reset()
void FlxCard::dma_reset |
( |
| ) |
|
Triggers a reset by the DMA_RESET register in BAR0.
◆ dma_get_fw_ptr()
u_long FlxCard::dma_get_fw_ptr |
( |
u_int | dma_id | ) |
|
Reads the status register of a DMA descriptor (i.e. one of the DMA_DESC_STATUS_* registers) and returns the value of the FW_POINTER bit field (bits 63:0).
- Parameters
-
dma_id | The DMA channel (descriptor) to be queried; valid numbers are 0..7 |
◆ dma_cmp_even_bits()
bool FlxCard::dma_cmp_even_bits |
( |
u_int | dma_id | ) |
|
Reads the even_addr_dma and even_pc_dma bits of a DMA channel and compares them.
- Parameters
-
dma_id | The DMA channel (descriptor) to be used; valid numbers are 0..7 |
- Returns
- Returns true if the bits have the same value and false if not.