On the Edma of TI DSP

Source: Internet
Author: User
A few days to tune down, always feel TI's document vague. But to think about it, the 250-page document was written to the depressed. And a person who understands it is always natural to skip over some of the key things that seem to be important to beginners.
The problem of these days is that EDMA can work, but cannot continuously turn up. The problem is that the document is not read clearly.
Document (SPRU234, below) in the first section of the first chapter, figure 1-2 gives the EDMA control block diagram. Now it is true that the control block diagram reminds of the actual workflow, but it seems that the document does not explain the EDMA workflow.
In EDMA work, a total of two parameter tables were used, one of which was maintained by the EDMA controller, and the other was maintained by the user. The parameter table rules maintained by the EDMA controller are arranged at the beginning of the entire parameter table, one channel, and no number of people. The user-maintained parameter table is called the Reload channel parameters, and is distributed randomly in the second half of the entire parameter table. Now it seems that the EDMA controller is a good way to understand how EDMA works by using two parameter tables.
Non-sequential work:
The EDMA can work in a continuous and discontinuous state. When data is discontinuous, a single discontinuous working state can be used. At this point, the user initializes the parameter table that is maintained by EDMA directly at initialization time. As in the following example:
*edmahandle = Edma_open (eventId, Edma_open_reset);
if (*edmahandle = = EDMA_HINV)
Test_exit (FAIL);
/* Allocate TCC for Y event */
if (TCC = Edma_intalloc (-1)) = = =-1)
Test_exit (FAIL);
/* Configure EDMA Parameters */
Edma_configargs (
*edmahandle,
EDMA_OPT_RMK (
Edma_opt_pri_medium,/* MEDIUM priority */
Edma_opt_esize_32bit,/* Element size + bits */
Edma_opt_2ds_no,/* 1-dimensional source (FIFO) */
Edma_opt_sum_none,/* Fixed src address mode (FIFO) */
Edma_opt_2dd_yes,/* 2-dimensional destination */
Edma_opt_dum_inc,/* Destination increment */
Edma_opt_tcint_yes,/* Enable transfer Complete */
/* Indication */
Edma_opt_tcc_of (TCC & 0xF),
Edma_opt_tccm_of ((TCC & 0x30) >> 4),
Edma_opt_atcint_no,/* Disable Alternate Transfer */
/* Complete Interrupt */
Edma_opt_atcc_of (0),
Edma_opt_pdts_disable,/* DISABLE PDT (Peripheral device */
/* transfer) mode for source */
Edma_opt_pdtd_disable,/* DISABLE PDT mode for dest */
Edma_opt_link_no,/* Enable linking */
edma_opt_fs_no/* No=array Yes=block Synchronization * *
),
EDMA_SRC_RMK (SRCADDR),
EDMA_CNT_RMK (edma_cnt_frmcnt_of (frameCount-1)),
Edma_cnt_elecnt_of (Elementcount)),
EDMA_DST_RMK (DSTADDR),
EDMA_IDX_RMK (Edma_idx_frmidx_of ((Elementcount * 4)),
Edma_idx_eleidx_of (0)),/* note:32-bit element Size */
/* No RLD in 2D and no linking */
EDMA_RLD_RMK (Edma_rld_elerld_of (Elementcount), edma_rld_link_of (0))
);
Here, the link parameter is ignored, which can be seen in the example given by Ti (52-page start). These parameters seem simple compared to many DMA controllers, and TI's is very detailed.
Continuous mode of operation:
The discontinuous way of working is very well understood, TI is also very detailed, and TI in the story of continuous working style is a stroke. And the discontinuous way is that the user needs to initialize two tables, only one of them is maintained, and the other is automatically maintained by the EDMA controller. The table maintained by EDMA is used during EDMA work, while the user-maintained table is overloaded when EDMA starts a new job.
The user must first initialize the parameter table for the EDMA channel in the initialization phase, then request an idle parameter table in the second half of the parameter table and initialize it. As shown in the example in document 1.16.4.3, where 62 pages are examples of the parameter table for the channel, the 63-page example is a parameter table that requires overloading.
EDMA after accepting such a parameter table, first determine whether to achieve the DMA completion condition (refer to TI document), if not completed, start to subtract the elecnt from the parameter table, reduce to zero frmcnt minus one, and then overload elecnt from the Elerld parameter, start a new frame. Cycle. When FRMCNT is also lost, reload the parameter from the overloaded table to start a new round of work. The user can set the overloaded parameters to begin different work, depending on the work required before the EDMA controller overloads the parameters.
The following example is a sample of three tables given by TI in the example, according to which the user can even use 4 tables or more, with a maximum of 22 tables (C64X) in a single channel. Multi-channel can use the n+21 sheet.
/* First request the channel corresponding parameter table */
HEDMA = Edma_open (Edma_cha_tint1, Edma_open_reset);
/* Then apply for two parameter tables for ping-pong mode */
hedmaping = edma_alloctable (-1);
Hedmapong = edma_alloctable (-1);
/* Make the parameter table maintained by EDMA the same parameters as Ping */
CFGEDMA = cfgedmaping;

/* Initialize the overloaded list, note that the list maintained by EDMA points to Pong, and the ping, pong tables point to themselves, so EDMA first works in ping mode (because its parameters are the same as ping) and then works in Pong mode */
Cfgedmaping.rld = EDMA_RLD_RMK (0,hedmaping);
Cfgedmapong.rld = EDMA_RLD_RMK (0,hedmapong);
Cfgedma.rld = EDMA_RLD_RMK (0,hedmapong); /* Configuration Parameters */
Edma_config (HEDMA, &CFGEDMA);
Edma_config (hedmaping, &cfgedmaping);
Edma_config (Hedmapong, &cfgedmapong); The following are the parameters for ping and pong:
Edma_config cfgedmaping = {
EDMA_OPT_RMK (
Edma_opt_pri_low,
Edma_opt_esize_32bit,
Edma_opt_2ds_no,
Edma_opt_sum_none,
Edma_opt_2dd_no,
Edma_opt_dum_inc,
Edma_opt_tcint_yes,
Edma_opt_tcc_of (Tccintnum),
Edma_opt_tccm_of (0),
Edma_opt_atcint_no,
Edma_opt_atcc_of (0),
Edma_opt_pdts_default,
Edma_opt_pdtd_default,
Edma_opt_link_yes,
Edma_opt_fs_no
),
Edma_src_of (&ping_data),
Edma_cnt_of (BUFF_SZ),
Edma_dst_of (ping),
Edma_idx_of (0x00000004),
Edma_rld_of (0x00000000)
}; /* Create The EDMA configuration structure for pong transfers */
Edma_config Cfgedmapong = {
EDMA_OPT_RMK (
Edma_opt_pri_low,
Edma_opt_esize_32bit,
Edma_opt_2ds_no,
Edma_opt_sum_none,
Edma_opt_2dd_no,
Edma_opt_dum_inc,
Edma_opt_tcint_yes,
Edma_opt_tcc_of (Tccintnum),
Edma_opt_tccm_of (0),
Edma_opt_atcint_no,
Edma_opt_atcc_of (0),
Edma_opt_pdts_default,
Edma_opt_pdtd_default,
Edma_opt_link_yes,
Edma_opt_fs_no
),
Edma_src_of (&pong_data),
Edma_cnt_of (BUFF_SZ),
Edma_dst_of (Pong),
Edma_idx_of (0x00000004),
Edma_rld_of (0x00000000)
};
     Such a way is like a sports track field, athletes from the tap into, and then a lap of continuous running. Using this approach seems to be a good way to avoid memory access violations, and I tried to modify the table entries that EDMA automatically maintained during debugging, causing a bad memory access error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.