|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, N4 ^8 P- K1 ~! t# |$ f2 A* e- [code]EDMA sample test application7 l5 u' I/ N& S/ f T& s6 s7 X5 K
- /*6 k0 {" s: c3 {% h: M
- * edma_test.c* V( b8 J$ h1 [5 J
- * h$ _ d/ ~2 O. F. c7 t
- * brief EDMA3 Test Application: X6 _6 ~( i- Y
- *
2 `" O' |" H. D% L, h: D - * This file contains EDMA3 Test code.2 P% g' [# F" J# l: m4 J
- *
- `; C, y7 [* { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 e1 J: W# f# ~2 Q* i* N& \' n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 z0 k2 E2 \" Q7 P( u; H - * TO CHANGE.
; W$ e6 Y' V5 C; s0 r/ w r& }! ^ - *
# u5 h" K1 Z" m9 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- e! {8 }- p! H+ I1 X
- *" n" S6 H/ e& Q6 C6 j' q7 }4 i! P
- * This program is free software; you can redistribute it and/or
- P+ r$ S* G9 n! M - * modify it under the terms of the GNU General Public License as) q! O, m# x& I1 U# N( b. s
- * published by the Free Software Foundation version 2./ D+ m) X$ B) y4 U: y
- *0 ?/ I0 S: z! p8 q. z/ k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ O- z- {9 ~# B4 I
- * kind, whether express or implied; without even the implied warranty0 k/ v- u% m6 I# O! U2 J; o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ b1 f0 p& E0 r% s* v5 L% B - * GNU General Public License for more details.
1 [( G0 L* s4 G% a8 c' K! r - */3 e' O% o& K+ D5 O* b) o
$ L* c" U9 }% W- #include <linux/module.h>7 W7 L- {/ Y5 s7 U+ y
- #include <linux/init.h>3 L/ t N. y! H5 b% T+ g: N; w
- #include <linux/errno.h>/ }: Z6 y$ h; Y* f9 n% J% D
- #include <linux/types.h>
6 R. G1 H2 I3 Q9 U - #include <linux/interrupt.h>
/ h& B1 L: Z# p2 g2 A - #include <asm/io.h>
0 Y* }6 U# _: e1 \! ?+ u* ^3 w - #include <linux/moduleparam.h>
# @9 V# f8 F. v( z+ A7 z3 M - #include <linux/sysctl.h>5 y1 ^; e7 I7 ^8 E8 a3 `, P: L" c; P
- #include <linux/mm.h>
, |# B* f& j4 A: C - #include <linux/dma-mapping.h>- h/ m6 z4 M, T/ |; y
- ' B6 n5 L, s1 P. @
- #include <mach/memory.h># x k0 g# D/ s, X+ r+ g0 t
- #include <mach/hardware.h>
+ c! l$ r0 C5 v) ~% w/ Y: X8 g - #include <mach/irqs.h>
, Y( Z- ]& q1 K ?; T6 D3 A+ T - #include <asm/hardware/edma.h>
4 ^! ~( g3 R T: ^8 g$ q" C9 _ `
8 @6 x: ~8 B3 M- #undef EDMA3_DEBUG
* m( j. b0 l3 @% b, Q - /*#define EDMA3_DEBUG*/, c4 A$ e- X; Q( G0 k
- 9 U) r6 j8 K: b6 [
- #ifdef EDMA3_DEBUG8 ]; G! q3 ?: J* ?7 q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ]% D! H0 [3 r) q. M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& m$ [" V3 K( E2 }+ f/ V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 `2 p4 X9 j" T5 |% M! o - #else
S% h( O |% X7 G - #define DMA_PRINTK( x... )8 t# g! `! {) [" Y) I7 n# \" G
- #define DMA_FN_IN: j# W* @( }6 I
- #define DMA_FN_OUT* i; j n7 ]4 J# x5 R9 Y/ H5 t: l
- #endif
" C5 f. c) L) u - " M9 t! L: n4 P7 I% O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& k# A1 l3 }* t M$ |% ^
- #define STATIC_SHIFT 30 I% A( B* O0 O* S: {6 A' a
- #define TCINTEN_SHIFT 20
' n' N% i5 h; {2 u5 S; \# a6 X - #define ITCINTEN_SHIFT 21 z9 R7 d' \ ]& y7 A
- #define TCCHEN_SHIFT 22+ k+ P9 K) ]8 h2 U! P( W
- #define ITCCHEN_SHIFT 23$ A* H2 M, T8 o
4 J& N, v: a8 K o, a a- static volatile int irqraised1 = 0;' N( A# k, L9 q( o, ~& u
- static volatile int irqraised2 = 0;
1 x" ~; S; s; @$ I* j
% W4 n3 s0 @ {1 K7 d* c# p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; d9 V: c8 Z9 ^1 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% E5 N' ]7 C& a) v+ C% F! j/ V5 G5 L' T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T- y$ @9 k! r( U) }/ }3 ]! K3 s
6 f' b8 D# `' m! v0 j6 D- dma_addr_t dmaphyssrc1 = 0;# A ~, F% ?" t6 E' T
- dma_addr_t dmaphyssrc2 = 0;
$ U7 G8 S9 x( v& d - dma_addr_t dmaphysdest1 = 0;( }% B" v7 ^8 P3 j
- dma_addr_t dmaphysdest2 = 0;
- @5 w5 |; Y3 g5 {8 W% p B - U7 D, z- d7 J8 q" | T2 B
- char *dmabufsrc1 = NULL;
' z: C. x# m# W7 V4 w% s) f - char *dmabufsrc2 = NULL;
: a. _- }$ L' ? - char *dmabufdest1 = NULL;
. B* j) R# s. }& a, @2 S$ a& d" Q - char *dmabufdest2 = NULL;( b- w' j/ `( {% P7 t. s0 D
- v& m0 E% E( V4 \- static int acnt = 512;! Q, i7 C9 H2 U
- static int bcnt = 8;8 n4 |) Q4 l; r, U( R& f
- static int ccnt = 8;
4 W2 o' C! L3 c6 d8 O - 7 `; M+ n. T; `& j
- module_param(acnt, int, S_IRUGO);
$ E: q4 K q9 m" |- X/ M - module_param(bcnt, int, S_IRUGO);1 t* a* z1 C# |, @5 ~& [& O4 T* u3 y
- module_param(ccnt, int, S_IRUGO);
复制代码 ) C4 T( M/ W& l
6 ]$ R7 L0 d% _- k( z& n) E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' L' M9 h; @/ M' Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* p" j0 T) |$ a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 d7 s& M/ i7 g1 K9 U) K! N. X: r W/ i; g2 c1 B M
5 ?, @) S# x4 G" L5 x9 t& I8 k+ z2 A
|
|