|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 k! F' r0 x8 t( [% Z4 D2 T; h0 ]0 m- [code]EDMA sample test application8 y/ B& S! g3 r1 h' W3 A
- /*
3 }9 c" k# b9 O+ x! R+ B) [ - * edma_test.c/ {: D+ N1 |: e. m" a
- *
5 K- B1 j% M$ k - * brief EDMA3 Test Application
; R4 |: k# p# v6 ~. S6 T4 V - *" j1 U8 x" r- S3 g
- * This file contains EDMA3 Test code.
- l2 D" M7 s/ @* T$ Q - *
/ o6 C9 ?. r* s- B3 i$ v) U' | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- p3 S/ O6 f+ a8 z; R% a6 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 F) f! b# g! i( m3 Y z
- * TO CHANGE.
9 t0 _1 e2 H) G' f+ ~. t% R5 J: t - *6 a& _$ B7 t. _( I `0 J& j4 D" o7 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' [$ [3 J$ Y2 R2 B - *1 ?9 s4 R+ O9 [' w
- * This program is free software; you can redistribute it and/or
. _0 ?* r" q' C0 M* L6 k# l+ p - * modify it under the terms of the GNU General Public License as+ I) k1 }* M6 H" F
- * published by the Free Software Foundation version 2.+ n1 J! b* u0 T ?1 a
- *
\/ [6 m7 U: a! T: n" B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 b/ N+ K% \% b* L; V5 W
- * kind, whether express or implied; without even the implied warranty
+ f+ ]% {: q' b8 y5 H/ _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( ]. ~0 M5 L% w' v2 C+ D9 U
- * GNU General Public License for more details.8 v2 R! ^+ c4 b6 o7 Q" W
- */! c# o0 c1 f; B
: t w1 _/ H" T0 p- #include <linux/module.h>+ Z4 Y+ s1 v2 u5 B0 E+ R4 C
- #include <linux/init.h>% @5 q7 H4 I( r8 K$ s1 r
- #include <linux/errno.h>/ p. D& w3 U* a% B, I, R, T2 D# o
- #include <linux/types.h>1 h9 Z3 S/ ^5 q0 G7 j& F7 y
- #include <linux/interrupt.h>: r( ?' E! l6 a8 W6 g! J! d
- #include <asm/io.h>
" k. G6 ], u- g, W4 Y! z0 X2 T5 h - #include <linux/moduleparam.h>
# q/ q: L* @, E3 X - #include <linux/sysctl.h>
0 Q7 v% Y! K9 u4 h; W4 M - #include <linux/mm.h>
0 C5 h' A% {9 {' W - #include <linux/dma-mapping.h>7 H A4 K% N1 e0 H- t# M- B
- 3 r8 Z" V7 W5 Z4 F3 h. ]* q: `- H- W
- #include <mach/memory.h>
7 O v9 K" ^1 \: m1 F* N5 [3 z - #include <mach/hardware.h>
0 B1 b& i1 |% u! Q2 C: Q# H3 v - #include <mach/irqs.h>
% y; e7 W N0 a - #include <asm/hardware/edma.h>
% z+ ^! R$ |2 O# {. x
" C' d+ s x* M% B- #undef EDMA3_DEBUG
" C6 e/ f4 I% |. E - /*#define EDMA3_DEBUG*/% X1 A$ v8 _- l. V# R% A
" [8 _. ]& C" O3 f& x: @5 k- #ifdef EDMA3_DEBUG7 c, S: ]5 M3 y: q8 ^/ | A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- I8 T( K6 Q% A; r* f: ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( V; J6 r7 |- k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 Q- I! ]" a2 |/ [8 ]9 y: W/ n* d - #else
1 _9 w# [2 V1 h0 m N1 v/ u; d - #define DMA_PRINTK( x... )
. x- y% R0 n/ y* |$ P4 P - #define DMA_FN_IN
. p( b3 a1 U0 x, T1 Z# y% j) [ - #define DMA_FN_OUT
& `: N* B; S; j - #endif
* U2 K+ w& v( U1 n% C/ c) u - k* Y: h E8 J& O* N2 Y: \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 s' K, Y: E2 F# G, V" L
- #define STATIC_SHIFT 3* ]( d8 j- T0 i' {6 s5 Z5 D+ c% X
- #define TCINTEN_SHIFT 20& Y3 j- M1 Q, c& E' X8 z! j
- #define ITCINTEN_SHIFT 21
9 u' x& d0 ^3 b/ }7 }# r* T; @+ @ - #define TCCHEN_SHIFT 224 p& s, U0 N5 G! |) Q
- #define ITCCHEN_SHIFT 23- J0 H- w8 @2 @3 c+ k; ^
$ |9 @2 G9 c v- static volatile int irqraised1 = 0;9 V, I+ z( @' `
- static volatile int irqraised2 = 0;
! Z% Y$ [. g+ \5 i2 B. z - ! {, |8 [8 Y/ z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
u2 D% \) m. @/ T' V; {: L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ~' F, b/ e) Z7 ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {3 l2 T8 [3 P4 J
- ' e, o& _$ V; J* H) S* z
- dma_addr_t dmaphyssrc1 = 0;9 M& Z+ z" P- e3 O* C* C
- dma_addr_t dmaphyssrc2 = 0;1 x6 [' Q* `6 w6 W+ q
- dma_addr_t dmaphysdest1 = 0;: H! {+ F$ A# j _7 i) E1 p& w
- dma_addr_t dmaphysdest2 = 0;+ w- C+ f' f7 m5 M8 b
- - {4 W% z3 B8 Q4 s: o# Z) @
- char *dmabufsrc1 = NULL;
7 G9 @/ p4 j: G: ?0 L$ b - char *dmabufsrc2 = NULL;+ |% z" i) b1 ?
- char *dmabufdest1 = NULL;' N# x7 c; l$ i& U
- char *dmabufdest2 = NULL;7 J6 I, `; w0 }. I0 I
- 9 c, i0 v; t( t* E+ C/ ?9 X
- static int acnt = 512;
% {, W9 h1 c% \8 \. s, G - static int bcnt = 8;
. P5 K- I& j4 ^' g- v1 n0 T - static int ccnt = 8;
+ S9 L4 T' O, H$ \5 M. _% `# m/ U - . A: |, W% C2 [9 `$ m. i6 M R
- module_param(acnt, int, S_IRUGO);
- |( d" ?9 |1 v! I% F - module_param(bcnt, int, S_IRUGO);
) ?8 E) K. G$ A: @6 i! s2 R4 I" U6 Y - module_param(ccnt, int, S_IRUGO);
复制代码 ! n3 J# N8 l: n3 R3 K
; Z: M5 W* n; }0 @* j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J8 k/ w- M, j, z% Y- k
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- z) J& t, x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 k/ Y8 A7 b, P$ z' m0 B' N
! c: `# k* m$ R: i! l
* _- p6 l7 U9 i
|
|