SPRUGR9H November 2010 – April 2015 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , 66AK2L06 , AM5K2E02 , AM5K2E04 , SM320C6678-HIREL , TMS320C6652 , TMS320C6654 , TMS320C6655 , TMS320C6657 , TMS320C6670 , TMS320C6671 , TMS320C6672 , TMS320C6674 , TMS320C6678
In this example, two PKTDMA channels (for both TX and RX) are configured with one RX flow per channel. The following code shows the necessary initialization.
First, configure the logical queue managers. We will define three in this example: (note this is not the usual configuration, this is mainly for demonstration).
/* Program the logical queue managers for QMSS PKTDMA: */
qm_map[0] = 0;
qm_map[1] = 5000;
qm_map[2] = 7000;
qm_map[3] = 0xffff; /* unused */
config_pktdma_qm(QMSS_pktdma_GBL_CFG_REGION, qm_map);
Next, configure the TX channels. TX channels should not be configured while they are enabled.
/* Configure Tx channel 0 */
config_tx_sched(QMSS_PKTDMA_TX_SCHD_REGION, 0, 0); //high priority
/* Configure Tx channel 1 */
config_tx_sched(QMSS_PKTDMA_TX_SCHD_REGION, 1, 0); //high priority
Next, configure the RX flows. Note that RX flows cannot be changed while any channel that uses them is enabled. This is not trivial for simple example code to check, so config_rx_flow simply assumes that no RX channels are enabled. It is well worth the investment in time to study the programmability of the RX flow. For example, FDQ selection may be fixed, based on packet size, or in the case of Host packets, Host buffer number. In the case of size based FDQ selection, RX Flow registers C through H must be programmed to configure the thresholds, enables and desired queues.
This example sets up the basic case – select from one FDQ and send to one RX queue:
/* Configure Rx flow 0 for channel 0 (Host Descriptors to Hi Pri Acc.) */
config_rx_flow(QMSS_PKTDMA_RX_FLOW_REGION, 0,
0x040002c8, 0, 0, 0x20002000, 0x20002000, 0, 0, 0);
/* Configure Rx flow 1 for channel 1 (Mono Descriptors to Lo Pri Acc.) */
config_rx_flow(QMSS_PKTDMA_RX_FLOW_REGION, 1,
0x080c0020, 0, 0, 0x20012001, 0, 0, 0, 0);
Last, enable the RX and TX channels that have been configured.
/* Enable the Tx and Rx channels */
enable_tx_chan(QMSS_PKTDMA_TX_CHAN_REGION, 0, 0x80000000);
enable_tx_chan(QMSS_PKTDMA_TX_CHAN_REGION, 1, 0x80000000);
enable_rx_chan(QMSS_PKTDMA_RX_CHAN_REGION, 0, 0x80000000);
enable_rx_chan(QMSS_PKTDMA_RX_CHAN_REGION, 1, 0x80000000);