|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' e% N$ c- z# }$ U' W8 L; E
- [code]EDMA sample test application, n, R# Z6 x% H: j- t
- /*
^9 z) s9 F% c; e. w, I l - * edma_test.c9 R+ B0 P2 y8 t( G
- *; I) v, }2 s/ o5 U
- * brief EDMA3 Test Application$ [- [) B0 k+ U, V
- *
& r% P p; f' ]6 X1 l7 I - * This file contains EDMA3 Test code.+ l( s7 ~% M: P( S
- *$ W7 V# w0 h' u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r7 [* }* M9 `2 q) g0 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# V: i3 n9 H; H! F" [& [ {6 W1 u' u- I - * TO CHANGE., K" [/ s! u0 j. s W
- *# C; S# I4 F/ A8 E" I' l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 y' m9 f: S7 B3 S; D0 D - *
1 S! i8 `7 B, N! s - * This program is free software; you can redistribute it and/or
: K" N; J3 h, f @ - * modify it under the terms of the GNU General Public License as
! o' l. a8 D4 F: q. n - * published by the Free Software Foundation version 2.
7 B: ~3 {! S+ [4 N7 t! b; u - *
( i# V( ^" Y L9 b& Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 g" ]+ U# r& u$ d$ o
- * kind, whether express or implied; without even the implied warranty
9 \1 d- w- D" i8 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 d; p- Q9 l$ ?, V, m
- * GNU General Public License for more details.
8 g4 Q5 x+ q- G/ C - */
8 H& E9 i- {2 E/ i
- V3 F# T3 v9 V/ B: f5 j7 ?- #include <linux/module.h>- v: ?7 d# |0 j( I
- #include <linux/init.h>* i( Z- O/ ~$ o+ Q! e! l
- #include <linux/errno.h>( R- G4 v9 U: I+ Y( d% j
- #include <linux/types.h>
1 `" _1 O6 T4 z5 W - #include <linux/interrupt.h>/ q, y+ H$ {0 z9 ^; a
- #include <asm/io.h>
' s2 d, O( Z% I1 M6 ? - #include <linux/moduleparam.h>) R L$ s& \6 ~5 P7 Z6 W( s Q
- #include <linux/sysctl.h>
, B; g- j) P" O3 l) w( s - #include <linux/mm.h>
# ?# v- i3 {' f - #include <linux/dma-mapping.h>
" X& P) K8 K+ ]1 w* [4 o - , P" ?; g- p2 `; ?5 k0 Z) A5 y
- #include <mach/memory.h>
! }( c2 x- N0 y) w1 M - #include <mach/hardware.h>& w, ~7 Q9 ?. v% t
- #include <mach/irqs.h>2 Q& Q$ U0 M& p1 I# ~
- #include <asm/hardware/edma.h>
! f. ~6 j0 N* {- y' F8 F - * h3 N! O/ ]' u" |. j: @
- #undef EDMA3_DEBUG
( [& B( {& n" D$ V/ S/ H% s - /*#define EDMA3_DEBUG*/% ^9 P1 {+ Y$ p b
- 5 h/ U0 U/ D* M* G8 u
- #ifdef EDMA3_DEBUG
; d/ [3 P* R9 {1 Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), @5 l) l, u+ I O, r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 _7 h, D8 f% g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' s/ P& P7 L! \* O
- #else
% e' D# W: A5 {/ B, w/ l - #define DMA_PRINTK( x... )
! N( h4 V7 F8 X4 A1 E7 E8 X - #define DMA_FN_IN8 ?* d* s8 m3 S
- #define DMA_FN_OUT
. a9 j/ v! X6 O( X: v) J- y( h3 i - #endif
* y8 K8 d: a: v3 `: l - 9 V; M( V+ M! i" i7 a* V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 F4 m1 h! \; N6 w3 t, ~, g- p - #define STATIC_SHIFT 37 j6 P3 _+ y3 V! N' a) E9 m
- #define TCINTEN_SHIFT 20
; ]9 o7 U N. F - #define ITCINTEN_SHIFT 21; x7 G7 i& h, M2 Z9 D
- #define TCCHEN_SHIFT 22
% f5 H/ Y) T" h$ L' _. t7 \ - #define ITCCHEN_SHIFT 23, @) O; o4 J* m. j2 {( X. Z
$ b2 x3 T9 z# J/ z- static volatile int irqraised1 = 0;! _- ]: e+ M$ P
- static volatile int irqraised2 = 0;& I6 g, f1 t* G6 e. E
6 M, I ~, P) g' n! T* V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& k0 p: Z- H' F# w- P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f1 Z& A9 j/ A8 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 a! Z. z- ?* q# D5 I) o
* U0 r, G6 r; ^+ K, c- dma_addr_t dmaphyssrc1 = 0;
+ T& U/ { G2 A0 @5 E - dma_addr_t dmaphyssrc2 = 0;; d& n3 i6 R. A$ s: p) q! T3 R
- dma_addr_t dmaphysdest1 = 0;
3 [* [( G# F/ f7 l - dma_addr_t dmaphysdest2 = 0;' K3 t0 ^" G9 H9 I
- ; A0 I) \6 `# R+ z# U# I- L
- char *dmabufsrc1 = NULL;
' P& a# Y w( @; F/ p - char *dmabufsrc2 = NULL;
; F5 k# }7 n: N - char *dmabufdest1 = NULL;
. s" M5 F% |2 C' t% x1 M - char *dmabufdest2 = NULL;
4 ^& V% O$ `6 t% e* t4 A ?" V
+ e/ w* a" L6 N/ L% o- static int acnt = 512;% R* b d1 Q4 u s# B
- static int bcnt = 8;2 {* {: |) A2 J6 v+ H% A
- static int ccnt = 8;; }# m, s% u9 M( p
- 2 j/ F( v' J2 B# A! e2 A
- module_param(acnt, int, S_IRUGO); _. w1 A P# X% P! L: M7 ^, v
- module_param(bcnt, int, S_IRUGO);
* V" {5 x4 v/ s: k' m - module_param(ccnt, int, S_IRUGO);
复制代码
* U3 D1 @0 b3 q6 s1 p+ ~
$ K' j# J& i; q; f* D) h' S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 Q2 k6 C0 Q8 d+ l- rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 M) K0 ?: D$ j) K* H F0 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- j/ R6 P+ Z1 N3 x( a6 N' g
1 ]6 C$ v% l Z9 F. s5 B* ?
0 r7 d g' ~. e6 E/ u3 ^
|
|