|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ~8 T5 i/ N, j& A: D- [code]EDMA sample test application
; a- S: P/ w9 ~/ ] - /*/ f/ i- o1 T) l8 s, x
- * edma_test.c% \4 J) M! k7 [6 w* F u
- *
& ^8 Q" ]0 y3 M6 ] - * brief EDMA3 Test Application
9 q3 v e5 q% ?/ B5 d. j5 V ~ - *
$ W. n7 e+ q; P - * This file contains EDMA3 Test code.1 n9 q7 l- V. N- V
- */ w6 r/ ^3 ^* l3 B2 Y2 o' u# F) B7 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- t) X1 q! \% Y( H) J8 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ X" U" y; f+ {; f0 r
- * TO CHANGE./ i4 x4 B$ Y4 G5 h
- *
: ^/ J( ^) Z: p, X& ]' ~# }' p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) i3 E( V/ e# {6 U' n5 @
- *1 [4 K3 m8 ?/ @! w
- * This program is free software; you can redistribute it and/or+ S3 e% n1 F7 m' H; b s4 E: v& N' q
- * modify it under the terms of the GNU General Public License as6 [+ i, ~ m+ H' m: w
- * published by the Free Software Foundation version 2.
( Z; e' j# o7 W: B5 T! G; i - *2 v. I: Q, H% p' n ?5 f) B6 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" ]+ a; y) P" {3 b - * kind, whether express or implied; without even the implied warranty. G4 p* y2 r1 }& K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( a5 A) j7 U6 h- }2 \ - * GNU General Public License for more details.
: ^' P T" ], B/ j3 e T6 b - */
; h# |+ ~8 h/ g) v0 L7 X
4 f1 ?8 V8 H& _7 ~; F1 _- #include <linux/module.h>+ h$ l: R1 x) N5 a9 g$ w% O: E! ]/ W
- #include <linux/init.h>
2 p! A) G7 D. R4 S, Z - #include <linux/errno.h>$ F* A6 x b3 {$ }1 ]2 l1 [
- #include <linux/types.h>$ O Y+ a. E& i5 ?- W" j
- #include <linux/interrupt.h>$ s! D4 N5 `, N( W% p
- #include <asm/io.h>
$ @. h7 |1 \! X( b% r* s2 c - #include <linux/moduleparam.h>: n5 m! T5 J7 L `6 C6 a
- #include <linux/sysctl.h>
; n* B, C5 W k0 m - #include <linux/mm.h>& l2 C: y3 _# G6 o
- #include <linux/dma-mapping.h>; L! o( G0 |/ ?* C/ E
- 1 ~5 ]$ z+ \$ n5 s3 F: h1 S
- #include <mach/memory.h>2 h% J$ \3 |6 M$ o
- #include <mach/hardware.h>
1 R- |. L7 \9 r+ P0 Z; k8 s. w) v - #include <mach/irqs.h>
% e+ l8 t& S4 V - #include <asm/hardware/edma.h>
% E5 n4 H# p: t" ?; f* S - # `: F8 w T8 ? Z0 D! ?. W
- #undef EDMA3_DEBUG( @' S( R) @1 ?% O
- /*#define EDMA3_DEBUG*/
3 O/ N0 R5 m6 C# T - 0 N3 q) X5 U8 T+ i( m
- #ifdef EDMA3_DEBUG$ A4 a+ U: h0 c8 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# L% y% `; W; | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 R, r; `" r4 L% f5 Z. V6 R4 ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 W+ ` X3 a* [ - #else
& s4 j, A( U2 ^3 C- `! w4 _" ~ - #define DMA_PRINTK( x... )
' ~; `7 N5 T1 d - #define DMA_FN_IN. u+ t! }+ z) i% Z7 V" d3 o3 [5 e
- #define DMA_FN_OUT% A7 y/ o- A4 O
- #endif5 M3 R- Z8 e6 E$ N6 I6 \
" w1 x+ P$ g/ a. L7 G! j& x# [! b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 ~: Z0 o- N+ }) _% k+ n - #define STATIC_SHIFT 3
! T" @; }. W: B/ n5 r7 R W - #define TCINTEN_SHIFT 20
' ^( U, J3 z7 f B, l& w - #define ITCINTEN_SHIFT 21
" ]6 W2 T: [8 [# r) T - #define TCCHEN_SHIFT 22$ R, e( m9 g# ^6 G& Q
- #define ITCCHEN_SHIFT 23
4 R5 x- N& o. b - 6 T- N7 ?$ n2 w
- static volatile int irqraised1 = 0;
8 d7 \: [8 a# A; u. O - static volatile int irqraised2 = 0;
5 |- W" s0 t& t6 t/ |
( R$ e G) w* f: |% V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% U; D. r( R, d5 B# f( v) ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u0 j8 x% F7 I6 \9 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ]( F0 K. v( I) j8 U0 ] - ) a- F# {+ X! M$ n
- dma_addr_t dmaphyssrc1 = 0;
* A; ?- c* {3 f6 Z$ N - dma_addr_t dmaphyssrc2 = 0;
1 l; z9 Q( _, y - dma_addr_t dmaphysdest1 = 0;
6 u7 A( V4 ?1 x4 N( i2 B1 M: g - dma_addr_t dmaphysdest2 = 0;
+ Q h* G* F4 u/ } K5 U P. V1 ?+ B
+ d5 ~: `) {2 K# U7 T$ R( U8 \! e- char *dmabufsrc1 = NULL;
9 @% _2 s: p% V1 q - char *dmabufsrc2 = NULL;
" i- q" V7 ?. `( G% G6 l) F& K* J - char *dmabufdest1 = NULL;% k" G7 k, x9 E" [8 b
- char *dmabufdest2 = NULL;6 F: u3 Z' e6 v( u1 k* a
- # D$ f/ `0 H0 x$ j6 Y- \. h
- static int acnt = 512;4 \& r5 y" C2 k; o
- static int bcnt = 8;% B: J7 b) p( K* \8 v, {# B
- static int ccnt = 8;, ~9 _$ j" l" J
- 7 Z; D7 U F' w8 b! l
- module_param(acnt, int, S_IRUGO);
a4 k8 L( S# ]3 \2 t$ l4 ?1 {2 \ - module_param(bcnt, int, S_IRUGO);
# c3 Y9 T3 B) M F - module_param(ccnt, int, S_IRUGO);
复制代码 5 F+ L9 `$ h) L& D
1 ?! f5 e3 t9 A& w; ~! j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ]; ]4 P# S- I+ G: I# S, H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) w8 T1 _1 f( N) Y& y2 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ V2 w! S5 x' A4 _# g$ j& O8 q
6 P; {/ K0 y- C/ P
* E) H. d, k) Z- i* g9 R' W& P1 } |
|