|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' S2 q) B5 O1 `( [" O# j! I- [code]EDMA sample test application
2 x7 ?3 \ F# \( Z1 ]2 Q$ @ - /*
- ]- A5 j) t: i4 p) ^3 E - * edma_test.c; `; ^, t+ M) D% d: }0 N8 p1 [3 U0 C
- *6 t' _6 Q/ z" Z( x
- * brief EDMA3 Test Application
$ n2 Q: z3 L, W5 r; |7 N5 |$ n/ r - *
# L, b! f# ^7 q# ^! ]7 M. o - * This file contains EDMA3 Test code.
$ f% a6 ]2 l2 m/ O. @# k" g& g - *" T5 d/ j) {$ Q1 i; B8 k* Y: K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: s2 d; A; l! P7 _. |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 f, j* [8 B8 l* C - * TO CHANGE.
* r' }; |+ m7 |0 R" l - *
1 n( G8 W. T, b# }; k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 }) @ `4 ]6 [ - *
1 }! ?; o3 M( J' }3 E! x - * This program is free software; you can redistribute it and/or
2 p6 i7 B7 L& M5 R5 l - * modify it under the terms of the GNU General Public License as
; ?7 Q) r( n: u9 \( q: H% G# M. \/ g - * published by the Free Software Foundation version 2.: j$ i7 A0 S" [$ P; m8 e. M( @( d
- *6 G3 {3 G* @) u: S0 O9 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& r7 _" x3 s8 B$ @. `' j" a6 C
- * kind, whether express or implied; without even the implied warranty
8 ?' |7 }2 D0 x9 N8 q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 \8 N6 J4 {7 @1 z
- * GNU General Public License for more details.
: }. r K! f+ H" J - */
9 ^! o! ^6 n9 w- E9 @
) I, }$ i0 J" C/ h! N1 }- #include <linux/module.h>) v' W' a+ q6 G: Y( ?8 U* P/ @
- #include <linux/init.h>
$ W) z) v# V7 n/ g - #include <linux/errno.h>
9 _( G% i1 V# w+ z1 G" t% [: X - #include <linux/types.h>
- p* ]9 p( O) K6 K - #include <linux/interrupt.h>
7 @4 M- e V y4 I - #include <asm/io.h>
7 |1 e. B5 `3 P) d - #include <linux/moduleparam.h>2 k. R2 _0 s+ ^$ B$ u
- #include <linux/sysctl.h>
+ M1 H0 @0 l* G. v - #include <linux/mm.h>( Q( r3 |" C j x! l8 K( z% R% A
- #include <linux/dma-mapping.h>
/ a& K% w" a! A/ H6 h5 P
0 t. T6 R4 y: w$ L2 l( l9 }- #include <mach/memory.h>; w+ M+ C. q% V
- #include <mach/hardware.h># v3 o$ o& H0 l- n1 V
- #include <mach/irqs.h>1 v+ S" l8 O- o$ r% R
- #include <asm/hardware/edma.h>. y T& i: Y% h% R
- " k" K X, @/ n4 I; }5 S3 M
- #undef EDMA3_DEBUG
: l) `3 w8 x7 z1 g - /*#define EDMA3_DEBUG*/
( \/ C5 T4 Z3 I U+ I - ; l+ b t7 j0 _+ L* x$ s- `
- #ifdef EDMA3_DEBUG
5 B# I# e* H; l0 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 h+ L3 F4 h8 d9 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( W* ^& f. G. x$ O K* g$ a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ @4 H# K0 c7 ?, S$ j( W/ D
- #else; c: f k9 ^6 Q' T* _+ ^, H; d4 _
- #define DMA_PRINTK( x... )
1 g6 E" G$ T& ?5 d - #define DMA_FN_IN# n# {, I# A% Q) @2 z" Y
- #define DMA_FN_OUT
2 d8 \ H/ T6 I0 C- H - #endif* l* p7 f+ `+ q: U% v% R
- 4 I6 P8 s% m6 Q/ Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). X/ s$ U5 E* o) R4 N! {
- #define STATIC_SHIFT 3* u5 }) y5 y# v6 k. w+ f; D
- #define TCINTEN_SHIFT 20# A% y u D6 e
- #define ITCINTEN_SHIFT 21
- C7 R& Z3 z; Y# F - #define TCCHEN_SHIFT 22/ D+ j0 E7 v; d, q7 Z; ]% h* i; U
- #define ITCCHEN_SHIFT 23: y: W4 z7 }9 y
- * B% a0 Q! w. d! q2 f8 r8 j3 Q! R
- static volatile int irqraised1 = 0;
7 p1 b( \1 |% G% H - static volatile int irqraised2 = 0;; b( |5 [5 m6 ]3 z& M# ~/ _3 V" d
: c9 i/ w Y! W; ^$ h" u9 Q9 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ V8 a, P8 n$ |& e+ e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n, K$ F7 W( Y8 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G2 U( ~( A9 _* o+ `. n
# w) W" h# a* s" M; }! [- dma_addr_t dmaphyssrc1 = 0;
0 K4 a+ v" l4 B7 s - dma_addr_t dmaphyssrc2 = 0;/ W5 k7 T' t, r& x3 h
- dma_addr_t dmaphysdest1 = 0;6 @% M4 f6 @: h1 c
- dma_addr_t dmaphysdest2 = 0;0 p5 h; h- J5 Z7 a. J
- # f& C% q3 v, M8 {* j
- char *dmabufsrc1 = NULL;! p& O6 D8 e6 R x2 S4 n5 M+ S
- char *dmabufsrc2 = NULL;
& V f9 m* C4 S - char *dmabufdest1 = NULL;
! S+ x! {0 k8 r - char *dmabufdest2 = NULL;
: y! T) X# Z2 i% U B) G4 G+ G) }
* n2 d% E _+ ^$ w) v- static int acnt = 512;
. K) `8 m$ M7 ?! |0 B - static int bcnt = 8;
5 c1 Q, X! p4 `8 K! T; s4 y0 B - static int ccnt = 8;
/ g: Q; F4 Q/ V! C
+ J! n0 b, }. Z& Y+ Q/ \) w- module_param(acnt, int, S_IRUGO);
4 W7 y( B: W% j/ D5 f9 v! o: b - module_param(bcnt, int, S_IRUGO);
( D% B8 B8 n Q$ J1 Z% X3 R - module_param(ccnt, int, S_IRUGO);
复制代码
: T4 Q; E5 H3 L: |8 u. A' P
6 K& A \9 C+ ], y) S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Y" Q! ?- y5 r' a* \7 q* w. A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 x- f9 K5 C" o+ }( _3 Q$ d9 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) c% h6 P d3 M
/ c2 V6 m7 [$ S/ v; {) R8 y# z9 D# x4 u: f
|
|