|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 U, o0 h" N" p ^, z2 y- [code]EDMA sample test application* \% }+ x% P! X% _9 g
- /*
. f, o5 H1 X5 I/ B C - * edma_test.c0 v% y- T6 w, r8 O' Q
- *
% _" W; p; V; f: `9 u6 A - * brief EDMA3 Test Application
/ B8 c! A8 S) }# i: y- E, o - *
1 m" y5 ?/ L# C5 Z8 \: g; b2 a - * This file contains EDMA3 Test code. h; H4 q: b+ }! J
- *
9 T8 Y$ v, M/ [# f5 \, ?, Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 a# J! }7 o3 U& u/ n) l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 M' P9 T8 P! I, s3 r+ V
- * TO CHANGE." w. k) i8 v4 N6 x5 B: M z4 j" D
- *
! I- X( ]) x* E: [0 p2 h- V& f+ q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# a" d v1 c0 R: X& u! p9 x8 N. D - *
8 K# q/ W- ^ c5 \) @8 y - * This program is free software; you can redistribute it and/or
$ {& K0 ^6 T" A3 k8 A - * modify it under the terms of the GNU General Public License as
7 s* G% L0 M1 g* S8 {2 w7 ? - * published by the Free Software Foundation version 2./ x; j3 _0 T) t% |8 u
- *
3 Z5 f8 i! I7 d" K! ~2 K+ W" x1 s9 q- W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 J3 e3 d$ @; y2 Y- E7 b
- * kind, whether express or implied; without even the implied warranty' R3 ^: f5 x2 W1 s- @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& b# c# r& m' \2 R% ]2 L; N% `
- * GNU General Public License for more details.
* a; r2 ~+ n! B, O% ~; x - */& n/ L. Z" l" Q2 B; r+ [/ b( }
- 6 g- s: A. ?0 B% [6 l! F ~ V+ _
- #include <linux/module.h>) n* D+ ]1 q5 Y. [/ U, F
- #include <linux/init.h>
2 d6 _! U/ m2 u - #include <linux/errno.h>
" n* y! H0 f! o' U! o7 S - #include <linux/types.h>9 P2 ?7 d2 H2 s& Z4 `5 s
- #include <linux/interrupt.h>) l( R0 e* |" Q; i' M
- #include <asm/io.h>
3 i# z" N* j4 P- ^$ G - #include <linux/moduleparam.h>
2 t$ @3 L- ~0 m9 M. e - #include <linux/sysctl.h>
6 i+ A, e9 K& d2 e$ g6 o2 D0 m - #include <linux/mm.h>
0 h+ y+ @% K. z8 | - #include <linux/dma-mapping.h>
9 z& J1 b0 |# O9 C' l, A! v- o( l - # R1 X- I: n/ x) H4 K. E% B: U
- #include <mach/memory.h>
! W$ J/ @# g% g: h3 N7 y* j - #include <mach/hardware.h>- \5 k. U4 b. ?0 V; O' @/ `$ t2 e7 X
- #include <mach/irqs.h>
5 o% s- z! C3 ?+ f: Z) T - #include <asm/hardware/edma.h>
L' s3 G1 p. O- r* A5 b - + B; J' Y7 q. V+ n: ]
- #undef EDMA3_DEBUG$ L" U6 M' ]- R: k8 a0 E7 v; S2 E
- /*#define EDMA3_DEBUG*/
: E9 @9 o2 @5 u0 N$ \ - 1 M# s; p* j7 W* |! ~5 ^
- #ifdef EDMA3_DEBUG
4 k0 U9 w% M/ A" Z2 E6 h1 |/ | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: J7 N7 j8 i( p# t" _5 \4 z' c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# u2 V( y3 j! y+ E. u& p$ ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ z# Q' s: O5 l3 ? - #else. M. o% D7 {6 i$ E
- #define DMA_PRINTK( x... )+ [) |4 t6 y7 g8 n# R
- #define DMA_FN_IN' R5 W7 ^5 r# s: f; F7 z
- #define DMA_FN_OUT
7 A2 p0 N$ ?2 a+ e, v, N - #endif
5 u f; M& |5 f+ s; M
$ T0 I( }2 j% v9 Y2 K3 I$ x- #define MAX_DMA_TRANSFER_IN_BYTES (32768) M# T2 u0 E! u9 z* r2 k! O
- #define STATIC_SHIFT 3; U1 e. G0 p' z, H
- #define TCINTEN_SHIFT 205 X" Q& E/ X/ M2 W0 s8 t$ }
- #define ITCINTEN_SHIFT 21
" Q6 n0 Q, ?6 j1 Q8 a - #define TCCHEN_SHIFT 22& U! V. f/ q# p. m
- #define ITCCHEN_SHIFT 238 Y; C4 N. x# C9 `9 b. w
- 4 e9 p) P! ]% @; H( n- M
- static volatile int irqraised1 = 0;
; j$ F. n9 [2 f2 D) i- T( l - static volatile int irqraised2 = 0;
( s0 C5 S/ [" `+ o+ y( }$ g4 M' Z0 |3 R - 7 W5 g+ h/ X% a8 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 g: I" Q# {9 ?6 d# J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X, c. d+ o- C8 m& _7 A M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" r9 E( J* h- Z" ~1 q& [0 U) G6 q
- $ A1 K1 M8 y; \' C% o
- dma_addr_t dmaphyssrc1 = 0;- A6 d$ m( _# v' o* B! E. Y
- dma_addr_t dmaphyssrc2 = 0;
* g7 ?1 D- V, g T! Q: w! X - dma_addr_t dmaphysdest1 = 0;. e% R2 ]; V* L, i
- dma_addr_t dmaphysdest2 = 0;3 p4 H2 V. A9 N/ T9 z" a
$ p. h: |9 {# y6 f, h, C- char *dmabufsrc1 = NULL;
9 {$ O: ?+ c9 N5 y* I# n" P - char *dmabufsrc2 = NULL;+ @# Q. g' E: m$ F/ k: P$ t
- char *dmabufdest1 = NULL;
! M2 k1 [/ Q# s/ Q4 {/ [ - char *dmabufdest2 = NULL;
& Z" k- k4 i5 L - 1 D3 J* f Y4 Z- I4 C; m: f1 a- X
- static int acnt = 512;
2 P4 J1 y& K0 _/ q! B+ s - static int bcnt = 8;
9 ?" j1 j# O7 u z0 f8 Q# U# {- I - static int ccnt = 8;
9 M( b9 v4 B- D3 ]- o8 _8 s$ _8 y
& c7 F2 L7 {6 _* M, a( N- module_param(acnt, int, S_IRUGO);
/ z3 D a( i6 g3 z* U$ K - module_param(bcnt, int, S_IRUGO);
% v$ e: B! V; t2 o: }( g8 h - module_param(ccnt, int, S_IRUGO);
复制代码
( @ A. i+ F: O) X& l/ N
6 c8 @$ p, e, h* P1 B- Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 o. D) e/ y S0 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, I' y+ y+ s0 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [2 Q# v( [/ A3 U: L q5 p F. O8 x' N, \0 u, _( Y' j5 J4 W
3 z) B- ~" D: j! @( s' u: Z
|
|