|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: Y9 U" I* i2 w" i- j' t$ B/ i9 \- [code]EDMA sample test application
+ |0 L u' U& z+ P5 x- n) E - /*% W9 \8 y6 ]6 M0 R# |( p2 b6 L+ k- R
- * edma_test.c
0 K9 S$ L$ \! o* b: _5 d M7 ^% y; n! o - *' \& L& I( ?! [! \7 i
- * brief EDMA3 Test Application4 ~) G4 a' |0 h0 C- |4 g
- *
2 A, \, R+ N5 E% G0 s Z8 r6 c: l - * This file contains EDMA3 Test code.! H& R- B- ]+ x: ?8 L3 w6 g7 X
- *" A4 t* D7 t5 x2 b4 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ }' b8 H8 n. A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 R3 H" r8 }& i. C - * TO CHANGE.
+ \7 o+ H0 i6 X - *
' z* N4 O* c1 b2 c$ Z5 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Q# ^6 a1 T; e
- *
, k% p- q1 M* K% s1 x5 i6 k+ R - * This program is free software; you can redistribute it and/or
7 Y6 o$ [8 S3 |$ J# T - * modify it under the terms of the GNU General Public License as
- g* x+ Q1 |6 W6 {0 ^4 q - * published by the Free Software Foundation version 2.! c4 e, Y* S4 ~5 E1 ]; k* k
- *' g, a/ H# f1 F4 j8 N D+ ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 y4 ^' n p6 S9 X+ {, X r! h: x - * kind, whether express or implied; without even the implied warranty, m' O8 L c2 d: u3 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% c+ X, ?/ _: Q+ }* w2 x; ~; d - * GNU General Public License for more details.2 m3 J! v% N5 N. d9 k4 T
- */
. w) W, Z) A7 t8 j d! f
& U7 C" p1 B/ d5 s. k1 I7 K; l- #include <linux/module.h>
4 `, R! b' d; I6 D - #include <linux/init.h>
5 ~+ W/ B- t7 a6 O - #include <linux/errno.h>+ U% T( M2 {- N8 L
- #include <linux/types.h>) k& f5 [* a" E/ E: z
- #include <linux/interrupt.h>
) W+ d9 H# q3 P9 R! z% J - #include <asm/io.h>
, T2 P" M8 _* o3 E. j! { - #include <linux/moduleparam.h>
- N; _' j, C1 ~2 c - #include <linux/sysctl.h>9 V% j M% C# t) F9 ]9 s: k
- #include <linux/mm.h>) V# e+ ^7 \# t0 ^5 C
- #include <linux/dma-mapping.h>
* q4 n6 E8 o F9 W - : E! y) ^; u0 [( [6 Q ]" A4 ]
- #include <mach/memory.h>
" |5 b3 N3 z7 m7 j& g - #include <mach/hardware.h>+ g5 K0 q @$ H+ W5 v5 G
- #include <mach/irqs.h>6 g3 f: M8 s' ]$ `( p u
- #include <asm/hardware/edma.h>
- J- _' w: C6 b- b4 K4 h% j
: Z3 [. U$ e' l0 _5 d. _! _5 m- #undef EDMA3_DEBUG
/ X0 \8 Z5 i; D' r! v% d9 q5 Z - /*#define EDMA3_DEBUG*/: f( E- G! s' x! z! M9 v H
$ p, `" f8 x- k/ C' d- #ifdef EDMA3_DEBUG
8 m" X; n1 l% H) C8 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); b1 ^5 b# y1 Z/ i2 F& C3 {/ B: c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( v- _3 N, y! d# I. A& k: ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
a T8 l- l2 z6 o* t - #else
% x6 U2 |8 k1 `, _ a: F0 B) o - #define DMA_PRINTK( x... ) M, g" y2 }) U6 ]/ @6 ]! i% O: E
- #define DMA_FN_IN
* g$ J+ Y' |6 o! R2 J - #define DMA_FN_OUT: L2 j9 Y# z# }2 r; r0 G4 w! q6 d
- #endif
. i" q8 V1 {! C
" h) J# S5 i0 K( E1 N" n6 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, I9 g/ Z2 D6 e1 I$ Z7 H - #define STATIC_SHIFT 3! ~! G1 ]# V2 e. U# V+ G3 P1 C
- #define TCINTEN_SHIFT 202 [6 D( ]4 ]5 X: ]' D, h7 m; s* |1 V
- #define ITCINTEN_SHIFT 21
W5 e% Y- R o5 J- P0 w - #define TCCHEN_SHIFT 229 {: X0 u& c& g. ~6 k7 \
- #define ITCCHEN_SHIFT 230 {" A8 z1 \0 q( g$ P% b
- : n4 N% [ Y! g% S# F* x
- static volatile int irqraised1 = 0;
3 I X7 f3 ^ k - static volatile int irqraised2 = 0;* r c3 k4 t' }: r/ N( x o
% o9 p* S; i) p& H) ]5 h4 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 y9 r' O8 n& g1 Q. e2 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q" d$ ^; L6 O7 W$ x2 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 W. ?' ~ G2 l# G# p6 o+ d9 U; { - : `6 a2 }% O) H8 p
- dma_addr_t dmaphyssrc1 = 0;* d5 e8 A+ I- @) B1 {
- dma_addr_t dmaphyssrc2 = 0;0 I* ?4 Z& y" C% R4 ], E; F8 O
- dma_addr_t dmaphysdest1 = 0;
( O0 S8 ~/ R& {7 F6 m - dma_addr_t dmaphysdest2 = 0;- F, o4 ~ m7 u
- - M2 z1 S. K: ?5 C
- char *dmabufsrc1 = NULL;
9 z) [7 v% @! [/ r - char *dmabufsrc2 = NULL;
3 B; T! n9 p- h4 w& y) k) d - char *dmabufdest1 = NULL;6 C4 F0 o6 M; p5 x8 C8 k
- char *dmabufdest2 = NULL;
; C( A) C0 I/ B* C
( j) {8 m& I' t- P1 j3 }# b- static int acnt = 512;% \8 o$ ~7 O7 q6 S) @
- static int bcnt = 8;
5 O( {1 p9 F) S - static int ccnt = 8;6 p" G+ X( |9 L' s
- * o8 j* L1 D/ W2 U5 F( ?+ l" B
- module_param(acnt, int, S_IRUGO);
! n& c3 x, |0 X. Q - module_param(bcnt, int, S_IRUGO);
# M! a' ~5 ?) `3 w! N - module_param(ccnt, int, S_IRUGO);
复制代码
: n; I+ e9 Y0 t) @' \5 @
' p( {8 n f& |4 _3 B/ z L) n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C+ e" l% A! a6 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ B# ?: j& b% M7 n1 Q7 Y' u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; H/ s p) c7 a) T, N/ n# s
) P: j8 B( b7 H; |0 I3 J
2 v0 g. a( d3 q( f
|
|