|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 G" ~ {! [3 G& K5 H
- [code]EDMA sample test application
N; B: c* g, P$ y - /*
, X2 Q3 {; v7 z, w, B0 W - * edma_test.c2 F2 P! P0 o3 R* \! S( h3 K3 A
- *
s$ w# V% G) j. L+ j1 ^ - * brief EDMA3 Test Application
% ]4 v/ ^( C. Z. \) |# D - *( h/ k" {% M T; O' p( e
- * This file contains EDMA3 Test code.: K& L2 X6 o+ G
- *7 B( s$ v, V6 Y, J7 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" \+ {# z( q: s! p6 Q$ l% }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, G/ _5 \8 N2 ?; Z0 X9 a
- * TO CHANGE.# i7 F/ v9 N4 J( ?9 F; m
- *6 s* ~* k" H# A* K# N& r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ^9 p7 n1 `6 H: d( ?7 Y
- *
1 X7 r& L% r" c3 e: ? - * This program is free software; you can redistribute it and/or
8 U Y& T% n6 [7 Y( j# _ - * modify it under the terms of the GNU General Public License as/ h5 s# {- d D- e4 L
- * published by the Free Software Foundation version 2.
7 y% v/ t1 I- k [' P - *$ }) e3 k7 B7 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ B9 T1 Y# }0 z1 H- y& ^1 W
- * kind, whether express or implied; without even the implied warranty! c f# A" C" E9 a" p$ L4 s+ w6 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( R* k" l, `: Q
- * GNU General Public License for more details.
* B. r4 g, a+ Z( s# S2 r |6 K - */1 r( h$ m2 }* O1 T4 ]
) s# |0 W6 I$ O/ c- j( P9 F- #include <linux/module.h>& e) r) A6 p( H8 l6 U2 V# g
- #include <linux/init.h>
1 [/ n) E: Z* e - #include <linux/errno.h>* W( `( n/ Q' ~7 i( U3 n* c( d: M
- #include <linux/types.h>
4 A0 K9 g3 p5 M7 A. u. ~" j- i - #include <linux/interrupt.h>8 O# g3 o& {" d6 z. [
- #include <asm/io.h>
7 Y- ^2 Q; U9 Q - #include <linux/moduleparam.h>
2 ^/ ]& E8 _8 Q+ V' i; @ - #include <linux/sysctl.h> Y: q4 ]0 ~9 j7 [+ e9 ]
- #include <linux/mm.h>
! u/ X0 J8 h& i8 U% o4 s) g% S$ M: v - #include <linux/dma-mapping.h>. e6 O! {$ I! r, i8 _; o3 Y( M
8 B' [; _7 _- q9 m1 i( F) A% i' R- #include <mach/memory.h>
& q7 y; A0 _' o2 U b. A - #include <mach/hardware.h>
& J7 E; b' a( y+ R" j! V( Y - #include <mach/irqs.h> t; Z$ X; J3 \( Z e$ X( T
- #include <asm/hardware/edma.h>
% p0 T; A" o& B0 V - ( h2 q/ M7 e6 s
- #undef EDMA3_DEBUG1 v7 A2 y) L3 ~3 \8 P; q" f
- /*#define EDMA3_DEBUG*/4 C- c1 s9 e9 o, Y
- # D0 W9 {" a ~% y
- #ifdef EDMA3_DEBUG. S5 u- K3 ~9 P" v4 `0 c t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 F. o( z; Q' b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 h; l B' U% h3 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! [& r8 V. v$ r% X! ~/ e9 V - #else
6 S/ U" J( J+ C- a: S - #define DMA_PRINTK( x... )( x: Q6 p: W2 y; x' a
- #define DMA_FN_IN
* r# T3 c8 b% D( w+ U - #define DMA_FN_OUT7 {0 w- N7 i) ~9 }
- #endif
3 z/ `8 k( i+ B - 5 y Z' Y9 @4 `: d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* e/ s/ u" v/ O& L4 n- `2 U6 G
- #define STATIC_SHIFT 3
. ?8 o3 ?: q8 |$ X" a( m - #define TCINTEN_SHIFT 20
% m- T# J1 n8 t; q. e3 U5 H( N - #define ITCINTEN_SHIFT 210 O0 H3 k6 L* X% @( ^
- #define TCCHEN_SHIFT 22( I* W4 L: M! F9 Y: u
- #define ITCCHEN_SHIFT 230 _ C- a3 @2 }; `1 H- V
N( d5 ]2 \6 b& o9 h, b+ o- static volatile int irqraised1 = 0;3 } K2 K; H$ C* C: A# i
- static volatile int irqraised2 = 0;
1 A" d% P K5 e* q1 F4 B: y - 1 A: Y) _- o+ i& H# K- `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c1 k9 n ?/ Y9 I1 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! H& T! k! ]$ ]$ ?1 t6 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 c3 J; a: K4 r - * P$ Z* _3 e1 n
- dma_addr_t dmaphyssrc1 = 0;
9 O; \% Q% J, G( D- r M b - dma_addr_t dmaphyssrc2 = 0;; V' {, n; _8 y! e" e" U: n. D) H
- dma_addr_t dmaphysdest1 = 0;
* v1 D5 q2 {" J; ?) \ - dma_addr_t dmaphysdest2 = 0;
. N$ ], D9 V% O. J - ! m" S/ E8 q5 d1 d
- char *dmabufsrc1 = NULL;" O( P( j: b. |0 S9 K3 n' e
- char *dmabufsrc2 = NULL;
2 p1 d- \5 g Q0 t% _: X7 v) @ - char *dmabufdest1 = NULL;
$ D9 q ?! c# h( z4 N - char *dmabufdest2 = NULL;
0 t2 @) g5 b! I# [! r. R; U% a6 Z* ?
" `" S* |) }6 V- static int acnt = 512;
% M$ Z1 q! \% ?# v# {! u" A. e3 c - static int bcnt = 8;) h0 M8 x) a( H; d9 t; A' a$ c
- static int ccnt = 8;
$ \& ?3 r2 I; m* }
* r" g! k" @- X. k- module_param(acnt, int, S_IRUGO);% j( c: J& J% I9 J
- module_param(bcnt, int, S_IRUGO);3 j0 B/ M7 i6 R5 p- {0 H8 {& w
- module_param(ccnt, int, S_IRUGO);
复制代码 2 G5 g0 Y- O: Y& a/ ~; U! n
5 C/ f+ G8 { |( E9 K- T; A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ? m/ v! l* Z9 N, d$ ^( V/ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 @ f3 q2 e$ w' b9 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ^5 @6 Y" n2 v# O6 F
, M. X9 h& E3 R7 F% D6 Q0 f5 `; S/ L
|
|