|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- j/ U! N# a5 [1 ~2 a8 X3 \7 Q. B; f- [code]EDMA sample test application8 \/ | @# e( T, u' q
- /*
2 R0 Q& V9 w( C- m$ Z: W - * edma_test.c
0 a# ~! r; r# A$ f9 ?& l - *
( R) I& e; i' I7 c* Z" N - * brief EDMA3 Test Application
. a7 x; u6 G: d4 ]2 V+ d) U" p4 c - *9 X1 R, g- i( G5 n a
- * This file contains EDMA3 Test code.
. [ r1 G; B2 [2 t/ | - *# C- B, \ d0 I+ A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 K" _" y: o! v6 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ^+ l) d+ J7 E5 I" i- ]
- * TO CHANGE.. W2 x$ I8 _6 j, m& d
- *% p7 K! t9 R1 k5 c& r& C' w+ w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q0 D4 C; |, g/ p) i& i+ L
- *% v5 b1 i2 Y$ D( Z
- * This program is free software; you can redistribute it and/or; j8 J/ }5 I& J& v
- * modify it under the terms of the GNU General Public License as) m/ C- J9 o5 V4 @; y
- * published by the Free Software Foundation version 2.' X$ I1 C/ Z3 M7 v; r( z, \ Q5 p
- ** X1 u- @% @2 ?1 d, ^4 v" t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ]6 X1 [" R: J y
- * kind, whether express or implied; without even the implied warranty
: {7 E: W7 ]2 H+ q* V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) m+ G" f% y/ n
- * GNU General Public License for more details.; Q' `- V0 D" [) v5 a1 s
- */
" K% c3 S5 m0 Z" W$ p6 _ - * v9 M) B/ K2 Z7 M' J
- #include <linux/module.h>/ x* Z6 g; i1 J& N$ }+ c. w) ?
- #include <linux/init.h>+ p4 Y% [9 w; b
- #include <linux/errno.h>
( Z: w# N0 ]& m* b0 b0 z B - #include <linux/types.h>7 M5 E. f. Z9 j& }
- #include <linux/interrupt.h>( ~: \* D9 k# q) H
- #include <asm/io.h>
! t+ m' l Q3 s9 s8 q% @ - #include <linux/moduleparam.h>5 q6 W5 z: v b
- #include <linux/sysctl.h>; ~5 t/ q) o& ?4 I# X1 q: G+ u
- #include <linux/mm.h>/ c. V3 U9 b4 l$ I1 {! j7 ^
- #include <linux/dma-mapping.h>
8 n) e: x( F# R1 O - ; ]: v" X' y% ?6 s
- #include <mach/memory.h>
2 ` i# `& _$ J3 ` }2 [- V, N - #include <mach/hardware.h>% Z# r \( u6 d k
- #include <mach/irqs.h>
! z! s* `* E7 P0 s$ K2 F - #include <asm/hardware/edma.h>6 I+ e8 d# C _; n7 e4 d3 y8 j
$ h2 r3 d" d7 m( L4 n) l+ R2 B- #undef EDMA3_DEBUG
2 s: C& [6 o" M+ u - /*#define EDMA3_DEBUG*/
2 X" ]) r+ r: T; z9 H - 4 o8 r$ A$ N) o9 H* _
- #ifdef EDMA3_DEBUG
) T, k( G7 W2 H+ T& b5 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
N7 l$ d% `) i9 N: l1 T& n: s3 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 H8 g* p: C! {' \: A" B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ q; U( E3 n3 p1 J
- #else
7 h- N* m7 K0 {( l* z - #define DMA_PRINTK( x... )( V1 G! e0 o) _: |& B
- #define DMA_FN_IN; U0 F+ p6 q" a
- #define DMA_FN_OUT
- t8 {3 E2 J* b( |* k7 r - #endif& f$ x" I$ g4 ~" f0 X
' [0 v5 M$ H' Y" f" N+ f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( I' t1 D+ U* s) P6 }, P7 w - #define STATIC_SHIFT 3
, u: |' v( H8 ~1 @6 c - #define TCINTEN_SHIFT 20' X. X# e8 [5 p# d, \2 X9 M
- #define ITCINTEN_SHIFT 217 V. ]# D* `( H, t
- #define TCCHEN_SHIFT 22
Y2 J3 j2 ?% [2 c- r! @ - #define ITCCHEN_SHIFT 239 {6 ]4 S0 W9 j8 }
- 8 P# p% c1 |. ?/ o. f' _' O
- static volatile int irqraised1 = 0;
$ U0 R% E2 u3 |: w - static volatile int irqraised2 = 0;
. N7 h: e7 r! P2 @* ?
6 |( w" [& v% u; g4 {; C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 @1 L! Z, X* g/ [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% s# g- Z3 \. O# J+ `( ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J }3 e2 a; z8 L* C$ n
- 9 ]6 ~5 p" J1 `( y. c
- dma_addr_t dmaphyssrc1 = 0;# m6 O+ D; C3 A+ o" W! W% ^+ A
- dma_addr_t dmaphyssrc2 = 0;& K; V" v* f9 _0 |- Y
- dma_addr_t dmaphysdest1 = 0;
, \ k/ T4 S5 a5 Q$ z& k4 ` P2 r - dma_addr_t dmaphysdest2 = 0;
P. I w: k: o- v3 q" {- Q3 M( x
- ~* K6 @6 U$ `1 x3 A7 E2 x& x% Z y- char *dmabufsrc1 = NULL;$ C. v0 M1 @ y( z
- char *dmabufsrc2 = NULL;
9 _0 l& i' N; H$ C: g( L& {+ m - char *dmabufdest1 = NULL;
" C, Q4 ]5 U) A7 t# I - char *dmabufdest2 = NULL;! @! R$ F9 p# N
( g! O+ w+ i! X& v, s1 a) A2 p! J _- static int acnt = 512;& n& d, x L" q i" i- x Y
- static int bcnt = 8;
" q+ G" w1 i+ V" j - static int ccnt = 8;
. T1 h! u; W4 k9 ^4 b& u
" n& N# U2 s. B, }- module_param(acnt, int, S_IRUGO);5 i$ ]5 K# o5 S/ q8 m
- module_param(bcnt, int, S_IRUGO);
& S* W# X* H. h- \ {: s3 T - module_param(ccnt, int, S_IRUGO);
复制代码 ; x3 D9 f5 {) Q3 X
6 s- A( S4 r- [8 U2 T2 Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' o7 v0 b5 m% |( L4 z5 A+ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 k2 o- \+ b: _$ W6 |# F" P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% i/ H) e% Z; m3 F! L5 U& X4 |
, J" E% j. X0 w/ K0 W
/ ~# l) n6 K9 x; u0 t I- \9 p3 x0 K$ O |
|