|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 \& ~( n& T0 D5 R* G4 y- [code]EDMA sample test application
$ }! d- ?4 C( J - /*! m5 M% _! I0 s9 `# f7 }4 U
- * edma_test.c
* A2 `, j2 f2 M( C - *
0 C' p: ~) `9 w" u3 Z* K% N& n - * brief EDMA3 Test Application
0 d" b4 V7 }) h# r- R9 g% J - ** X: ]" d( |. h) k3 a
- * This file contains EDMA3 Test code.
5 V: ^% N S x) x4 M8 f - *
# S9 @, ~' o+ |. H% r7 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 S5 e1 C7 S- f$ c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o/ I- \3 ?, Z6 {! q) n
- * TO CHANGE.
) j- } `! W2 f - *
1 l x2 o& t- t+ W- X! S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ ], [1 p$ v0 N K; y' h4 [ - *
9 w! P0 K- Y' {7 g4 H - * This program is free software; you can redistribute it and/or1 U" j4 D0 I. X3 n4 x
- * modify it under the terms of the GNU General Public License as) ~- s5 e* w6 L: R; T
- * published by the Free Software Foundation version 2.
1 W9 k0 u7 q. \# F3 X - *
8 N2 P6 ^3 H7 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" g2 Q1 h V5 `) L9 k; A1 | - * kind, whether express or implied; without even the implied warranty
{8 z; P0 p/ W- X; y8 ~# u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ~; W$ q5 L6 S n: l
- * GNU General Public License for more details.4 Y$ B/ i _& [
- */# }' c3 @% Z# w$ h% D/ o
* X- q: u! H- y/ M) f, ?# q! j% A- #include <linux/module.h>% V( n# n( X3 }: [
- #include <linux/init.h>
5 e0 f3 D% e, t0 V: O4 i; ? - #include <linux/errno.h>4 n' `: k& b- o& l2 U/ S" w9 d7 ^
- #include <linux/types.h>
9 R% x# Q' r, v* I0 j - #include <linux/interrupt.h>
5 P! E# ?5 ]% v( k - #include <asm/io.h>* Y1 z/ R1 G, M" v
- #include <linux/moduleparam.h>
5 ~ W0 o# x6 {5 o) N7 C- m) v - #include <linux/sysctl.h>
- A9 Z. k5 V" a- d - #include <linux/mm.h>
# N7 C9 w. _) x5 a) G* W - #include <linux/dma-mapping.h>
# u9 ^8 f# @" p" t+ R! k- s - 0 a5 z; E* k$ W2 B6 W
- #include <mach/memory.h>
- I: l1 C7 v3 U/ R8 `6 X - #include <mach/hardware.h>! D; ?# e ~# b" z7 R, N" T( N8 q
- #include <mach/irqs.h>+ p6 O6 o- t2 g0 W' m
- #include <asm/hardware/edma.h>
, x: M" h. v9 n9 D$ X- P
* ]" B3 l& q% R; e: S& P% A+ o V- #undef EDMA3_DEBUG
7 e; a. N7 B1 G2 ^ - /*#define EDMA3_DEBUG*/& y4 u' {; v) c. Y- c* d. [
' ^8 B5 u) e0 x1 _( U3 p; }- #ifdef EDMA3_DEBUG
% Y2 ]3 F, b) o9 d1 z/ c* v1 W& T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 y+ ?5 z' }$ v' b- {; E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 ~- d) R+ t3 m& I8 L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' |! l; f0 L$ Z6 o% K* y. Q
- #else
' W: W* b' C0 p' e+ ^% }2 l7 [ - #define DMA_PRINTK( x... )
( G+ @" ]% l; G. i" _4 \ - #define DMA_FN_IN% A0 v9 z3 _: \ h4 h7 I
- #define DMA_FN_OUT% I% a3 d$ u/ c3 J1 N6 U
- #endif0 h5 Q( H8 O& X% n
- . g6 ]6 V9 |9 r* J# @. v& Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ x V: X$ Q/ D' x1 B
- #define STATIC_SHIFT 3
5 {. P7 ?# w+ u9 T K$ a1 q4 y - #define TCINTEN_SHIFT 20& V& R& y$ r5 ]: s
- #define ITCINTEN_SHIFT 21
0 H/ X! y2 e( {. L; O - #define TCCHEN_SHIFT 22, @ ?2 `& { ]- H# o
- #define ITCCHEN_SHIFT 23
5 q7 T$ M( _. i& ?+ J# ` - : Z. J; k; }* c$ O1 B4 S8 k( G
- static volatile int irqraised1 = 0;
2 g9 ?2 C0 E" k! i - static volatile int irqraised2 = 0;
+ b/ b7 _5 M7 w - ! P4 z* w% i! C% o( z$ d. w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! l4 w6 t# |4 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ m0 E* t. }9 f/ n. u' Z- r; ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Y9 _& u. _6 i- i6 ~, a3 W$ N0 i
, a2 Y4 A" e R- dma_addr_t dmaphyssrc1 = 0;
4 x7 q N% h2 m g2 I - dma_addr_t dmaphyssrc2 = 0;
1 M- S4 \; W; ? - dma_addr_t dmaphysdest1 = 0;, n% u! q. {2 H
- dma_addr_t dmaphysdest2 = 0;' `2 R/ v6 @ t1 R# M3 N* C
+ |: v. R* `7 @6 Y) }- char *dmabufsrc1 = NULL;* r. D# m* w! Z& E' w6 D
- char *dmabufsrc2 = NULL;7 T. D) m/ X L
- char *dmabufdest1 = NULL;
: I7 m% j9 Z6 u& M - char *dmabufdest2 = NULL;9 i. a+ R H7 |
- / ^( f) J* Z* Q9 _, m( n$ h
- static int acnt = 512;! j/ ^5 M9 y4 O2 ^$ E. Z) \
- static int bcnt = 8;/ X- S( r' x& ?
- static int ccnt = 8;
( A \" ~" w5 N4 }) W$ c
3 O% n1 A# z1 I7 @, I$ a7 r8 }- module_param(acnt, int, S_IRUGO);" H7 n- J. v$ d1 t! a
- module_param(bcnt, int, S_IRUGO);, m% N: f3 \% A$ B m
- module_param(ccnt, int, S_IRUGO);
复制代码 ; N l# k$ a2 v5 r# W
* h: ~& b/ }; D, d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: \+ F: c. `; F. U: g( |* jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! \2 e0 O- m: K) K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 K& r6 q( I# ?/ \' n) S8 `& V% V1 {5 v' [( O
6 T" f, \' Q8 F* p I: T& s( z2 O. L
|
|