|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ?7 r* b- M$ j: r4 z, B/ q- [code]EDMA sample test application ]2 T8 `) m# A" C4 {6 t
- /*
% z6 i- ^" l. Z% d% h/ I/ ] - * edma_test.c0 H5 U5 a& \- C8 n7 {8 ?; j
- *
0 K) X- J: R; ?7 s) P* ?+ w - * brief EDMA3 Test Application
5 |3 D9 m7 O! ? |- t& S# y% W& A1 g - *
8 l' R1 s+ H. p - * This file contains EDMA3 Test code.
# O: S6 Z9 o" Z$ K+ k6 h5 `1 Q/ c: I - *
7 w' v9 Z2 o1 I" S, c+ B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) K$ W5 ]0 U% s( \. Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 t7 s1 u [8 v7 Z6 {$ U* c
- * TO CHANGE.6 R" K" p+ |5 p2 `8 O1 d4 a
- *
1 _3 c% k+ v7 ~3 _% K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% O7 @+ w. D& J3 f - *
! m+ d( F8 C! G* E E g8 p( O! m. G - * This program is free software; you can redistribute it and/or
" @4 N$ V& B# G$ {" [ - * modify it under the terms of the GNU General Public License as- r! B% U5 M) B/ ]! q
- * published by the Free Software Foundation version 2.; t9 F+ a( F6 G# k. @
- *" e& w# I5 {/ e, f3 t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% U0 X9 R& n) G: z: a b7 R - * kind, whether express or implied; without even the implied warranty
- U4 A% j4 M6 m' {' z5 \. A2 g9 v7 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 C- D2 b1 p" \
- * GNU General Public License for more details.
- k' D2 }; q o+ I6 c9 E" [+ ?5 m - */
9 W6 }* R$ T! f9 E0 q% }) ]2 L$ i' O
- H7 L1 C. X" s+ E3 F0 l8 Y: q- #include <linux/module.h>
/ Q0 `1 O( A: u8 o& l. f9 D - #include <linux/init.h>
8 `# |/ U% H4 k - #include <linux/errno.h>
+ \# b; ]6 I; z, j9 M* Q* d - #include <linux/types.h>
, C% G, O/ v- k - #include <linux/interrupt.h>
+ R. P; x$ X- k& N; ~: g J - #include <asm/io.h>* O9 u6 q6 g% U4 g
- #include <linux/moduleparam.h>
" \) }: y* l% [$ N3 c - #include <linux/sysctl.h>
1 d. ]4 w6 o# p; D$ a. E7 R - #include <linux/mm.h>) ~2 |* g/ C& q& q6 F Z. @2 l
- #include <linux/dma-mapping.h>. y0 I$ g3 c, V! Y
- + S+ p. Z% L: @9 R4 _6 F% f
- #include <mach/memory.h>+ W- z% E0 c) y. _
- #include <mach/hardware.h>
2 r. r* i, x* y! h+ k, f, a9 X - #include <mach/irqs.h>- O( Q# I9 r5 h* U& B& E
- #include <asm/hardware/edma.h>& D6 N8 I2 C4 j9 W
T+ W* z/ K6 A9 M) D' t, y+ v" w- #undef EDMA3_DEBUG
6 H% U# H% N: m- E3 M! m: n - /*#define EDMA3_DEBUG*/7 i' U1 i2 {+ F8 Q- ?
+ d$ h$ v0 l6 X1 } r- #ifdef EDMA3_DEBUG
+ P% m7 X* c) E9 D3 l" g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 e& I5 o- u% p# X6 S5 M* ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! w( I* A# e: I& X" n# E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) {" s1 m9 n% B/ _. Z7 T
- #else+ A* t& I1 q9 J# ?
- #define DMA_PRINTK( x... )( p$ Z6 D6 k4 x& X8 _
- #define DMA_FN_IN' C6 d1 p4 w: X$ q/ Z
- #define DMA_FN_OUT
1 Q+ B: y2 A9 C: O3 w3 c, ?# G - #endif
1 k# C/ Y$ R. J5 l6 b
$ x- A8 { R$ g. z" Y+ a+ K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- |) b! h2 t' a+ \/ \+ T& j, X8 q
- #define STATIC_SHIFT 3
2 C( \" w2 ~7 D3 G0 _/ f" ^4 z8 V - #define TCINTEN_SHIFT 20. g/ E$ A! Z: A J* ]* G
- #define ITCINTEN_SHIFT 21
4 X& ~" |1 P) P: m$ C: d* N - #define TCCHEN_SHIFT 224 S* L1 s3 y g5 {( ]* V ^7 Z
- #define ITCCHEN_SHIFT 23
* d8 V% o4 F; E0 ? `( C0 J
5 ?4 @: v: I* m- static volatile int irqraised1 = 0;1 N8 a/ Q' B k. M" ?
- static volatile int irqraised2 = 0;
- J4 E' A: N' L# x, q. A
; H) X/ w4 Q9 a2 B! X( \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Y8 o* u# q, ^" S* T. u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r7 t& H1 x) n5 \5 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N5 m. Y! V, s7 Y
* `, s" z; R( Y( ]4 d; B- D& V- dma_addr_t dmaphyssrc1 = 0;
& w8 W! |5 P; U1 t* t - dma_addr_t dmaphyssrc2 = 0;+ z1 f/ |% C: y7 h4 l' b
- dma_addr_t dmaphysdest1 = 0;1 E9 ^ G' U' S3 M
- dma_addr_t dmaphysdest2 = 0;
+ U j' \, U. |& p. \- i2 W - {5 N. s6 n( C# i4 n2 W" w+ ]
- char *dmabufsrc1 = NULL;5 V# I2 P- S) q+ ]/ K, [4 n
- char *dmabufsrc2 = NULL;
/ I; R" q2 H& D* d, r% {) Z' r/ O - char *dmabufdest1 = NULL;9 s0 Y( N8 B$ O4 w1 Z& n C. {7 v
- char *dmabufdest2 = NULL;7 c& O# [8 c" e1 B n
+ {" J- ^) p y7 X9 r- static int acnt = 512;/ w$ U; o, ]- G* j# f
- static int bcnt = 8;. p" m3 }1 k0 K2 Z7 Z* k
- static int ccnt = 8;" k+ E& Y5 X$ n0 K( C$ E
- 3 m9 p0 }+ g+ b8 F
- module_param(acnt, int, S_IRUGO);
! f' u" w+ c& K: j - module_param(bcnt, int, S_IRUGO);
A* j$ h9 `, e" y- @# M* [ - module_param(ccnt, int, S_IRUGO);
复制代码
9 A3 e# l1 \$ [; B# ~1 \
/ o! y7 c6 D. H* T3 f0 n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 f6 X5 W' F" Y% O. ]7 Z% e
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- \# J7 T' ?2 X( z' @( J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, U0 w# \ P( X
D2 b+ u$ Y1 W( @9 l
- d3 B3 Q5 ]: P( Y( p |
|