|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % F7 G. a: Y* t# j' v m
- [code]EDMA sample test application
( R- G0 g, p5 n1 z - /*# K8 O* {4 q) w# {9 x( y( t+ K
- * edma_test.c( U. \' O! a* r7 I# L
- *# {. G1 j* l& U8 O& X$ a9 E y- i4 c
- * brief EDMA3 Test Application
$ c7 i, D6 s2 T2 G: g" X - *% X: e6 e7 X9 Z! G2 G# \9 o
- * This file contains EDMA3 Test code.
7 i1 J9 X3 p' F) k" u - *% [ J( D7 K* r2 K4 S y+ ~! g( l5 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& T2 |# [# d7 @& h- x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: `* `) p% \, B. k' g - * TO CHANGE.! J0 n: j, s/ D
- *, h8 b( B9 ? H( C- j$ t$ h9 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 y2 v3 i( D: l0 z0 T
- *3 J2 ?6 z) M' G$ u' o3 \9 Z
- * This program is free software; you can redistribute it and/or1 t5 L" i% U3 \! p
- * modify it under the terms of the GNU General Public License as& J" Q8 ?; U! X9 b5 F* E
- * published by the Free Software Foundation version 2.
3 a0 R5 G7 L$ U7 i( z0 I3 a - *
& M4 D. {! V0 q, R- G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ _" I+ S, N/ G; Z- Y0 m - * kind, whether express or implied; without even the implied warranty) n6 U$ P" v. |5 A; A: r+ P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 W* p" @7 C7 N) S7 n - * GNU General Public License for more details.
( |8 V" S+ e- M. k8 T" Q: w - */ K( z5 M- G& L# q% u( v) f: M
+ D2 r/ e$ \; B( p& C" ]" n- #include <linux/module.h>8 ~% ?. B3 W$ b9 n9 V% O9 q. T, K7 H1 Z
- #include <linux/init.h> A! F( R e+ P/ f9 r4 c
- #include <linux/errno.h>8 k; Q) E7 Q$ N( W( V& T. h3 [1 Y
- #include <linux/types.h>
7 v3 P7 z5 i3 _7 L, b - #include <linux/interrupt.h>
' f% L% C; I- G; R: d1 k0 ` - #include <asm/io.h>' R/ W- A4 s/ u5 P
- #include <linux/moduleparam.h>" Y! W* G7 c0 y) b! `. z
- #include <linux/sysctl.h>
! n. g6 M0 H" L - #include <linux/mm.h>" u! A* T2 m. G' r$ z
- #include <linux/dma-mapping.h>
& I {/ Q) ^9 y - 7 B4 \ i; ?; T
- #include <mach/memory.h>! |& t( F- s4 Q# i: t8 ^
- #include <mach/hardware.h>" c) I; e$ u/ R* H" V# `
- #include <mach/irqs.h>% _/ n. G. M* c0 v5 J8 }: i
- #include <asm/hardware/edma.h>
6 [- C4 a6 F1 }# d# {) ?: x a
3 j8 o8 Q( F+ N! a- #undef EDMA3_DEBUG
2 A6 }, {# r0 Y: ]- W - /*#define EDMA3_DEBUG*/
+ C% |- n* ?: A& o1 Q& u: q
' Z# ^4 w/ l/ i8 V- #ifdef EDMA3_DEBUG$ W$ Z2 Q+ J' K( K- t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ U0 P. C D1 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% Q. P8 s4 S! t" t, H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Y9 J1 a& n/ [+ S. ]0 o
- #else9 N X8 W) Z# @! a) R4 s8 B# t
- #define DMA_PRINTK( x... )
. ]0 A( m/ s7 x6 P0 a - #define DMA_FN_IN
; C" z) n1 l# c: f4 K$ s! S - #define DMA_FN_OUT1 n* z5 _$ E! P" B" h8 \
- #endif
9 J& c P* ^( @1 C
: u! e# `# f, z; b Y. p& t I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 I5 U6 w z# Q. u0 e3 ] - #define STATIC_SHIFT 36 t. m8 u$ r5 F$ }5 a
- #define TCINTEN_SHIFT 20
( S. q) X) f8 S3 z; V/ [6 i3 J - #define ITCINTEN_SHIFT 21
/ m3 X" S3 Z( F! S$ W! Y - #define TCCHEN_SHIFT 22- P+ V7 ^# H/ y" \0 h$ T) E R' W, @
- #define ITCCHEN_SHIFT 23
* f- [# x+ u* ^# a1 K* [3 V, [( g - * ^* s$ }4 j, T% w% p
- static volatile int irqraised1 = 0;
9 T' m: T- E: g5 c; R - static volatile int irqraised2 = 0;: m6 E0 h/ Z/ I
- j7 M' P4 `! t' [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o9 X* G& s/ m, H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" _4 I/ e. ^3 o8 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 G3 r2 {, q: b) W - 4 c* f ~# c2 Y; \9 f+ p R
- dma_addr_t dmaphyssrc1 = 0;) V* N; w# a/ \7 `
- dma_addr_t dmaphyssrc2 = 0;
$ k+ N/ p1 d$ M$ w9 y - dma_addr_t dmaphysdest1 = 0;
, L' W0 K% K4 z2 q# \ - dma_addr_t dmaphysdest2 = 0;. M8 E/ }! V# X' B% | n) o
- ' N8 m6 [8 `8 ?
- char *dmabufsrc1 = NULL;2 R9 L3 e* u5 v; x4 ?3 l
- char *dmabufsrc2 = NULL;: J! D1 Q3 A6 T$ P1 X' A+ F
- char *dmabufdest1 = NULL;
9 [" l8 H( S# u4 { - char *dmabufdest2 = NULL;
, g- ]/ @- ?- I8 [- ^+ N( C: g
' Z1 a7 u8 v* \$ S" ]0 q6 z- static int acnt = 512;6 l% |8 u4 Z0 U. R
- static int bcnt = 8;$ @$ a- N( Z" x1 }* n& C* b
- static int ccnt = 8;3 j1 @+ E- X( {$ [% f* A5 l
( H& M0 k }! W2 } q q; \- module_param(acnt, int, S_IRUGO);
+ k: c T$ n6 o$ ?6 r" p - module_param(bcnt, int, S_IRUGO);
' A* t2 D) Q$ z0 X- H - module_param(ccnt, int, S_IRUGO);
复制代码
5 N0 S D0 y: j4 H/ Q
9 t0 G& u1 Q: b7 i6 U7 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ h: }1 N; p- c. p3 D7 N2 o; V% f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) l, t1 o7 M E5 Y- @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 E) Y! r5 b& {! b+ {) y$ T! R& z( A0 }0 t {0 q8 ?. \! H: N+ R
* }6 L6 g) b8 Z8 f# R7 D |
|