|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) u$ o0 H8 b( T) v! |: g, s
- [code]EDMA sample test application
4 x3 A# j0 T5 {" P* Q8 X2 A - /*
1 ?& t, t% t6 | - * edma_test.c, p% [ y4 A+ @/ w& c7 T: {
- *' |) {, \' S ^1 T! ]% J4 x
- * brief EDMA3 Test Application
' X& ?5 n1 L! w1 T& B - *
* v4 |' U) ]3 m( X+ s0 R" Y% | - * This file contains EDMA3 Test code. h. I) s$ g9 F* D; Z
- *! m+ D3 r. x2 [1 v- G# L9 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, J; b- G. |: s2 j. |7 S2 Y6 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ W, E, s# n+ P
- * TO CHANGE.8 F, p) ~ v: l9 H( c. w7 ^
- *
$ \# l: \2 T5 Q, Q$ [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& B( E6 M( n& I# t2 S8 c" s$ H - *
2 s/ w& X2 ~; z; S9 o - * This program is free software; you can redistribute it and/or1 U* i- ~6 h$ J9 P8 P* w* ]5 c- M7 A
- * modify it under the terms of the GNU General Public License as, F! N# L* I! `0 y+ Y( w
- * published by the Free Software Foundation version 2.$ u$ _' t/ j) M8 u( x4 x/ E( w
- * t- N: Y* X4 [5 l3 p& @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 ~% q( D% [& t; t! x: o, t0 b7 p - * kind, whether express or implied; without even the implied warranty5 v& n C# W/ a- L# R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ c# V- n* O/ M! p - * GNU General Public License for more details.) Q- j" q# X, c9 _2 O
- */
1 n8 w% [7 O8 ^% B9 L0 ^6 O - 3 U$ Z% s. E8 h, {, A
- #include <linux/module.h>8 A8 B* H; ~2 Z) E3 |
- #include <linux/init.h>) U7 O0 E" l% i2 _$ R4 b
- #include <linux/errno.h>- v' G( ?: u4 T$ _& s+ A% P1 p. b
- #include <linux/types.h>5 p3 }, ?( z! \: a3 I
- #include <linux/interrupt.h>5 o+ Q! ?) T# A" i* G
- #include <asm/io.h>+ b: m6 a+ z( g' |2 N+ r
- #include <linux/moduleparam.h># n2 u# e% F9 u0 w ]
- #include <linux/sysctl.h>
& F) ?9 p8 E8 [4 I# @ L - #include <linux/mm.h>, V0 w6 Y" G0 p! P7 {
- #include <linux/dma-mapping.h>+ H9 [( C0 q l+ H& M0 H% I# u
- / S) h$ q1 }; C. _2 e2 c
- #include <mach/memory.h>
# q! x( j/ H8 f1 D' o - #include <mach/hardware.h>
& c0 |( Q* Z% Z - #include <mach/irqs.h>
/ w; ~$ Y- \; D1 F% Q - #include <asm/hardware/edma.h>
' b* X3 H8 I* ^ - ; e' n! |( Y( @& [
- #undef EDMA3_DEBUG
: ^ f; T4 g+ V d* d% u - /*#define EDMA3_DEBUG*/* c- ^0 [! K0 ? i# N7 v
4 e4 a9 S/ e3 e1 }' X7 U- #ifdef EDMA3_DEBUG, q) O( d, e, v+ r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ?- ?# L* m( n5 k, N! e! x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 C+ H! A& L. i3 ^/ {' A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ O! K n+ R6 J9 F K! S3 i - #else: i7 A: j. k; |6 z( B3 J; m
- #define DMA_PRINTK( x... )
0 o# V1 A# Y' _+ j: B) N* v: _ - #define DMA_FN_IN8 c1 S. o1 W/ S1 o( h7 n! Q1 E. ?6 M
- #define DMA_FN_OUT
6 i5 q( H6 }. w! F: ^) Q/ Q! o - #endif
0 n4 y0 x6 w- I, u* M7 x1 B - ( v% w, G; S; k% G6 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): }7 u$ ]7 |7 d+ j) M/ ~2 G' j0 t
- #define STATIC_SHIFT 3' D V1 r1 x n
- #define TCINTEN_SHIFT 20
! c6 k, R, V7 L# v - #define ITCINTEN_SHIFT 21
6 r* r2 W; N# e: @1 l - #define TCCHEN_SHIFT 22- H2 ]1 Y3 Z, E3 r1 c
- #define ITCCHEN_SHIFT 23( q8 {! T' R. {+ [5 [' n) F
- " q5 G$ m0 N, A; Y9 N
- static volatile int irqraised1 = 0;( ?8 ~ L4 P: I/ ~+ Y: z/ V
- static volatile int irqraised2 = 0;) _* e$ Q3 f9 Z C! p
- 2 N6 k$ l& A4 j7 o, v) I( {6 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N+ S4 ?3 o* k$ ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e$ V0 f, d8 O/ e* E5 v, ~0 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ~( U$ V/ p9 F" m4 y
# m5 \, o }) n7 T" F7 ]. P! `- dma_addr_t dmaphyssrc1 = 0;$ }6 v% g3 s6 f O$ c
- dma_addr_t dmaphyssrc2 = 0;9 G3 r/ h. X4 t* }4 t" s4 R- H( A
- dma_addr_t dmaphysdest1 = 0;
( n+ N( a1 S) |8 x - dma_addr_t dmaphysdest2 = 0;; M8 Y- F" Q, a" ?$ H
7 q, r( Q3 i' Z# K6 o+ T8 |) F- char *dmabufsrc1 = NULL;4 Y4 V3 R% G) n; c2 O
- char *dmabufsrc2 = NULL;
1 J1 C: H% F9 M( o8 h - char *dmabufdest1 = NULL;! ?& \: E+ O' H+ ]
- char *dmabufdest2 = NULL;, u/ U* m) f9 X/ Z4 ^0 ~3 ?
- ; Q; ~5 S X0 E6 T: w6 j/ E; C
- static int acnt = 512;
6 V# S- m* N* L+ h+ J- C% `4 \* r - static int bcnt = 8;
6 i4 N: l1 `, @& }8 Q+ o - static int ccnt = 8;. B5 ]5 N' A1 b2 M: M4 K; l
- + { E2 o q' i
- module_param(acnt, int, S_IRUGO);
. l* b# Q! _) P y) F; E. u# J; L0 k - module_param(bcnt, int, S_IRUGO);1 ?" }: M) e0 G
- module_param(ccnt, int, S_IRUGO);
复制代码
5 u3 {& W% |6 N/ [5 R7 M) I$ A# [6 g" r: b1 Y' ]- [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ `% s/ x5 U9 A: G/ ]; A" q' u5 iarm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# T3 W) A5 i, ~ R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 B* ^- [! y/ A8 r R6 l
^& u$ p$ K, s# q e- b% f$ n6 ~/ {0 w& d! R) S
|
|