|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , o' V$ y8 P& i* k
- [code]EDMA sample test application4 m# ~# I4 B+ `; i: U4 t5 C+ q! K
- /*0 O4 [( D) Y2 E- {
- * edma_test.c
. @. N M! b/ h6 r8 b; z - *
% S( {: ^) N7 t+ M) s6 F - * brief EDMA3 Test Application
* n D R7 [0 e, G( T3 u+ ?; \ - *4 v2 d$ |) } }3 [1 Q# O% @
- * This file contains EDMA3 Test code.6 z# i0 _$ e/ W0 q, n4 W1 K! e; w
- *
* `( V# E1 Q' ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! O7 t. [# s f4 Z5 d- `# B5 U% D5 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* z5 g/ V: f) g - * TO CHANGE.
! e# h" @& k3 W" E0 r' E5 W - *7 l& S/ \# N+ {+ }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! T9 K) Q. w1 x$ k7 ~7 l7 x3 r6 Q - *0 \5 _% K3 s, E7 p' C$ p& h" N$ E8 I1 L
- * This program is free software; you can redistribute it and/or
' e, s2 I* g4 ~; t, M) R - * modify it under the terms of the GNU General Public License as
' U3 Q* @5 X8 X1 @, K9 L1 _; I% H4 Y - * published by the Free Software Foundation version 2.
( P2 f6 z/ T5 i$ W# N$ m6 n2 Z0 [ - *
7 n( Z& ~6 Z# I1 }$ r& t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 c) M% g% A+ g. g }
- * kind, whether express or implied; without even the implied warranty
1 |/ f3 K+ l, z1 m0 x3 U+ f. T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! p9 F( @1 U/ i# f5 s0 a" e6 }1 H/ r
- * GNU General Public License for more details.; T% X$ W3 I, Q; s4 R
- */
# U7 P) @4 A2 \2 m7 m. Z2 z& @9 F; E* B - + x6 [' q' r$ [* v2 ]2 v" i2 c2 P
- #include <linux/module.h>+ c1 c- N. l& E! I, t' r
- #include <linux/init.h>
: i( P( g% @3 V+ J6 F! h, L - #include <linux/errno.h>- X4 d! H% k' K9 \+ T4 I; k
- #include <linux/types.h>6 g: f5 T; _7 Z
- #include <linux/interrupt.h>1 K; X( a1 M, n0 ]) w' t
- #include <asm/io.h>: s4 L3 f8 F- J# w* p7 h. g& r/ E
- #include <linux/moduleparam.h>
9 V* n7 l8 L v' W - #include <linux/sysctl.h>! O; E8 U2 z- W2 u. S8 G, P
- #include <linux/mm.h>! W" f+ Y# D% h/ K
- #include <linux/dma-mapping.h>$ L1 G+ D7 H V" R! f
- 9 n) \$ `7 F3 s8 @$ w1 f
- #include <mach/memory.h>
( Z( p/ `8 z% H8 ^ - #include <mach/hardware.h>3 B; @8 ?( Y9 V, D7 q3 U' c$ A
- #include <mach/irqs.h>$ ?3 [2 E0 K$ c4 z( @- S: K
- #include <asm/hardware/edma.h>
, I" U6 g {8 I- P
! T5 f( E- e. }7 O& \# ~% \% d& h6 w- #undef EDMA3_DEBUG8 W1 Z/ p0 _3 F9 p, i# m
- /*#define EDMA3_DEBUG*/! e$ }5 f' N6 q7 y6 _1 e& u
7 p n, r( k! e" O6 { j2 G- #ifdef EDMA3_DEBUG
" T+ J3 L P2 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ Z$ y. n0 Q+ ^/ L9 f" H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ r, h6 Y! g4 J$ N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 m7 \0 O; K3 w+ _8 X
- #else
" \% d6 |; Z* x+ h - #define DMA_PRINTK( x... ). O0 Z9 p2 x) S" Y5 q: ^4 k: d
- #define DMA_FN_IN5 @+ [9 m) P7 R6 l* P
- #define DMA_FN_OUT9 z9 W: _6 s W9 w
- #endif9 z8 M3 q1 U4 M2 c$ ^9 w( b
4 n% M4 s+ z8 ?, z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 {' c! o) a6 f9 L" X/ h
- #define STATIC_SHIFT 3
9 ^! T& g) \- W6 ]: h - #define TCINTEN_SHIFT 20. t* a' E! h( z3 Z: J
- #define ITCINTEN_SHIFT 21
! _5 `# n9 I6 ? - #define TCCHEN_SHIFT 22
; w3 ~' a8 D8 ?% S0 i - #define ITCCHEN_SHIFT 23
3 W: F9 v; n, ]' B" ~& z8 @
+ K! Z8 h* i& o5 X- static volatile int irqraised1 = 0;
2 g% D [6 [2 x) E, {5 Q. y - static volatile int irqraised2 = 0;
/ U, O; j! m5 C- K( R' R! D
/ `: S0 C- j2 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 c7 \5 e* a7 f4 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]! H: S1 @: ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ U# X; I/ a; F1 N( d+ @, m
: F% Z+ p5 c5 L. k1 F$ Z" K. Q5 B( j- dma_addr_t dmaphyssrc1 = 0;$ p5 G# V) @6 K, q0 Y) ^; [1 B6 i5 @
- dma_addr_t dmaphyssrc2 = 0;
- s5 y3 V% r' p% k4 b! n - dma_addr_t dmaphysdest1 = 0;( L9 O, L3 q- r9 }) m& N% R
- dma_addr_t dmaphysdest2 = 0;
1 E9 ]! h2 `7 x/ r - % l& j' X. x; A# Z' Q3 [7 z( _
- char *dmabufsrc1 = NULL;8 I( d0 P3 @3 }# \
- char *dmabufsrc2 = NULL;
0 m0 r7 S$ k* \: P' J - char *dmabufdest1 = NULL;- ]) x1 W3 r' p" t" b7 |
- char *dmabufdest2 = NULL;* {- |. H0 R) Y. y: l: U5 f
- 6 y r+ T r, \: z
- static int acnt = 512;
: E) [2 x, Y& E' N& C$ J% d - static int bcnt = 8;/ w6 g. {+ J1 O+ Q$ H. i
- static int ccnt = 8;: X7 h, q8 V8 `$ ? j3 n% \
- ; p! t8 ?4 o) [ [# _
- module_param(acnt, int, S_IRUGO);! n2 M' M" K+ _0 W' `$ ~
- module_param(bcnt, int, S_IRUGO);+ E9 h0 Q+ {; |8 i' w
- module_param(ccnt, int, S_IRUGO);
复制代码
8 n. U6 r. N' B3 E( p/ B! R a$ O& a* q: A) F: f* \# u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 @; X" {9 h( x- k5 f" }5 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ e) B# ]) \5 \* G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 G4 U+ f5 A( G$ e( z$ L" O: f& L1 [* S% f# L+ @- ~5 T& h
P5 u X4 m1 k# Y; e
|
|