|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ a% }* s) ?) }" i* S4 z- [code]EDMA sample test application
+ _3 |8 Y7 K8 g# k4 a A5 p P - /*2 i1 w1 t5 Y0 X6 ]# I9 ?9 y
- * edma_test.c
& c" V$ i( s8 q) I, X - ** } r4 c* t" M( n$ D+ C9 k3 K
- * brief EDMA3 Test Application. i7 v2 v2 z, P$ w l& Z
- ** N3 t" a2 l: @. k; `
- * This file contains EDMA3 Test code.
5 j+ Y# v6 d, I. O; V9 a. C; J5 t - *
0 O6 f+ Q& Z. x$ i& e) z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; I1 A, g9 z& M( U6 H6 B! u. F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 a4 T4 S7 B2 [7 C2 i# a
- * TO CHANGE.
' _. U) o7 y$ `$ l - *
( _3 D& L+ Z+ O+ j1 f v7 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* x; {: f4 m" e5 D
- *! T& N" z& S6 I( A! u6 d/ D8 A
- * This program is free software; you can redistribute it and/or
/ L- [( r+ T3 R) L9 `6 I. p - * modify it under the terms of the GNU General Public License as
" f, e9 X1 k, B4 y7 t6 n - * published by the Free Software Foundation version 2.
, ?% p: {3 Y8 \2 C7 g, B3 L" s - *3 L+ k1 \6 O1 ]( ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) T" M4 |2 Z, I6 a. v& o - * kind, whether express or implied; without even the implied warranty
& K- E" |2 l l3 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 r m/ l1 Q" P, q8 q! X M: @: `2 y - * GNU General Public License for more details.5 o9 ^5 |; @1 p, f) m7 @. n
- */) Z0 ^% U3 j% k: t3 q& K" z" Y
- " R- E% V. H3 W3 N/ [
- #include <linux/module.h>* z: n/ ^; k0 E: n
- #include <linux/init.h>
' W7 F1 D1 @3 |: e% G6 m' W1 ] - #include <linux/errno.h>+ H, i( X# s M, \1 h% C# ~
- #include <linux/types.h>
/ c- c% ~- s1 ?4 M9 j0 t; q6 I' | - #include <linux/interrupt.h>, l1 |5 H/ l V% m
- #include <asm/io.h>( A9 X* {2 M- ], i
- #include <linux/moduleparam.h>
( z* l7 I+ C5 s' Y5 S2 ` - #include <linux/sysctl.h> G. w% A2 m+ j) [: G- o) D; n
- #include <linux/mm.h>4 n4 ~8 l9 X7 |
- #include <linux/dma-mapping.h>
?5 K6 I% H" ]" D- M2 d: E - Y& g% F( O0 h; x( _
- #include <mach/memory.h>/ T- V( P3 k9 x
- #include <mach/hardware.h>4 m* f2 D" x" P1 ^7 a! y0 u. s
- #include <mach/irqs.h>
% j9 w; m) ?2 v+ K' F2 h - #include <asm/hardware/edma.h>
0 m% p1 Q( T0 N% `! G - & h N) Y9 x9 g z' t b' K
- #undef EDMA3_DEBUG
8 S; u" H8 L. m _% I! ~ - /*#define EDMA3_DEBUG*/
4 {! A* K2 @% `" q/ C
% h. }; v( ~, [" R: }2 R- #ifdef EDMA3_DEBUG
; h6 t J1 S: Y! f7 c( q, H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* O2 ~& V5 T2 i7 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" f. y1 {0 p7 b; n5 y* M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' [; B( A+ H- Y4 W$ y - #else
/ i- h+ p+ `6 _0 `! Q/ ~( V6 t - #define DMA_PRINTK( x... )
1 V& i3 M1 }+ S - #define DMA_FN_IN
' Q0 N- C, p- m - #define DMA_FN_OUT0 R2 o! F; j/ l
- #endif! b: b9 t i' r2 m2 @5 G- ]
- 2 h ^! Z2 F5 t2 H. {+ x2 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( m7 t) P. n: u: [3 q" _3 y5 ~- `
- #define STATIC_SHIFT 3
8 `8 h( T& |1 E& S, Y$ M# ?2 H - #define TCINTEN_SHIFT 20
$ h* P3 a0 l- ]" |& D( A9 ]' z - #define ITCINTEN_SHIFT 21
3 u5 z+ K1 w2 r; Q) P - #define TCCHEN_SHIFT 22
' {' l3 B8 t5 n3 f: U6 H6 P, R* ?7 d H - #define ITCCHEN_SHIFT 231 M! `* o5 d7 a6 h5 {
- 7 h' I% R6 i1 U G
- static volatile int irqraised1 = 0;% Q# r5 N4 y! X3 {
- static volatile int irqraised2 = 0;9 _; ^1 Y! z5 H5 A
) a% [, N8 V8 t0 @7 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ Z& a+ P8 ^3 d1 u' u3 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 `/ [# i! c% i) S% U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @4 ~7 W( \# k/ s5 ?- U
- 3 q1 N0 }4 H# y- a. ~; D
- dma_addr_t dmaphyssrc1 = 0;
# s# a; t$ M; H - dma_addr_t dmaphyssrc2 = 0;
6 [$ j9 f1 o4 \$ ~6 ~, f - dma_addr_t dmaphysdest1 = 0;; _9 x: x1 A' F, T
- dma_addr_t dmaphysdest2 = 0;8 W8 {5 g& ~; i
- , ~7 z% \ q2 {8 p1 e
- char *dmabufsrc1 = NULL;
0 {9 U u6 B/ K. }; J - char *dmabufsrc2 = NULL;) x2 k3 ?( w% S5 ?; Q
- char *dmabufdest1 = NULL;/ R4 g, d, T( A1 Q% `# b) Y, C
- char *dmabufdest2 = NULL;
$ F; H/ ~: \9 {- G7 k) C+ Z
) S" v: X" D$ A5 e9 d4 j- static int acnt = 512;8 C& W( e2 Q/ d2 j8 J
- static int bcnt = 8;
! p5 s# \/ H' w( N" {: g9 `; T @ - static int ccnt = 8;; U' B" N( q0 H) M) n1 _
9 D1 b) Q7 p/ j# N1 e- module_param(acnt, int, S_IRUGO);8 v( O3 v0 l2 `0 j+ T
- module_param(bcnt, int, S_IRUGO);6 U4 [ A$ S/ i, G D- z* l/ N
- module_param(ccnt, int, S_IRUGO);
复制代码 " H$ D4 I8 w2 C; k' N/ r
/ v$ n A0 X2 t3 p* b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ n8 x$ X) l1 f1 _! V" ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 K' t! }: c \2 c2 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 |) O3 z R6 J' n/ _9 [9 y7 Q+ r9 ?- y6 a8 `6 K' J
6 a9 [/ k* N! k" k
|
|