|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ l" t9 i' s2 h
- [code]EDMA sample test application/ S) E4 r" y; f
- /*1 V; Y: n k/ K, n4 `2 H
- * edma_test.c8 c1 O1 q# Q" u' H5 n
- *
- L- l4 G! H5 E; x1 @) n - * brief EDMA3 Test Application
" b, @* U: _4 C4 ]% v: K: t T - *
8 i% R; D% m$ @; @ - * This file contains EDMA3 Test code.
0 z' e5 h) ` }" g3 U! L: P, D- _ - *
) s% H, B0 p7 b! F" T5 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Z8 `. A8 o9 \; E. R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& V5 n, j) H+ m, Y+ T1 c+ J
- * TO CHANGE.# ?* f9 O% p3 ?1 Z6 P( W( d/ ^& F
- *
. s b8 U3 Q8 ^5 O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 I2 t5 B3 X, p# U, A
- *
% e# e" h9 [8 D - * This program is free software; you can redistribute it and/or
8 S. v0 {9 E* u7 u - * modify it under the terms of the GNU General Public License as" r$ o; |" M0 R( r/ L E
- * published by the Free Software Foundation version 2./ Z! T. v9 O0 T) k% T- o4 l
- *; K L* N- ?2 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 i; V0 t5 D. t1 w; i5 x* o3 n2 k - * kind, whether express or implied; without even the implied warranty
. J+ g9 T- w0 i/ T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e( N! \3 n0 b8 w& S! P - * GNU General Public License for more details.; U2 V! \7 X% S/ d# d
- */ R& Z3 i9 ^$ V8 D
8 f% W5 [# x- i3 v q& h r- #include <linux/module.h>4 e. l$ J7 \' h+ D) f. C5 w
- #include <linux/init.h>
9 {: z+ x# g& Z- g/ _* E& D - #include <linux/errno.h>) R: a3 _+ B1 n" i" H
- #include <linux/types.h>0 g4 U" x1 q4 G. F1 O. s: U+ X
- #include <linux/interrupt.h>
# D% Z- u$ l4 P" ~1 s0 b - #include <asm/io.h>* L1 z1 V4 N3 o$ C+ Y5 x, s( K% `2 n
- #include <linux/moduleparam.h>6 e$ I o/ K! g% {; p5 Y5 z$ V# J; ]
- #include <linux/sysctl.h># ?# r5 m/ e. K! _
- #include <linux/mm.h>
p0 S( |0 E0 e9 y+ m8 w - #include <linux/dma-mapping.h>
0 y; p7 g9 c0 t1 I' X& K4 V& e# P
) _) C7 ]7 p. Y" P& `- #include <mach/memory.h>( p3 B4 N1 K1 t! {
- #include <mach/hardware.h>$ l+ U+ E; O# E+ A
- #include <mach/irqs.h>
, N$ i$ L2 _0 O8 j) O1 m/ s1 `4 w - #include <asm/hardware/edma.h>; Y( K, ?+ d3 d9 d
# \! c; f7 F/ b# H- #undef EDMA3_DEBUG! B) z/ V+ g3 ^# Y2 n
- /*#define EDMA3_DEBUG*/
* L: @, E2 D" [* c
I# Z% u0 Y3 l- |* B- Y- #ifdef EDMA3_DEBUG
, b1 v2 U O) q5 O% d% } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ z. N* z8 N* Q' a8 }$ v/ o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- d w$ p' o3 m {- }# A1 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- c0 ?1 y7 w- v9 e& i - #else
7 h. O* X/ H* K) v# P) s - #define DMA_PRINTK( x... )' t) B" j7 n1 }, f
- #define DMA_FN_IN& _, h, G6 ~$ ?, o3 {, \: p. H
- #define DMA_FN_OUT
[/ _$ W7 y; ]+ b, X. P; N8 S2 T - #endif& u* m6 f2 @$ _% C; W2 @; ?
- # r/ J0 K) E! r9 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
N, a! _- s& s/ s - #define STATIC_SHIFT 3
! [+ P& h' T3 L - #define TCINTEN_SHIFT 20
! f& \8 R0 o0 N4 A1 M8 | - #define ITCINTEN_SHIFT 21
& x4 v3 o2 G! s - #define TCCHEN_SHIFT 22# l7 z( h0 }3 F; q
- #define ITCCHEN_SHIFT 23' e; r* n# B/ n- `- g
- 3 c8 y$ f) J* f. o. O' ]
- static volatile int irqraised1 = 0;' M7 x5 ~7 Y: C; w0 S5 |6 f
- static volatile int irqraised2 = 0;
) J5 B( p0 ~' Q: `2 ]* T - # ]9 k: o( |5 j) @9 V' I# u/ Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A% |( x$ L: u7 g4 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d( W4 |/ {$ h; M" N& n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- `4 u% o) y/ i5 r+ `
7 h0 G- e N" \/ T" _% a- dma_addr_t dmaphyssrc1 = 0;4 P. Z; b& ?+ f! |8 h
- dma_addr_t dmaphyssrc2 = 0;" P2 G5 P) h7 e4 F( D8 `) {
- dma_addr_t dmaphysdest1 = 0;
5 Z- K7 P; |0 { - dma_addr_t dmaphysdest2 = 0;
5 X" _3 P5 H r9 f, n7 f
3 w5 h6 l6 H- P) E3 {+ ~- char *dmabufsrc1 = NULL;6 y$ D( H( B9 R( t
- char *dmabufsrc2 = NULL;4 H* o8 a0 d* N
- char *dmabufdest1 = NULL;+ p- ^ a+ o/ X3 p5 M$ l m9 o
- char *dmabufdest2 = NULL;1 v" b' J* ^6 u4 W
- Q. d3 f- c6 K' p" X% L; B B
- static int acnt = 512;8 c b3 h) g5 U! G" Y% H% Q! N" a
- static int bcnt = 8;
G: W: m+ D8 C' \) Q3 \2 F - static int ccnt = 8;
* a) i& Z/ ?4 k0 l
" ^ H% f1 i: {6 W- T+ ?7 s- module_param(acnt, int, S_IRUGO);
! ]" J7 e- D# r4 `' `, x" a - module_param(bcnt, int, S_IRUGO);" p( r9 j7 n: ?4 r
- module_param(ccnt, int, S_IRUGO);
复制代码
6 U: V G( G# Y; R' V% M. T! V: S9 ^
: p7 ~. @: C8 q" Q8 I+ l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. v8 ~6 ]6 s! \$ o9 qarm-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 g2 N( P/ q/ v4 _. w1 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! q4 t. [3 o/ ?- h$ m% o
/ U) o7 _" e4 _! R; w! J7 w* l& g) x5 G" V' u
|
|