|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b7 ^3 @( J1 q
- [code]EDMA sample test application/ O# Q; U3 f. @% S0 c0 b
- /*/ L# S- P( ]) ~0 Q! V
- * edma_test.c8 c. @3 a- x4 C; u( \! ~ w2 q
- *7 [9 k# z- `- K
- * brief EDMA3 Test Application- k. O$ a# G; R5 I3 U4 ?
- *+ \9 ? p6 O9 [& q2 D
- * This file contains EDMA3 Test code.
5 E4 f' K4 r% ` - */ h r/ K# F$ H* ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& |7 n* r$ u; k& w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# @. [/ j2 z$ t! Z5 W2 n
- * TO CHANGE.
8 D' S- }! V) s - *
8 D' |( P( p1 g0 X7 u, C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: x Z' O2 x$ S' w5 Y' F- F
- *
3 F& M$ H# Y" q8 b" i2 g6 Y - * This program is free software; you can redistribute it and/or( M% O D0 x6 }1 @4 u4 c3 R8 X
- * modify it under the terms of the GNU General Public License as
: l& |) z# u8 [6 {9 O5 N - * published by the Free Software Foundation version 2.6 m5 o4 n# ~4 I( K% u; ]! c" I+ Y
- *
& i7 C8 o5 {7 P$ g, o; A) _" T: C3 Z$ U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ s3 S. \9 d7 F5 ?) Z0 U2 J6 t# d - * kind, whether express or implied; without even the implied warranty$ e: y. }) ]: W; I3 [. l1 P) h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" N% @9 \6 Q. b1 m; H8 _$ _- ?
- * GNU General Public License for more details.3 n! ~1 f$ x' X, g1 v
- */
, H* U& a: F1 {7 g - 4 a# n. X% u) |6 A3 a" [$ _
- #include <linux/module.h>
4 |- U8 u" d% v m% l - #include <linux/init.h>% A' n* @* R" M+ E6 I! _
- #include <linux/errno.h>; d# K' _2 O9 @3 G3 F
- #include <linux/types.h>+ J1 i5 c1 Y3 B+ K7 X; e) X
- #include <linux/interrupt.h>
; }' a+ S& t7 \& ~5 \ - #include <asm/io.h>
. I0 i( m2 W9 I0 l; a* B+ w - #include <linux/moduleparam.h>
G# F1 w& V( A1 h' } - #include <linux/sysctl.h># x' E! S' [. L( o% E# u# F
- #include <linux/mm.h>
( T) ~7 R# Z, r' u) A: @. L - #include <linux/dma-mapping.h>. M3 |0 l4 ]# E; R% ~. y
- ; b: O% f7 b# }; X
- #include <mach/memory.h>
# J7 u9 o, Z+ m8 z: k - #include <mach/hardware.h>
/ M1 A; D' E g: r+ f - #include <mach/irqs.h>$ q/ t7 w' ^/ o0 p
- #include <asm/hardware/edma.h>
7 K) q( G) t, T! P9 A T( v - 9 C6 B: `$ Z$ D# t4 A# s
- #undef EDMA3_DEBUG
! r% X8 \4 q+ _* P( Y: W, t - /*#define EDMA3_DEBUG*/
' S8 \& @) _! X, c" f0 D3 i( |
3 K0 d. E6 t9 n6 o; q2 c- #ifdef EDMA3_DEBUG
( M/ o8 K" M5 X- ]" o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 q4 j) f% w* g, V- i" e: W# L, n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! b: M& X! v7 f" }4 @4 V3 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). {. C% i4 F8 R. M( H9 x2 a
- #else, w& ^% A% t0 S
- #define DMA_PRINTK( x... )
- I6 N4 z- Z/ q - #define DMA_FN_IN
& Z) W+ s0 D, i3 w - #define DMA_FN_OUT2 i+ D2 o9 i# J7 T* j
- #endif3 Q6 h" l' k. z6 l1 B
5 I# W5 J3 c; e& y3 N# @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" \( h0 G3 \6 ~
- #define STATIC_SHIFT 3+ p" F9 q* j+ n: d9 q& h) }
- #define TCINTEN_SHIFT 20
' x+ J7 A/ q& N! }: V; v - #define ITCINTEN_SHIFT 21
% M0 X) m/ k6 J - #define TCCHEN_SHIFT 222 a( z. {6 ^5 `& a
- #define ITCCHEN_SHIFT 23
' B9 a' x+ |8 B1 {/ j
( ]( f9 f# C4 n9 v/ }2 R+ _, Y D- static volatile int irqraised1 = 0;$ x4 i3 _) b x9 J* f: C! D
- static volatile int irqraised2 = 0;
; E0 b0 S2 E0 l" Z# n - ; f1 R, s" I7 Z; Z7 ?& t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ]% N7 A. A) P: ~- ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L/ o) K2 M) n( C! r% x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, h# g, g3 ^, H4 D
& g7 c! D6 L# n) m- dma_addr_t dmaphyssrc1 = 0;
, M) ^. }! a. V6 [( K - dma_addr_t dmaphyssrc2 = 0;* Y' l% \2 z$ ]! m7 J: f' R; S' d
- dma_addr_t dmaphysdest1 = 0;7 B- J6 V% L, z1 C+ w, c1 c( A
- dma_addr_t dmaphysdest2 = 0;
1 v! m; p+ `' n( O" Y7 h
: N# J, ]' j9 G) Z- char *dmabufsrc1 = NULL;
+ E! E' j) M3 l' @* E5 k8 ^ - char *dmabufsrc2 = NULL;) x$ U U1 j, j7 Y/ O
- char *dmabufdest1 = NULL;; A- P( E0 A0 g, \
- char *dmabufdest2 = NULL;
) G) c2 j5 \. m2 Q" ^, I
& G+ f$ G9 F. s7 M9 e- static int acnt = 512;
$ ]$ f8 a1 a7 i/ j* x v - static int bcnt = 8;* t. D! v2 F) u0 f
- static int ccnt = 8;/ i- d' L* m: Y9 m
- 6 S" w8 c* u5 g8 p* o
- module_param(acnt, int, S_IRUGO);! Z3 L" V: f v9 P0 ^) u
- module_param(bcnt, int, S_IRUGO);9 s1 [9 d+ b( L- a' {/ Q2 j
- module_param(ccnt, int, S_IRUGO);
复制代码
7 r& @: S7 o( B% L1 _ G1 [* Q" a' M( M Y- k+ J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! |8 z5 O. j Q1 x3 Q: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ?0 h3 V; _- A1 x: N& Z& D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' L, l8 u% L4 a9 ~1 E& f# A
- v9 C' g) {& B" X3 `
5 y& g9 W. p6 e* K: [: ` |
|