|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x2 `, ~" ~: E
- [code]EDMA sample test application
" G4 K6 {2 @2 |( Y$ Y - /* c! U2 F8 \- B
- * edma_test.c
; l9 ^2 f9 }7 ?) C - *
$ w) H: J; S7 ]( F! u - * brief EDMA3 Test Application/ I2 | _0 k6 N/ u2 y
- *
4 ?7 U$ s1 @2 b/ r$ p+ u - * This file contains EDMA3 Test code.
) o" M& u G; q: w d! A- H4 X - *5 `& R$ _, h' g. E! I/ ~( n2 K3 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. ~' T/ f) E( @1 p6 _1 m6 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 c3 W6 ~/ Q. p" z: ^! g2 @
- * TO CHANGE.
! x- l' R, M4 l9 h7 W - *+ `* a J( T7 Q1 N$ k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- J- b d3 c6 {/ F0 t
- *& c+ z/ h/ h+ l* I
- * This program is free software; you can redistribute it and/or
* R3 y) P+ L. \ - * modify it under the terms of the GNU General Public License as
! g! {0 v# B# u- q5 t, Z - * published by the Free Software Foundation version 2.0 ?3 ?9 \! S) f! E: b* L# S9 u
- *1 Y4 K) |, g) I* j/ g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ }* j! h! W. l6 Q7 a* B5 s" U
- * kind, whether express or implied; without even the implied warranty
* |# h9 D( Q2 y ?6 u4 {: Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& e2 J6 L3 p- [0 S7 T2 j' v$ U, ? - * GNU General Public License for more details.) A2 ^, D6 {, a) L) y8 f
- */
$ }, k) a4 ~& m) G4 e* U: ? - . O2 q& l8 o- L/ b# l3 [
- #include <linux/module.h>
& s9 o7 O9 I. G; V& R% @, L* ?5 U - #include <linux/init.h>( X' F* G/ p6 A7 h) G
- #include <linux/errno.h>( F8 K5 v; w9 |* N. I$ m1 D
- #include <linux/types.h>
( M2 T* Y0 r& @( f. n2 f8 @ - #include <linux/interrupt.h>* r9 p* ?9 A% c% s
- #include <asm/io.h>
8 ]% {% u, B3 {6 `/ G+ T" f - #include <linux/moduleparam.h>8 r$ z3 g* I2 l) J; D& ? T
- #include <linux/sysctl.h>
% o$ y# Q$ n' l/ i' W+ v - #include <linux/mm.h>
$ n* m) _) |7 C - #include <linux/dma-mapping.h>
; x* r% g/ g+ k. ] - 6 l- i; y; g( ?& |5 M
- #include <mach/memory.h>1 l+ U0 U5 `. o/ ~6 y8 ~
- #include <mach/hardware.h> ?. B6 A1 e, e+ r5 S
- #include <mach/irqs.h>
* |+ s0 Y$ j* h2 P - #include <asm/hardware/edma.h>
* u; S3 D6 j2 }9 k& z8 }6 r; ^, y8 n
1 a- k/ l* X5 n7 b- #undef EDMA3_DEBUG
2 t( m- R7 L) A7 N# I- r6 |( ~. a) O/ w - /*#define EDMA3_DEBUG*/: X& R7 p' O) a+ [: T. O
/ H# K" K, _2 W' |5 t+ C- j# j- A" Y- #ifdef EDMA3_DEBUG
7 w6 R/ J5 J6 p; l5 C2 A/ K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& B& _9 d9 V8 z M+ q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 q" I7 m% y4 D- z, u- f, [- a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 f# f9 R* g, k, g7 O - #else- `: h6 a7 O* A/ C8 a
- #define DMA_PRINTK( x... ): h, `' i2 ]8 V3 Y' s4 _
- #define DMA_FN_IN7 n' }" N8 m: k+ y4 @
- #define DMA_FN_OUT! U; l; L# M* o2 q
- #endif% v# d6 C N& S+ }$ L; U+ l
4 O. o! g; h2 u- L, t0 A+ k( g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) b% C2 n8 V% Y/ r; m6 p
- #define STATIC_SHIFT 3
7 [ R# V, {& I2 b! o3 N. A) y - #define TCINTEN_SHIFT 20( P Y3 F% h% ~/ I8 h. N& I5 k
- #define ITCINTEN_SHIFT 216 f$ b' F" ` N* s6 W. }9 F
- #define TCCHEN_SHIFT 22
+ f0 `. {1 `* |5 F8 Z. g* R - #define ITCCHEN_SHIFT 23% `) w& y6 s' i# Q
- * o) N4 U) q, r% Z3 j
- static volatile int irqraised1 = 0;' m2 N W& _, Z9 J- I
- static volatile int irqraised2 = 0;; B- a' W: I6 f g2 u
- ( z1 h& ?- p( V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" F; z* _+ F @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Z1 ]' a$ F9 f3 ]# C9 k) a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ]8 O# R- {( K2 W& x- W1 U; H/ J
3 p: n7 O9 }8 f3 J0 @5 U- f7 m- dma_addr_t dmaphyssrc1 = 0;, H0 A( Q% B3 s; Z x$ a; _) |8 ]
- dma_addr_t dmaphyssrc2 = 0;
2 b4 k+ s$ }' h; H - dma_addr_t dmaphysdest1 = 0;
# H' E! |/ l0 Z% c; n - dma_addr_t dmaphysdest2 = 0;
1 T1 _0 q( |8 W) F9 s; [7 i - . ^6 s& n! o7 z5 g6 A6 F1 g# ]
- char *dmabufsrc1 = NULL;
# b% ]( y4 E( |8 O2 K- n4 ^' F - char *dmabufsrc2 = NULL;
" ?- _6 @! ~6 `) l - char *dmabufdest1 = NULL;
1 g$ f: X* G. x# j9 B7 U/ T - char *dmabufdest2 = NULL;' j/ n+ Z/ {' ^* r; T" r
& v, V; f9 K, {1 a/ I- static int acnt = 512;
9 O' C7 r( k$ P% x5 z! P& _+ _ Y - static int bcnt = 8;2 V) G* m a* C! }1 E( D7 ^
- static int ccnt = 8;
: j3 a1 A, p! B" Z6 z4 p. J4 i - ' ~+ X" r9 C+ X2 O2 R* M d( M8 k
- module_param(acnt, int, S_IRUGO);
! X I4 X- F. c& Q, H - module_param(bcnt, int, S_IRUGO);
. F! k0 K4 K/ ^1 N( ]% J1 v - module_param(ccnt, int, S_IRUGO);
复制代码
" R7 R2 H3 ?4 J0 \3 ?2 M; f. ~8 }0 D( d' J8 t2 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C9 H# C( ~% m) x! _. R! Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% a( D6 k" x6 B2 W- E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! r2 b$ s1 |1 ?# W. s
b. ~# T1 @9 k6 j1 C" H. m
$ f N" a- L E0 u5 R6 a |
|