|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 S0 w5 @7 o8 O+ R- [code]EDMA sample test application1 d8 ~5 B; i' K) }- `
- /** \6 ?' t- `% {2 i# f' _; Q3 A5 E
- * edma_test.c$ {! `( L4 ?+ u+ @! f
- *
: }1 t& {# T' E/ y5 ] - * brief EDMA3 Test Application. L/ B s0 @0 z" m% F1 h
- *3 K1 ]/ }; D* z, K+ a1 _. k
- * This file contains EDMA3 Test code.+ C: L8 r) T) e7 |* o
- *, r' K- K+ I) {1 W. o! P0 c3 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 @) Q7 R8 J" M7 J: h/ A- K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! T& ~" D2 D( M8 b) R
- * TO CHANGE. S* g, D2 u2 t5 R( k# n1 {
- *
* ]' {) n! M8 B3 o* A% c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 }) n8 e9 g0 o; c# S8 a8 J1 K4 o& s
- *9 i9 S& H& C5 \' o. t) `
- * This program is free software; you can redistribute it and/or
7 N+ w1 h3 d+ m/ A6 e9 z3 X A - * modify it under the terms of the GNU General Public License as9 `4 v% |1 n, l7 E$ E
- * published by the Free Software Foundation version 2.
( `7 h1 y% p% Y; R - *
! I: K+ H% |/ F, h2 i5 ?$ S9 T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 D/ ? S! j s9 W/ C! y% ]' x
- * kind, whether express or implied; without even the implied warranty
& ?& @0 C( v& R9 @+ E9 g& Z+ q2 ~; S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- P. G* i$ S6 ^ - * GNU General Public License for more details.' \. J+ s! X+ T' y. b8 u# @
- */
1 W* l- ?" C m1 K7 `5 w - ( \/ M$ J6 `) D
- #include <linux/module.h>$ f+ ^9 r! w" ]
- #include <linux/init.h>% L) R" V' N' ~
- #include <linux/errno.h>
6 ~+ D! ^( H4 A# K r T6 w+ c! a - #include <linux/types.h>
$ r5 Y% i0 Z$ t# P6 s( u3 ^( W - #include <linux/interrupt.h>; a2 v6 j, Z3 A8 S- o$ N& U8 l
- #include <asm/io.h>' |$ M+ C1 \ \
- #include <linux/moduleparam.h>
- T+ u( t3 s: x+ e - #include <linux/sysctl.h>
' ]4 s1 }) ~/ I% R9 a9 r, n - #include <linux/mm.h>
, n, j8 h9 \7 d3 V2 W4 ^9 n N - #include <linux/dma-mapping.h>
6 f# l6 e; d2 U$ Y% Y4 J
2 C3 W- d4 M* Y- #include <mach/memory.h>
6 m C5 F% ?, X8 S) f) u& V& g - #include <mach/hardware.h>
+ S( Y! M! ?. P; [ - #include <mach/irqs.h>- D7 `$ n7 U, G/ |+ I% C
- #include <asm/hardware/edma.h>- R0 s' q7 `! o, M3 A2 ?
- a6 ?& X$ C& }8 i- #undef EDMA3_DEBUG6 @2 Y' M( J+ J* Z& s" I
- /*#define EDMA3_DEBUG*/! W9 Y, F. [/ y
- : p8 t; D( g5 ?3 n3 g0 C5 J
- #ifdef EDMA3_DEBUG
! y8 ?: Z! r( i' w4 R, Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; r4 M% f5 _/ v1 @8 t% w; h' e# |9 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. w& w% Y) Z1 ^6 Q+ q1 Q$ ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% u' T3 d8 e A# R; e2 A( W* k' M - #else
% L, ^0 i6 p# Z - #define DMA_PRINTK( x... )
' ?9 G) v# r( {6 @" o' z - #define DMA_FN_IN6 z- h3 I% V* B& ]0 k/ Z/ p9 @
- #define DMA_FN_OUT6 N5 O9 ]1 @4 x
- #endif$ K& {3 \2 ?) D0 c; a( a+ R
- 4 h+ O& s2 `$ q/ }; ~* E, n" L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" q0 }4 V5 \& j, _ - #define STATIC_SHIFT 3, W0 [4 u2 A0 V* S& p( o0 a
- #define TCINTEN_SHIFT 202 |2 i6 u' H3 e M. {0 D2 w
- #define ITCINTEN_SHIFT 21; a% Q0 Z% p5 `' n5 I
- #define TCCHEN_SHIFT 22
- ^3 Q6 `& @, r- t( t - #define ITCCHEN_SHIFT 23' X5 r- x1 C- F+ B
- 8 `, g- m7 @$ P- w
- static volatile int irqraised1 = 0;
* {) N, m- J r - static volatile int irqraised2 = 0;
& O. Y) H2 n6 I0 x, x
- k/ L8 A8 U4 r: E1 j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z: h' @% ]; i3 J5 z& \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 d* c! s7 l3 v, ~1 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 X1 V* f4 P5 j2 _8 q3 K
9 ?6 B: q! ^3 A- dma_addr_t dmaphyssrc1 = 0;
$ u' @9 d( K6 X, W) w; Q G - dma_addr_t dmaphyssrc2 = 0;
& b/ s# {7 A, `) F D" r - dma_addr_t dmaphysdest1 = 0;% x7 b/ U) K7 }" ?8 L) q0 S
- dma_addr_t dmaphysdest2 = 0;
* I4 ]9 x, f$ L `
) _9 Z2 i4 ^9 b3 }/ r9 r2 E- char *dmabufsrc1 = NULL;
( L: d: C4 w }) {" J7 W" T - char *dmabufsrc2 = NULL;: @/ I0 o8 C U
- char *dmabufdest1 = NULL;& r' v0 R# n% f8 `
- char *dmabufdest2 = NULL;
3 `$ V# j) n- A p1 |$ L* h$ n
9 ^3 `# W: G* t- e t: q- static int acnt = 512;) W3 o) _( `8 @9 A7 _
- static int bcnt = 8;
2 ~7 J6 {& `, T: V8 D - static int ccnt = 8;
; g* M) ^( l0 s$ c" q4 i - : `( [: x/ V% R/ m% `. T
- module_param(acnt, int, S_IRUGO);
; n* H: Y# y: F: v3 v; M7 } - module_param(bcnt, int, S_IRUGO);; e: I5 q$ S: U/ `
- module_param(ccnt, int, S_IRUGO);
复制代码
. v7 B) L; @/ L& r! W2 T8 I, Q; w: A; A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 g: g1 r1 P4 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* G7 m1 l. _! Y2 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 O% Y3 s# c! c$ h( r" ]; A: k1 P( U9 f/ o4 [% k$ ^% U; U
4 g$ Q# O. W1 o, c4 j
|
|