|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ V0 i: j% _$ @3 C- b- [code]EDMA sample test application" i$ I( ^5 ]4 U+ ?5 Z/ b% Q
- /*
% M9 G; H2 ~* ^! p/ U! y, |& b - * edma_test.c0 h4 C% N# G9 o
- *
: ? B% r; \3 O" t - * brief EDMA3 Test Application
! ^- x! p+ f% O% V - *
) E" d' {4 |( J - * This file contains EDMA3 Test code.
; z$ b. ^# w: d* N) l5 ^9 E5 I- b - *
6 n7 v/ Q/ m0 ~; f* G) V0 n4 Q2 V" _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ o& x% |4 N/ F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' v# H: W/ f5 k, z4 g- m& H - * TO CHANGE.
5 ]1 O, q' w; E, W8 I v( p - * g/ m* I, k" J2 ^1 V! `: @( ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// J, `5 b) S# ? @2 v" E$ c! i
- */ K+ ~& `) A; _6 A, G, W6 d; L0 }# G
- * This program is free software; you can redistribute it and/or
6 h% Z! ^) @2 v# S* n - * modify it under the terms of the GNU General Public License as/ X& L8 a% i( h4 Q* O: r/ ]# ~) C0 K
- * published by the Free Software Foundation version 2.: X$ g6 K' _# e
- *& S) f- Q9 d+ T2 d' T$ r5 n% b' l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 t! [7 k' C0 B: L2 h! n7 x
- * kind, whether express or implied; without even the implied warranty# J$ Y# Z. J# ]; M8 p3 h9 s5 r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' T6 j4 M3 {+ i3 t) F - * GNU General Public License for more details.' L# v6 j( ~+ o* F
- */
+ m( R# _3 q9 a1 J5 v - + Q, p) F" I4 t% ?6 ?& i! p! q
- #include <linux/module.h>; g% S% h, p# }& h& G i
- #include <linux/init.h>
! U3 V W' q/ c; _; Q6 Z - #include <linux/errno.h>
0 A3 ]6 S; O; B) s. I - #include <linux/types.h>
$ ~6 D& G4 L# v8 N; b* F - #include <linux/interrupt.h>
1 F" Y, J, b7 B2 M4 @8 G) l4 T - #include <asm/io.h>
0 L( D$ B: n0 T' S1 H9 s - #include <linux/moduleparam.h>: |0 `$ l9 {; ~9 J# L4 ^
- #include <linux/sysctl.h>
1 l! L' T+ C. G; j: w - #include <linux/mm.h>$ i0 d2 z4 s' B
- #include <linux/dma-mapping.h>
! d: ^: ?) a0 |+ a+ J+ z9 c" k
3 I$ \# C4 i) m' W' Y( O/ {- #include <mach/memory.h>
4 I$ }* a! A6 Y6 l: A; a/ p: F - #include <mach/hardware.h>
; |" n' u& O. {+ S; R - #include <mach/irqs.h>
3 M3 H, Y' L% R5 J) N - #include <asm/hardware/edma.h>; z5 {$ z# h5 j! G
- ) f5 C* ~' h8 `, T& ]+ ]/ m) N/ J
- #undef EDMA3_DEBUG
2 W# \( u0 u5 P0 H Q - /*#define EDMA3_DEBUG*/0 U. Y/ s4 F0 A; A1 Y, p) _
( [$ d0 Q5 T( @) i( c$ S! W, ?- #ifdef EDMA3_DEBUG& R8 u% h7 H1 [+ A# F0 X2 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& O1 v$ i( d5 y$ V. z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ b% s; R8 X- O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); T1 ~; J8 Q6 `! ~+ U3 P A
- #else) O7 V6 O4 D2 {( p* B, t
- #define DMA_PRINTK( x... )2 {7 Z. y4 z1 H$ W1 g' {$ d8 U
- #define DMA_FN_IN
9 z& c1 S, x4 T7 Y7 o8 o5 b) h - #define DMA_FN_OUT
6 O( K1 L5 y; G6 V' s - #endif7 a( ^* [* X4 ~# I7 `7 L% l3 h
/ e; T* t& M7 y" g! `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( E+ A. O( x' h* E D& Q - #define STATIC_SHIFT 3/ H5 r/ D) T' ^ ]! ~4 a; \. |# D
- #define TCINTEN_SHIFT 200 M3 X/ Q6 T u/ N3 i6 c6 l& x0 Y
- #define ITCINTEN_SHIFT 21
5 j6 Y5 r+ c! J* r7 ` - #define TCCHEN_SHIFT 22! J* Z8 N+ A0 I; ^1 T
- #define ITCCHEN_SHIFT 233 m3 c% i5 C% y) p
- $ t. p) k0 K7 ]0 j
- static volatile int irqraised1 = 0;
( w" O( N6 G7 C' I& z5 x8 g0 w - static volatile int irqraised2 = 0;
/ J; _5 _6 \7 L+ I* X& { r
& H( e2 H. t$ O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- @! G( y" t) z) ` C; ^5 j I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' c, H1 H4 K# s( _( o1 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^+ p- \+ m- T+ q. j% D
- g$ p3 S2 k7 X- dma_addr_t dmaphyssrc1 = 0;
; Y# T% @ i& {$ @- R - dma_addr_t dmaphyssrc2 = 0;6 @( n0 j( Y! ?% `- E0 _! \
- dma_addr_t dmaphysdest1 = 0;+ `3 u; a+ q* A' a0 ?" l4 Y- p
- dma_addr_t dmaphysdest2 = 0;
/ o# P3 W9 s# v, S' J6 f - e7 L# D, w1 d# c0 U! ]
- char *dmabufsrc1 = NULL;
' u# {3 Y" r3 Z" i - char *dmabufsrc2 = NULL;
/ e& G, j, H6 o$ Q+ T6 h- E - char *dmabufdest1 = NULL;/ }, d. r( Y" M4 t. b" a: n, k. }! o
- char *dmabufdest2 = NULL;- {5 u& _/ X. v* z* W1 ]
/ l& r- h3 U4 `7 V7 F' ^" f- static int acnt = 512;& F; { l3 t% E/ }) A
- static int bcnt = 8;8 M7 C7 s% ?( v2 W$ P
- static int ccnt = 8;
) O7 ~ N5 t0 [0 [3 ?) b
* A7 V! x! V1 N6 L/ L, u- module_param(acnt, int, S_IRUGO);
7 G9 @! O/ ]& W; R9 d - module_param(bcnt, int, S_IRUGO);
7 P4 N0 v0 Y- T4 F$ k - module_param(ccnt, int, S_IRUGO);
复制代码 % E: U8 C/ G# D! D6 @0 l+ ~$ G3 X
* K3 D. }8 p5 l: y1 R( W! f5 W9 p9 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- x9 G5 S6 n- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" a$ y% i8 I# J: O0 E! O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 _$ ~/ |$ W9 O
2 t- u; J/ a7 [, j9 ~( V
! t+ M# _7 I6 \4 q, P, v |
|