|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! U9 D: z# c1 q& d+ |
- [code]EDMA sample test application$ _) M8 D2 C' w' X# t B& h. o
- /*" H9 ]+ Y+ o W8 k6 J& ?' w! W
- * edma_test.c) f; q; F7 @; q$ n
- *& Y% x f" E' n( p& S
- * brief EDMA3 Test Application7 q- `' ]5 H% o: y6 L: k
- *. k1 l2 |* H" c( x3 s: L
- * This file contains EDMA3 Test code.
$ _+ q3 _& [, T) P0 w! w - *; J+ m% |* m& l8 H4 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z% d# O9 a- b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% [5 w4 g8 M( G - * TO CHANGE.
2 {+ q3 ^0 I: Z8 P' P: `. O3 W; j - *: \5 R; k( b; o0 g2 l9 u( z$ }" `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 b$ q _! p- Y - *' p6 ]7 g+ H- m/ {# } v4 v- i) x! J
- * This program is free software; you can redistribute it and/or
2 X( `8 \9 _/ v$ ~, D6 k! t5 c - * modify it under the terms of the GNU General Public License as
, t( Q8 ~ D3 s4 u1 s: D( ~$ ~4 E# g - * published by the Free Software Foundation version 2.' @! d; L! X/ Y# j7 h
- *
7 }; u, G: z1 E( a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 v/ Y' K5 _) m0 X3 J2 J - * kind, whether express or implied; without even the implied warranty
& X" ?, Y9 W2 v0 `* D% O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 \9 b( n- m7 T* c, t! F8 w - * GNU General Public License for more details.
$ n% i& t* p$ ] - */
; a; d6 i' ^, |5 L9 L( o) F
7 N# X& \& ]6 Z; M; i6 _- #include <linux/module.h>: j( J- H9 F N6 g# ?* y
- #include <linux/init.h>
$ l0 M, g8 W" r4 s/ x - #include <linux/errno.h>8 t5 K7 r, Y7 {! l: t4 q
- #include <linux/types.h># e3 h# J) z7 l
- #include <linux/interrupt.h>9 E* H: o8 E) c- [5 o: o( b
- #include <asm/io.h>
2 R, W5 }( W+ T, ?; w& Z - #include <linux/moduleparam.h>5 B. P( A8 [: ^0 {$ \
- #include <linux/sysctl.h>
' R+ K% w) U3 S - #include <linux/mm.h>- P k- |+ [( o3 C, ]
- #include <linux/dma-mapping.h>" z ] u7 i2 |, G# N5 \' w
6 p! A: D( G0 Z- #include <mach/memory.h>
: n0 Z9 E ^& n - #include <mach/hardware.h>: O7 j, n7 i9 i6 J
- #include <mach/irqs.h>6 U3 L% m& H! k
- #include <asm/hardware/edma.h>
* w C1 L, Y* L/ c, I - 2 x/ k9 v& ^5 @6 P( M
- #undef EDMA3_DEBUG3 a2 X( T0 w8 f# C- _8 v+ i
- /*#define EDMA3_DEBUG*/
$ _8 T% H I) h9 j! |
: s) ~! ?4 I& K1 t& Y- #ifdef EDMA3_DEBUG+ _3 u) \0 ~& E3 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): y9 Y$ B1 X. w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! ^5 T! q# s# Q7 V, |: b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
s6 R( b- |/ s7 w$ f) i - #else
U/ S8 G! @* @4 l0 { - #define DMA_PRINTK( x... )
; Z) e" b6 w& p - #define DMA_FN_IN
2 b( A+ `6 V8 `4 W - #define DMA_FN_OUT) t8 M) d1 ^; z {# Y$ I1 A, r( z
- #endif) i9 M& @% c; ]" A8 r
- : O# d$ u% g9 T) D7 m* x5 P' @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 E' J5 B0 I; ]* G1 R
- #define STATIC_SHIFT 35 x: m& K* ?, R8 M: B& b
- #define TCINTEN_SHIFT 203 E6 P: G/ R0 u w9 O, X
- #define ITCINTEN_SHIFT 21; j$ c( I) K. [3 C6 Z
- #define TCCHEN_SHIFT 22
+ E* T( `4 w1 J" t+ X8 m - #define ITCCHEN_SHIFT 23
2 X1 X, m8 R; O& e - % U+ u' I% X9 r. Z
- static volatile int irqraised1 = 0;
+ W6 E# P" e) h! I) @1 r6 f" d; q - static volatile int irqraised2 = 0;
6 f2 J6 d) N2 I; f8 | - 0 C! L" s- e- |* f! J0 n2 h) J) W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q$ Q: b7 \) N! R' C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q7 _7 w. A6 F5 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 |) x# Q, `0 x+ Y1 v
/ g* C& J x0 e. c; @- dma_addr_t dmaphyssrc1 = 0;' Y! i9 _& O, w u" O! L: N) s m! D
- dma_addr_t dmaphyssrc2 = 0;
4 @( s) O, Q. ?1 t( m" k, ~; B1 D8 ~; n - dma_addr_t dmaphysdest1 = 0;. B8 \. `& A- w w2 ^+ ^3 x7 E
- dma_addr_t dmaphysdest2 = 0;
+ h- D- F& g8 N [2 S: N' G, C
X3 @/ O: W5 U3 [- char *dmabufsrc1 = NULL;
& \) H6 ]4 }, ?. E - char *dmabufsrc2 = NULL;7 Q, t ]. i/ m+ D
- char *dmabufdest1 = NULL;" J; n/ P' ^% o7 h1 `7 B" `3 O
- char *dmabufdest2 = NULL;
9 {' l6 N! J! [! ]) b9 x/ X1 @
" z0 P$ x8 W/ c, p3 z- Y3 r- static int acnt = 512;& g8 ~7 Q1 f& p) C1 n W5 w
- static int bcnt = 8;, s2 R" C# R! p) f# p$ J
- static int ccnt = 8;
" S3 s2 }, u1 U, V. r" k8 H, \
% z, c, t0 _3 R; X: P+ o' T- module_param(acnt, int, S_IRUGO); \ C; b2 \; k n$ o" R" \; e
- module_param(bcnt, int, S_IRUGO);
+ }' R6 ~3 N+ C F* E - module_param(ccnt, int, S_IRUGO);
复制代码
4 ^* |. {/ G+ ^1 ^! Z4 w
' N+ Q' V; G8 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" }2 }# l% i$ e/ \5 x- v. L1 `1 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ?: g& d. Z: [3 P- W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 Q, C; z( h: Q# ^
9 Z3 Q1 w" t2 i) k- v7 s% d' o
7 k5 [% J, |2 O5 x" n. }3 z6 t
|
|