|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ]$ C+ H9 N! n; m4 b& D3 Z
- [code]EDMA sample test application
% J5 q4 K: j2 D; z - /*
. x1 L! [+ L# E0 F( u0 ` - * edma_test.c
2 h% J' B* n2 R2 S4 a+ ^; c3 J - *% x3 N j* P" y7 R5 r; T
- * brief EDMA3 Test Application( h2 C$ x: H, B' i5 w/ u4 T
- *0 ]$ @" E! k2 {$ ]. _+ d* |
- * This file contains EDMA3 Test code.
, ^8 s% V; F/ p1 r: H& s7 V2 F/ m - *
+ b( I0 k5 x) n8 a, L; b" g9 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ K" E" y3 `# Q. l3 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, v* ?% \6 @3 f: U2 m* C' W) L - * TO CHANGE.
( f4 G$ l8 Z! q1 j - *& p4 N, J! P( W& a7 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. F2 Y' |9 m7 c( K) r - ** M* l" F/ l1 g0 ^
- * This program is free software; you can redistribute it and/or" `7 f; h* a0 @5 |& o8 {
- * modify it under the terms of the GNU General Public License as
/ p! K. U, @) E1 w - * published by the Free Software Foundation version 2.
9 A4 [* j( W9 B: z5 H - *
+ S# q, W* j2 F% e1 k7 T5 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ c4 h. Z) t, b% c8 e! ` - * kind, whether express or implied; without even the implied warranty
1 T* M& N; _$ y, U5 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
p+ n( X+ T9 ~& r) d - * GNU General Public License for more details.$ C2 | k' P) a7 U7 F
- */
. N5 \7 j1 w1 J# p3 o2 V( F/ B5 ^ _ - : z- L& T! r1 R1 L0 B
- #include <linux/module.h>- f. K( Y. h! E, c. c y/ l
- #include <linux/init.h>
- I# t7 t6 `& e; w - #include <linux/errno.h>
% @ P4 m" I& f# N8 i; c7 x - #include <linux/types.h>- m; ~% Q9 s$ B9 Q, v/ A+ Y( i
- #include <linux/interrupt.h>/ M# {6 P+ G W+ }
- #include <asm/io.h>
6 w/ I; g6 S; m) z% I - #include <linux/moduleparam.h>
( v. y5 R4 w$ H* \& B( ] - #include <linux/sysctl.h>3 k0 ?: {) @! }" H
- #include <linux/mm.h># c, x+ ?' a4 |) ]6 f
- #include <linux/dma-mapping.h>+ q/ j5 K/ G5 ^7 K0 y( s' W
- $ g- c! h# K% r8 Z
- #include <mach/memory.h>
; n+ u3 ?) m: l - #include <mach/hardware.h>
1 k: z; i3 Z, s( X - #include <mach/irqs.h>
# y6 O" m5 A# J7 M7 Y - #include <asm/hardware/edma.h>0 ?& Z# i: @& x" E- S
- ( m& h; h$ J' z! L& z
- #undef EDMA3_DEBUG! E' G* W+ J* q1 e+ N ^- ?
- /*#define EDMA3_DEBUG*/
6 t: D. e* q1 |
! z" L6 K4 |$ _# A/ U T- #ifdef EDMA3_DEBUG6 Q9 A6 H8 f& T9 m4 a7 [- z& S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ?! Y: G+ U) n) ~; \, K) f: b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% q7 G( k2 M, H9 A, X, v: Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* M' s- l3 A4 i5 G# g1 b
- #else! j6 t6 X0 L1 w- b( {+ g4 Z
- #define DMA_PRINTK( x... )% T1 M u/ S; [: ^
- #define DMA_FN_IN# d+ v2 _( R+ _$ V4 z5 s
- #define DMA_FN_OUT
6 i& r7 h' @6 Q* z: m - #endif6 V) {# b i6 Z+ g7 j% w
- / D: Z' |4 G8 Z ^- Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' C& H8 n) {% N/ h }0 G
- #define STATIC_SHIFT 3
6 C$ b% e1 K& W3 c# d3 v - #define TCINTEN_SHIFT 20; W- ]- n2 j" T
- #define ITCINTEN_SHIFT 21! T1 }6 \4 X) h% a+ v% j
- #define TCCHEN_SHIFT 223 @/ u: i) d3 b, E% S0 _% m1 O
- #define ITCCHEN_SHIFT 235 C0 u# K& g' o7 D
- 0 P% M |2 B; i" _8 m; l% [4 J
- static volatile int irqraised1 = 0;
: a9 M2 C! L5 ~. ^, p1 e - static volatile int irqraised2 = 0;( b; A( L1 M& B/ H
3 F; Q1 {( U2 E; x2 d. _. \% s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 {+ k! w- X& C7 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; S4 A0 [/ V& r7 t0 O, T' f8 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" g# I9 X4 ]) k% V3 i; _' U
( g; z/ m* d# z9 _/ J- dma_addr_t dmaphyssrc1 = 0;
' D! {# Y+ f/ Z4 } - dma_addr_t dmaphyssrc2 = 0;6 t8 `/ s' l5 V3 k" x+ C3 {. r
- dma_addr_t dmaphysdest1 = 0;
. V* \$ T$ K) [1 f& w - dma_addr_t dmaphysdest2 = 0;4 S! ]( ?/ n$ j, D) H) G- K6 H) b
- * b4 w7 W: S$ \: U N0 O$ u$ Z2 H H
- char *dmabufsrc1 = NULL;
( v+ z/ R! l( N: L/ Q) P. W - char *dmabufsrc2 = NULL;; ^ s# q) G# W$ b' x$ S# n
- char *dmabufdest1 = NULL;
' x% G% N1 f9 Q. k. w; {1 h& B - char *dmabufdest2 = NULL;! i( g. X0 u ~. |( s
- C- V, s+ Q2 d) U0 d P7 Y7 P
- static int acnt = 512;
M- M: S3 P& W4 w: i% k* l: N - static int bcnt = 8;9 |" D. y3 d c
- static int ccnt = 8;- a* n) u' t- w1 X3 n& B; E( r+ g
& ~$ a; V) N' b- module_param(acnt, int, S_IRUGO);, H1 ?# e3 n& C% [3 X, N
- module_param(bcnt, int, S_IRUGO);, D% _6 m$ Z8 |. ~; m; j2 z7 R$ U
- module_param(ccnt, int, S_IRUGO);
复制代码
7 S6 O6 p% t! L' f
- p# Y9 D& S$ s2 K9 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; |6 C" U3 _- R% L: P( J1 `. ]" @# r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 F6 t- b$ G0 X% ]( ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- l# J B; ~: a5 w0 m, e) ]8 c) P$ d
! n( ~( d+ Q' }% b; Z
|
|