|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J' W9 W8 l5 {; l- [code]EDMA sample test application
! J( M. @8 L( l9 k! E& _3 w8 G9 R - /*
6 N! |# F% l+ _, [) b6 w2 J* ?* T - * edma_test.c7 e2 i: B' g/ D! o5 c
- *
/ U7 R5 U) x% e0 ]2 e - * brief EDMA3 Test Application
: z7 A2 k) T. O% a" X& ]6 g$ k0 w - *
: X. [- J5 X4 n4 f6 e- k# I- u - * This file contains EDMA3 Test code.+ g( e9 T ?# b9 k5 {( i1 {9 c& @
- *- C8 n! ?5 n8 S, n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. @4 U0 W# ]. Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- m1 L! U9 D1 {( p) ? ~) o$ m" Z# E
- * TO CHANGE.4 m/ X8 A5 w! z4 c3 S2 s
- *
3 G, J6 z: l; n+ C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U* I% S6 ?- a+ L
- *
* ?/ f: E6 F l - * This program is free software; you can redistribute it and/or; F* P2 n. _/ `1 b, q9 Q
- * modify it under the terms of the GNU General Public License as
6 v2 j; g/ T( \" K$ t - * published by the Free Software Foundation version 2.' f: C% K9 Y9 |0 v8 F5 m, `
- *5 h: U; g r8 H R! d: U/ p7 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, {) ~3 B, H# P% a
- * kind, whether express or implied; without even the implied warranty
5 P0 w" A) b: B+ _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' L6 A+ Q2 K: W$ I, d* ]
- * GNU General Public License for more details.
2 e, L2 t k5 e5 L8 S* k - */( z, U0 z2 S1 C+ W$ w
& C. I3 Q- ^8 R' T/ T9 }- #include <linux/module.h>4 u2 }$ @1 S0 ]; c3 U
- #include <linux/init.h>7 T% a. h+ U+ e! }; { n; t! I
- #include <linux/errno.h>7 d0 W2 n! A) H* c
- #include <linux/types.h>5 ~* L! [$ E1 e8 R( ]8 h0 P
- #include <linux/interrupt.h>- ]$ H1 r [1 _6 n! Q# Q' g
- #include <asm/io.h>
9 q% A: O8 K. e: y - #include <linux/moduleparam.h>2 Z1 ?7 s [* p' P; K5 D1 d
- #include <linux/sysctl.h>
0 c. k( T, ^% K0 d1 E7 b - #include <linux/mm.h>
+ {2 ?5 z: K* M" ?0 L - #include <linux/dma-mapping.h>
2 N# ~5 {6 B9 }' `+ y+ I- W% N - ' {/ v0 |9 u. u. z
- #include <mach/memory.h># \ K0 e1 w: _* w+ x8 s
- #include <mach/hardware.h>
% k' n9 Z- l2 B2 n6 E& f - #include <mach/irqs.h>
0 V) y9 p' F0 I: s5 D3 [9 ~+ [ - #include <asm/hardware/edma.h>
: a& ]4 A+ T$ z K - " X% x& ~& f! j* k% s" O6 Y
- #undef EDMA3_DEBUG
. ^& \1 e( p9 _/ W - /*#define EDMA3_DEBUG*/7 D/ X# l( k* Z& B2 @8 Y; a: y
( x4 H' Z0 D; `4 E2 J- #ifdef EDMA3_DEBUG$ h% E5 A7 ~0 ^9 a' t* o7 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" t+ K% Y' d( v+ Z4 B9 Q. r) I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ U6 B$ I+ Z# y* |. s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 j$ u! g: t* q& V: I
- #else
4 I8 H' q% U4 `& X9 l+ z - #define DMA_PRINTK( x... )% a4 O1 j1 o- Z5 c+ n5 j
- #define DMA_FN_IN
( d1 q1 K$ T* M% i8 A: z7 R7 O - #define DMA_FN_OUT
; m1 K, z2 Y1 }! @& [) n/ o; U8 J, F - #endif5 d/ t0 U4 |- w4 _5 P
- 6 o3 x( Y( k1 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 A k% U$ B; X - #define STATIC_SHIFT 3! \0 z' N8 {. U
- #define TCINTEN_SHIFT 20
# ~( t% d3 ]4 x5 H. ~, s$ E: s - #define ITCINTEN_SHIFT 21
4 p/ g0 |8 }; p5 I+ l, W3 I" o - #define TCCHEN_SHIFT 22! g9 U3 {: b' p
- #define ITCCHEN_SHIFT 23, z+ u" m7 M' F4 b) o; E% n, t
- & V" n; m l3 M
- static volatile int irqraised1 = 0;
. q1 r# R/ v* _ - static volatile int irqraised2 = 0;
, G0 G& a- H0 M q ?. C+ Q. n( ` - " a: h% @3 Q$ e/ ^8 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* t9 r2 T5 n! A4 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p- a& ]3 q8 ^- ?+ x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a* v* s2 s) z) b( ~) q3 V+ ^
# J) z7 O6 j6 u! f, @ r! V- dma_addr_t dmaphyssrc1 = 0;. m. U- d. L! k1 X4 d
- dma_addr_t dmaphyssrc2 = 0;
! E8 A/ A* ^& D6 ~; }* X - dma_addr_t dmaphysdest1 = 0;
2 \* U I0 a8 G. R* m, n - dma_addr_t dmaphysdest2 = 0;
) X+ A# a* R, R; e - 1 Q2 Y h/ q. t2 w* \% X' H
- char *dmabufsrc1 = NULL;) `$ b/ [; M$ x3 ~4 }6 V
- char *dmabufsrc2 = NULL;! }. N( y9 c6 x5 I, a4 i
- char *dmabufdest1 = NULL;7 \9 C3 {% S& U
- char *dmabufdest2 = NULL;% [2 p5 W& D$ Y1 K0 o+ b
- B7 e" t& e, X8 U9 Z' V! P9 J( |8 X
- static int acnt = 512;- O" Q# }- i+ h5 N# `
- static int bcnt = 8;
; w9 Q) z& [/ {9 l. W0 ` - static int ccnt = 8;1 o6 M- f5 m$ g6 N! ^6 @
- & _$ c. ^* I7 n6 A `1 y9 D
- module_param(acnt, int, S_IRUGO);
9 B6 y; s, _: f0 D s! i - module_param(bcnt, int, S_IRUGO);# Z9 @9 a0 K7 |
- module_param(ccnt, int, S_IRUGO);
复制代码 ) F _3 w* _1 E5 u' a0 b
' W7 A2 ^1 d; O$ ]" ` r- @8 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Z# e2 U2 O, D& m+ o* M5 a: u4 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 s# h! P, }: f! @! R; I9 `- R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 V0 i: c! k$ R2 r+ i
0 _# t5 c# q* X$ s, _+ Z2 x: M0 _% ]1 R' M. I( W
|
|