|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 \# y, Z4 @' G8 f- [code]EDMA sample test application* s- H- Y) Z2 t8 i$ |# i" T/ `1 t9 V
- /*& ]) P8 M0 W' m; E
- * edma_test.c9 N7 Y/ s8 I9 S3 L3 a
- *
( X! s0 Z3 c# o( V6 s - * brief EDMA3 Test Application
+ {, e) q5 i) s* ~1 K# R3 M: J - *
7 z: v! A8 y3 B% b- h - * This file contains EDMA3 Test code.
" q2 f& ]+ U. L! }" M - *
# N/ l0 A$ ^- Z0 d* c6 g/ J7 O- ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 \! W" W M7 P1 O' b; ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ E8 P# _% F0 @1 m% @8 ] t# c - * TO CHANGE. d" z* w; L9 X" c m4 x! \
- *& @- R. n M2 }+ r" E( z7 @# ~3 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; _& y$ T5 I" g! H( U! ]( S
- *
* u/ h0 \- c4 N- T( Q - * This program is free software; you can redistribute it and/or! b0 @" o$ i) ], a9 Y! e. A8 y
- * modify it under the terms of the GNU General Public License as
9 t5 |+ N% C& D( D) ` - * published by the Free Software Foundation version 2.2 Y6 S1 D7 p# ~+ e6 [! R- N! z
- *3 s# B* D! o1 v: f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 s7 O* i+ |1 v$ b - * kind, whether express or implied; without even the implied warranty
, R4 {; G0 [2 q2 _$ H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, z3 H) d- I, ]0 | - * GNU General Public License for more details.7 y0 E7 j* ^' C" B" P& J/ J
- */
. i) P% k9 j1 |' g4 g - . J+ l6 h3 n. J: O
- #include <linux/module.h>
! j v) P Y' F! Q/ q - #include <linux/init.h>* b* j% c. Q- j1 V
- #include <linux/errno.h>
/ w" ^. K: _- q# O3 v( R - #include <linux/types.h>
! v3 a, r, F& V& l& a, L2 W - #include <linux/interrupt.h>' }6 P$ X. y( J& X) N
- #include <asm/io.h>
( c) l% i1 M- g - #include <linux/moduleparam.h>6 G+ u7 w4 R% t8 D f
- #include <linux/sysctl.h>
4 U1 { f8 r! i: l) i. l% o - #include <linux/mm.h>
2 n/ R! {! s S# B; V - #include <linux/dma-mapping.h>! D: s+ K2 ^: W, ^# f# b
- : u/ q# E# h" v8 m
- #include <mach/memory.h>
- T# p% N7 m8 [1 [. w8 O - #include <mach/hardware.h>8 r! ^1 E/ H* _1 O6 f3 Z
- #include <mach/irqs.h>
- A+ c! l9 _. \+ {( ]2 l - #include <asm/hardware/edma.h>: \# K4 g, m; F0 Y$ Y2 ^
m- } B9 u& r& [, L, z- #undef EDMA3_DEBUG4 c% E; M, r# p+ ]! S+ b
- /*#define EDMA3_DEBUG*/
& g/ S4 ~) t) B3 ~3 r: i3 D3 _
/ x/ g! O: E! ^( c5 O- #ifdef EDMA3_DEBUG
4 I* h- K4 U1 ~* }% j! S( x( l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 v. o! S- U1 E) V# s9 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( t1 G3 h+ m$ m% i! a/ w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 {. k- {' j( U5 v7 z* C
- #else+ l* ?) H. ]7 ~
- #define DMA_PRINTK( x... )" H8 ~9 j3 f$ P
- #define DMA_FN_IN
) c# [4 H3 l# o7 e" i+ f2 x* v - #define DMA_FN_OUT
. w& Q- @9 H- c& ^ - #endif
9 q9 [2 J* u" v4 A( ~+ h7 x( d& h/ `
9 @7 @- {/ K7 w" Z( ^- \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* X1 E) Z& O1 S% E% N - #define STATIC_SHIFT 33 l% Q8 I$ P9 D$ Q* e* A
- #define TCINTEN_SHIFT 20! \1 J* w9 E; g( k8 h$ t7 H
- #define ITCINTEN_SHIFT 218 }! H7 Z+ ~# l1 I: H$ \1 P
- #define TCCHEN_SHIFT 22
, H9 H- X. n" _* K* O - #define ITCCHEN_SHIFT 23* z% m% x/ @- P2 L# G* F( ~
$ ~4 F/ V$ Q. x; d) P9 c: E& ^- static volatile int irqraised1 = 0;! \& O* y7 R' n, G0 q4 W9 d
- static volatile int irqraised2 = 0;0 o) _& e2 l1 m5 Y4 p
- 2 t3 u3 b- L( a) @" y& x, Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 a4 U. B( G% y7 z: Q: I3 S" O5 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o" F7 l3 Q, f0 P7 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) m7 p h6 F6 F3 [' f! _
* z. r- J* v) q' V) M8 U# T- dma_addr_t dmaphyssrc1 = 0;! c6 W( `% r3 S0 [' |8 r( L
- dma_addr_t dmaphyssrc2 = 0;6 Z H$ N [8 D! m& Y' m9 Z# l
- dma_addr_t dmaphysdest1 = 0;
, M% o# f A! A3 ] - dma_addr_t dmaphysdest2 = 0;
7 _& `9 k* ]& h, t7 M - 1 @/ o, P4 r, L
- char *dmabufsrc1 = NULL;7 P0 ^5 r; d- |. G
- char *dmabufsrc2 = NULL;
! q& D; y" b$ ~' d9 d; y5 M% W - char *dmabufdest1 = NULL;! H; c1 v/ y0 R# H% B
- char *dmabufdest2 = NULL;
. |4 h) c# M3 e) H! j- r# N
?9 Y9 w7 S8 y1 v/ e) E2 e+ ~# l- static int acnt = 512;
$ R2 f# e) m! ^4 l( D1 { - static int bcnt = 8;, @0 B' k1 _. P0 T5 D- J9 |, N5 b
- static int ccnt = 8;
1 H) x& L9 S e3 V* s+ X+ u# X! J$ c - 2 i9 {3 [5 U# U2 W; _6 H3 {
- module_param(acnt, int, S_IRUGO);
) F* u* X6 x9 V& B& G1 i - module_param(bcnt, int, S_IRUGO);) h) l' v( V% \5 F7 L- I: K
- module_param(ccnt, int, S_IRUGO);
复制代码
! ], J3 G$ G0 \0 j% A& H; Z/ ^; s' F% @7 F% E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o8 q' t$ t& J) i7 k) j+ e1 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S N' V9 \9 m2 \; Y% ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, K( v2 U8 q) y- `+ n
, ^" w4 n% d! G2 l+ `+ o0 E9 q6 P& _. D1 K
|
|