|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ E% Y1 j! \6 ~; t1 K* r7 s- [code]EDMA sample test application
( @3 ~' V' @7 Z+ g) D9 `0 P3 Y - /*# S. \5 A) c! O$ k3 O; I: `
- * edma_test.c
- v. x6 u! |4 X/ }# t3 R - *
- @( `" }0 O* T+ }4 R7 g - * brief EDMA3 Test Application) w- G" e) K9 I# v2 t& I1 X
- *9 i2 B. N* ^2 b7 m# V& b
- * This file contains EDMA3 Test code., v" \' D0 Q- n, X w7 p; ]4 v; w: }
- *
& r" F& b6 \7 I& } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 w% \9 ]; N' @: a8 c, U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 [$ S: N+ Y9 i; t9 N$ x - * TO CHANGE.
) n; L5 E$ u8 `# z/ | - *
. d3 I& \' i+ z: z) i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 G' `0 G E. x% M* l; y - *! Q* E2 t9 s+ S$ {# J
- * This program is free software; you can redistribute it and/or
; Q) K/ W# F: Y- Q - * modify it under the terms of the GNU General Public License as* c" `7 ~. k! g
- * published by the Free Software Foundation version 2.2 l1 c( t/ D7 J1 d
- *
0 U, J' s! U( D1 i9 k1 ~* Q; W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! l" @# \( H% y - * kind, whether express or implied; without even the implied warranty* l3 R+ m, w% P Q6 j" I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 T2 j d! i- P( {2 x- q7 R/ H
- * GNU General Public License for more details.$ U( X% k8 H# e5 e2 ~
- */
4 H& y" [' A9 ]" W, g5 `8 C1 }
/ t; f. X0 h k" D6 z3 E- #include <linux/module.h>$ c9 ^1 o7 J/ r/ e' S
- #include <linux/init.h>/ t0 A9 R$ H5 j0 y# j3 X
- #include <linux/errno.h>- u3 H6 B6 j' q" N* H
- #include <linux/types.h>
- P8 Z/ r4 ` Y; u4 ~, o% e4 @' q - #include <linux/interrupt.h>
$ `" f: i# v& g! {# ^9 z1 @ - #include <asm/io.h>: P7 v" E- n6 d" [# |4 r3 l% I2 l
- #include <linux/moduleparam.h> ^; s! q+ a3 U+ a: W
- #include <linux/sysctl.h>% _0 k8 }' X5 g, A& M8 H W
- #include <linux/mm.h>; J4 {, e2 Z, N8 @" k: e g1 P
- #include <linux/dma-mapping.h>
8 T7 ]' h2 F# |8 [6 n" W W2 L
% W/ a9 q6 X" v. W- #include <mach/memory.h>
) m! a0 N$ {' K* y X - #include <mach/hardware.h>
9 O, _9 Q; N: }- d6 p6 k2 Y6 u - #include <mach/irqs.h>
# z- W3 f' U1 u" ~, T( I - #include <asm/hardware/edma.h>
9 G0 d1 Z6 w2 v' E5 \7 S; y+ X* S, L
! B7 I) j+ F5 w- #undef EDMA3_DEBUG
6 m5 \' `! v9 l) B1 t - /*#define EDMA3_DEBUG*/
+ P& {$ q8 x& U1 E
& Y0 Z! A- i7 z2 x6 w/ S- #ifdef EDMA3_DEBUG. w0 G6 E& Q) C! g9 q% p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ]* J! d9 n" i( ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 E$ w8 }$ B) n1 o/ Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ w' J5 O. Y, k }+ p& f
- #else
* y! _6 n5 v5 U& n* G" x2 C1 p - #define DMA_PRINTK( x... ), K5 F" I/ a9 ]5 |( C
- #define DMA_FN_IN
3 R! K( T# p$ \ - #define DMA_FN_OUT1 `( \5 K8 s$ D8 l% |% c7 ?
- #endif
) N% Z. d( m. I; w3 N' s
, j* Z& U$ N) W& {2 O2 |& t9 c* h. l4 z2 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& ^( ?3 O: t* k, q" E. |- k6 H - #define STATIC_SHIFT 3
3 ]! b' B2 t9 r1 L4 C2 g1 L+ q& t6 { - #define TCINTEN_SHIFT 208 z+ g; ~( n- A1 P/ o
- #define ITCINTEN_SHIFT 218 Q# I! N) L: x
- #define TCCHEN_SHIFT 22
5 @% h9 G) P! O$ n7 d0 W! H8 I1 K5 ] - #define ITCCHEN_SHIFT 23; |; R# T4 C5 c, R2 E9 B9 ~! X7 |
, c& \6 \+ D: h) H3 E- static volatile int irqraised1 = 0;$ c7 v. ~9 ~) C4 o
- static volatile int irqraised2 = 0;# ^& k a+ S0 A1 ^6 z8 v" O
- + ~) U$ z+ h8 [0 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ~7 k) t R! a% l/ L9 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) p# L3 p m) c, T9 S; k" ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 k, @9 R& h' Y6 s- B1 U - 6 y# S5 `; f, j! T& @" A4 e1 w1 P
- dma_addr_t dmaphyssrc1 = 0;
# I4 h' g1 A9 \! n3 _ - dma_addr_t dmaphyssrc2 = 0;; r# E5 `8 m- x& c# h5 N8 v9 G
- dma_addr_t dmaphysdest1 = 0;8 O/ J2 s3 q. l. n
- dma_addr_t dmaphysdest2 = 0;
6 a8 \6 Y5 ]2 _! w- g& k
$ l5 o4 J& T2 v3 y- char *dmabufsrc1 = NULL;
6 ]- t$ i7 |, L& T6 h% P- o - char *dmabufsrc2 = NULL;' _2 [, V E' j- o$ P P$ p0 Q: l
- char *dmabufdest1 = NULL;
. u7 P0 S$ n4 d6 }1 @! j) _& p# i) X - char *dmabufdest2 = NULL;* W# p4 r- h0 t' K1 H Y# G
* X6 T* l) `# d1 U0 n0 R- static int acnt = 512;. o! ?8 E, M& v
- static int bcnt = 8;
& R/ t/ n2 Z/ ]' u0 q - static int ccnt = 8;
( L; ~! j' e" p, l: f - & k; e. s8 o$ v. e
- module_param(acnt, int, S_IRUGO);
7 [5 R" Z' t9 T8 P - module_param(bcnt, int, S_IRUGO);5 V- F9 O8 y$ O- n" k0 H8 u
- module_param(ccnt, int, S_IRUGO);
复制代码
( ?' i* ]% S" n6 a; {* x+ m4 p: p) k+ W7 I- S& F0 Z+ a, a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. t" D0 W2 Y8 b2 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 v$ k( m! T" a2 Q& d ] R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& E6 @$ K! n9 \. W+ G' h
# N+ r% e- C6 d* k9 X/ T
8 P( M D2 L; n* k( g
|
|