|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) P# w- t1 s/ K# d+ | G
- [code]EDMA sample test application
5 _7 v) S3 I3 e* H% } - /*
- D" R, q* S/ p n - * edma_test.c
+ h( t% _# l' P, |' X! i8 ] - * i) v' G8 g8 V, ?6 b# ?
- * brief EDMA3 Test Application
$ l) i( H( X5 F - *
- |7 B' U! j9 G5 Z _+ P - * This file contains EDMA3 Test code.$ d6 h, q7 S) t
- *
3 ?' l) L2 i) P! U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, W; Y! @2 C( j2 l8 ~# h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. K8 F. ]/ t y/ Y, i* q
- * TO CHANGE.
4 s5 _% q1 U/ k5 L+ F2 d - ** w. r( E$ B; ]2 M* U3 }' a- d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
b4 o) M" k. S( H* P+ n - *- V" G! v9 p; h1 D/ @6 R
- * This program is free software; you can redistribute it and/or e5 {2 O7 M. Q1 B" d) y1 _
- * modify it under the terms of the GNU General Public License as; E4 f+ R! ^ v
- * published by the Free Software Foundation version 2.' I( Q; L1 [1 p+ [" ?
- *3 ]# c9 h8 F/ k) F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ |: n9 d* |( w3 w* i9 F h - * kind, whether express or implied; without even the implied warranty
! v5 {; v* h0 S: U) X5 ]* @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 F8 s" t! j4 t- O0 S8 q- { - * GNU General Public License for more details.
# u" z" g2 [; V! q - */
1 k$ r5 n1 r$ A# e: O* g
0 @7 i. K/ W8 V B- #include <linux/module.h>
& Y$ z2 f2 R+ ? - #include <linux/init.h>
$ r* H' L3 h# u3 O) ?2 E5 p% G - #include <linux/errno.h>
5 X, H, W2 [! @ Z - #include <linux/types.h>
. u: S+ z6 a7 E6 ] - #include <linux/interrupt.h>. H. c9 J6 \0 x5 B( L8 r. e( ^
- #include <asm/io.h>
. @7 t! i" O1 l - #include <linux/moduleparam.h>
, Y9 [. l2 M- O9 _ - #include <linux/sysctl.h>4 [: A4 b3 _, f. t( K. M& t
- #include <linux/mm.h>
. N, D1 G) |( O2 h1 C! H& ? - #include <linux/dma-mapping.h>' V, `, u% b2 {1 y& G6 S Q. {
( p+ l0 @! y" [6 V* T5 p0 `- #include <mach/memory.h>
! o+ Z/ n& c2 q$ U& r* B) u) g; N - #include <mach/hardware.h>
+ [. D9 z: t6 D% Q7 I9 C - #include <mach/irqs.h>
! n8 F8 s: ^. @& {! X - #include <asm/hardware/edma.h>
( l( w0 D1 l/ [: ~5 U5 n: p - / _; \; }$ P! g. I/ ~
- #undef EDMA3_DEBUG
4 M5 B. n: }/ @! S" l) f - /*#define EDMA3_DEBUG*/
: @5 ~2 D) F" [/ `2 ~3 \- g - ) ?. P# p3 p2 A6 u% h, f# A
- #ifdef EDMA3_DEBUG
; x3 F8 `9 d" |; M) O- _# u7 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F) [. y8 Q, ]. n" X2 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): P5 p4 X0 k8 F+ V) T9 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); T8 Z& m7 C& ]; S% V* G# d
- #else
$ }0 O! g2 t. H4 H/ L& T - #define DMA_PRINTK( x... )9 ? M k9 X8 f8 q
- #define DMA_FN_IN
# }7 o# T& v; F) P - #define DMA_FN_OUT
0 o% l. G$ {) M' ^' ?; Z - #endif
5 v% A. V/ j0 C; E& ]' y! [+ P# ?. C
; n# z3 J+ d5 I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( U+ J9 t" @; G5 `. I, l - #define STATIC_SHIFT 32 s3 n+ R$ Q# Z; U L6 H
- #define TCINTEN_SHIFT 20* h Z& d/ F& N+ N2 F! r* g) ~
- #define ITCINTEN_SHIFT 21
8 T N' V& `3 f2 O$ l - #define TCCHEN_SHIFT 22
, U7 R" r1 F4 B+ U - #define ITCCHEN_SHIFT 23/ P7 @2 m6 y/ T: J& G& r& y
; [- a6 \. Y" _8 G+ a+ j& l- static volatile int irqraised1 = 0;# O+ \, v) R4 C
- static volatile int irqraised2 = 0;9 J( q" _ ]2 r( X
{9 K$ N5 e7 u+ |" Q! [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 K/ d7 g2 n9 v& I: Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w: a* {& E |! X p6 o/ m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ A+ U1 W. r% F. D: x5 M& H9 i9 J - ) ], ^4 a* `6 l5 r4 k7 O
- dma_addr_t dmaphyssrc1 = 0;
+ D! Z2 M; n5 X( p - dma_addr_t dmaphyssrc2 = 0;
9 E3 V# K6 K% ]$ x/ y. z g& s2 ^ y - dma_addr_t dmaphysdest1 = 0;
' v1 w3 o0 l* ?* M6 t! h - dma_addr_t dmaphysdest2 = 0;: n, o4 [. }0 c4 o2 k
- 2 J0 A9 z6 I7 y& V
- char *dmabufsrc1 = NULL;
; W$ s/ j% E2 |5 z1 ]% d - char *dmabufsrc2 = NULL;
$ ? C/ t, ~( v! Z7 ^" |+ e - char *dmabufdest1 = NULL;
4 _) v, `0 X {) |/ x8 I$ k9 t, x - char *dmabufdest2 = NULL;* D. I$ g6 |- G# f
3 V$ D! m0 i+ g7 k2 F5 A0 _) V& ~* n- static int acnt = 512;
0 Z; t! B3 t' W& z2 ?3 m7 ~, \ - static int bcnt = 8;
$ w" H9 V/ D$ [5 D: x - static int ccnt = 8;
8 V( o1 V2 J; o - ! o# \+ h3 d9 {- L# t) y8 g- c* H1 ]
- module_param(acnt, int, S_IRUGO);* ]+ M3 {, r. `& f
- module_param(bcnt, int, S_IRUGO);" m. g! u$ Q* m M# `# l H
- module_param(ccnt, int, S_IRUGO);
复制代码 , R% f1 e' I8 r6 @3 J: c
. B9 U& C9 p- ]* J! S5 f; r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Q# N/ ?" D' d* a7 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' u& p7 _% r) m6 I& o; r- d3 s7 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 S# u5 y, `: C0 E9 X" j7 a* d# {# C( X" H& d/ Z R
0 r8 x+ i, Q7 y+ G$ s5 m
|
|