|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s' q3 }# O$ Y& A$ U- [code]EDMA sample test application
8 V( k2 I8 G+ \' i - /*
+ l4 H3 c1 {# b- y8 @0 S2 a& O - * edma_test.c
3 r% {0 O* g/ j+ G - *: A3 ?7 v# T1 }7 X- m1 |
- * brief EDMA3 Test Application; d1 ^2 u+ ~1 Y" ]$ t
- *
# t ?; w! H; U& y - * This file contains EDMA3 Test code.
/ E9 o `4 F4 ?+ K( m2 S$ } - *9 i8 h X/ f+ o8 R# m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! L/ n( T( b; q5 X3 }' z2 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: }# u% j' f0 W4 V8 @ k% p5 T - * TO CHANGE.
% A: q9 q5 l5 ?- y' F4 c( n - *
( Z' o3 c8 q8 i- a& Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: ~2 |7 _2 n" ~! C' { - *
! w: i: K9 Q- Q1 R7 C; K - * This program is free software; you can redistribute it and/or
0 y$ j3 [( i+ m# c8 b+ V: Z* W - * modify it under the terms of the GNU General Public License as, \% @) c7 X9 I" n3 _, K: ^( O+ u
- * published by the Free Software Foundation version 2.
# z- O4 W8 `, o, t1 m* B - *2 |; I0 |- |0 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# c+ m% R4 F2 K5 P U
- * kind, whether express or implied; without even the implied warranty- y% L, A& ]' ~* ^& n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 t+ F& z, G$ s# y6 T - * GNU General Public License for more details.( z, S/ q& {( R; L8 j; L
- */
0 j6 ~! F2 ]3 b% } - L, a" ~$ }; R* p! W
- #include <linux/module.h>) R6 \4 T( _( G9 u" `6 ~
- #include <linux/init.h>
6 v6 s1 Y" f' z4 Z& g" I0 t - #include <linux/errno.h>7 O1 N k5 O( W1 H! t* f( Y* T
- #include <linux/types.h>
' z: f _3 J& e6 R t - #include <linux/interrupt.h>- u# }+ d1 S! {2 ^: Q T! R
- #include <asm/io.h>
# `2 o; i \% _6 D - #include <linux/moduleparam.h>" _5 ?7 S. J+ j" l5 T
- #include <linux/sysctl.h>
C# m& [' c( f8 k! ] - #include <linux/mm.h>- i) g+ B& n- C1 i8 r" ^
- #include <linux/dma-mapping.h>& b3 p' } P0 P5 t w
- . k, E4 b( B! q
- #include <mach/memory.h>
5 ?& d0 _0 I& y9 d. j - #include <mach/hardware.h>7 L n9 `0 |" Q8 T
- #include <mach/irqs.h>
2 P+ d$ H$ `* M6 I - #include <asm/hardware/edma.h>
' H* t/ T3 e3 o6 _2 y7 Y8 r, l
`5 _$ {) W/ }( s$ ]7 z, d+ X- #undef EDMA3_DEBUG' h( L7 d% p7 m9 Z7 h
- /*#define EDMA3_DEBUG*/
5 {0 m1 B+ z$ ]8 z7 P
/ Z: w' a% I) u9 ~0 u$ M( n+ h- #ifdef EDMA3_DEBUG
, O+ M6 h6 H8 B/ A3 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' Y, K2 x ~$ o! y! u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! X+ i8 p3 P1 G3 j4 B# ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 p4 i4 r8 R) ?1 b" A0 }) p, n0 k2 ?
- #else
* k" ~' p/ ]4 @; ]3 a - #define DMA_PRINTK( x... )- a* E2 U0 W6 u1 F8 M# |
- #define DMA_FN_IN
) O1 y$ \+ {6 G+ g - #define DMA_FN_OUT- D+ ^; x4 l; U+ J
- #endif: x( R3 x8 Y' K8 z6 N5 ?
9 K. e$ X" w3 M- u( z# h2 R- x- #define MAX_DMA_TRANSFER_IN_BYTES (32768) b8 t4 r2 u6 B5 Y: m
- #define STATIC_SHIFT 3$ {6 J0 f! n* V
- #define TCINTEN_SHIFT 207 s/ {2 ?0 y9 }4 }
- #define ITCINTEN_SHIFT 214 r0 o! k( }! Y
- #define TCCHEN_SHIFT 22
+ Z p6 }8 W+ U+ k/ G3 z9 } - #define ITCCHEN_SHIFT 23+ ^ ~' a5 T4 C
1 w* c" }+ |, T$ g) r- static volatile int irqraised1 = 0;
9 t; T- M ]4 K9 K' h n - static volatile int irqraised2 = 0;
8 M$ ]8 g% W; p2 y, C+ o8 k - 5 \: o/ f0 A; K( `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" k X2 f1 P% k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ]0 n; T8 H6 m+ k& v" \' s/ H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \: I/ A* o) e4 y* ]
- 7 q! L/ g! J+ @/ c3 N
- dma_addr_t dmaphyssrc1 = 0;1 q4 v l5 U2 t+ A' U4 Q0 _
- dma_addr_t dmaphyssrc2 = 0;
; T7 \' ^9 m& g* v4 B; x - dma_addr_t dmaphysdest1 = 0;
. @, x" |" }5 S# ?& T4 N1 A$ ` - dma_addr_t dmaphysdest2 = 0;# B' N; D5 \: C8 j/ m
- 2 H+ W" U, d9 \5 u0 Y# F7 x, O
- char *dmabufsrc1 = NULL;
- D7 z6 ^7 `' o7 y7 `& o - char *dmabufsrc2 = NULL;
# z0 a2 m" i+ R9 a - char *dmabufdest1 = NULL;9 d2 d* \4 n {" Z7 g
- char *dmabufdest2 = NULL;* ~+ I3 A9 l$ w8 @
- # v. V8 @2 l+ p" P+ T
- static int acnt = 512;
, e% \9 a, L$ h7 {* K6 B$ I - static int bcnt = 8;9 s3 g M1 M# s8 }
- static int ccnt = 8;
& ?4 X, @, ]0 z$ E
9 a6 i. l; E6 [3 u2 u- module_param(acnt, int, S_IRUGO);
! }6 b5 L' F6 j' a8 J% p8 A - module_param(bcnt, int, S_IRUGO);1 s1 k. A% t( a
- module_param(ccnt, int, S_IRUGO);
复制代码
6 O( K' t3 ~0 a* n( W' @
+ S: w; P7 @# a* G1 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 d u' \/ b" T# ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ~$ ^4 f R2 I$ \# Q" p, v0 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 t l5 j1 ]- E! w! k- \; A
K" a& S/ i4 b$ w9 @
8 h* M/ G1 O4 [3 [ t
|
|