|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ^* r! O, ^: B3 s0 L
- [code]EDMA sample test application
; H: g) v' Q u7 G" b/ W$ l- j - /*7 Y9 D' T% S7 |% _
- * edma_test.c2 A6 q7 W2 _& z5 F" d
- *5 p2 L2 K6 O- X1 J4 T
- * brief EDMA3 Test Application' |3 {6 J1 t6 k H2 V6 Z, C( b, k
- *
- V/ k$ T# R1 c6 s - * This file contains EDMA3 Test code.! k2 R9 o# F' Y
- *
4 V; r0 k( }8 |/ c: M0 {. U' F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' s/ f1 P& d8 l9 \; Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" o. G$ B3 K, h# k3 w& l - * TO CHANGE.
5 E# w9 w/ f) f+ t. U - *
2 \$ x5 f, L5 K# l. I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 h0 C+ b0 F2 P" T1 _1 w
- *) d/ G, n2 _" ^1 e z# {$ Y: {
- * This program is free software; you can redistribute it and/or
8 A- V- `8 q1 d& l H- C/ ^1 t - * modify it under the terms of the GNU General Public License as; q, p- R/ m: c+ O
- * published by the Free Software Foundation version 2.
4 x# R% x$ K& J! G - *" T: y1 f2 L' v1 A7 U1 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 G" x7 m. _9 c H$ m
- * kind, whether express or implied; without even the implied warranty3 t' Y7 |! X& x! l* Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ M' c2 d! t; U1 s' H' q - * GNU General Public License for more details.: w: l, l; m$ K* ]; ]" K% e
- */3 ?3 g+ {/ W) N+ c! }
" E) j' e+ `, e. ?1 z5 |: l" P+ Z& Z6 \- #include <linux/module.h>1 R2 Q" G3 S5 q9 Q2 j& A
- #include <linux/init.h>
k1 x1 u5 t" C, x - #include <linux/errno.h>
D# D X" Q: y: g% G8 \+ s - #include <linux/types.h>" O8 i6 L- B; q; x) v- ]5 y* W
- #include <linux/interrupt.h>
2 A) k& ] Z7 w3 f- B - #include <asm/io.h>! _/ Z* Y" c9 c( b* b6 A+ ^! n O
- #include <linux/moduleparam.h>
- G8 @2 _$ L6 ?. C j( \! v" f - #include <linux/sysctl.h>
" X4 H% F) b' z% k+ B7 t0 d - #include <linux/mm.h>8 ^! {) f& Z9 n, W
- #include <linux/dma-mapping.h>0 |* @$ g' y _( h, G* G: y7 E' r& ^, m
- ) ?0 n! Q: r4 j. S% y4 k" I* n* f
- #include <mach/memory.h>
9 I% @8 t: e# k& T% g( S4 ]* d* C$ T - #include <mach/hardware.h>
. ?6 `+ I5 g+ X S& x& C7 k1 X: L - #include <mach/irqs.h>
) ]6 N( a, I/ ?' G- p - #include <asm/hardware/edma.h>
5 y9 V# ]3 @# V& V7 V D4 X( X
5 r$ `3 T: r0 A1 \6 Z6 v; ]- #undef EDMA3_DEBUG# ?$ m3 ?! s X
- /*#define EDMA3_DEBUG*/3 I% k- d. r% C
9 I6 t: a* G5 y0 q$ i! ^/ S- #ifdef EDMA3_DEBUG
) ]! J4 t- m+ Q3 k& j8 _. \$ d: a# ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ o- F; ?' X/ A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ~* h% Z# Y- n' _7 s' Z" }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, i. _& k, K+ ~+ D6 m - #else- m! }; O. I1 B& }% L: l
- #define DMA_PRINTK( x... )
i; @0 O' h3 A$ q; b - #define DMA_FN_IN; ]+ @# g. H% B, T u; N$ I
- #define DMA_FN_OUT( [7 [" [" b# J
- #endif2 g- W1 U7 \2 @
- & s% _1 g+ }5 `; O% Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) h5 h5 H- T% U* }" m
- #define STATIC_SHIFT 3
' c" q# { X2 ~, m1 U/ E9 _1 M9 o# f6 u - #define TCINTEN_SHIFT 20
, i6 H8 P1 Y* m9 L. X( k - #define ITCINTEN_SHIFT 219 r6 A' D/ A) ?/ I- |
- #define TCCHEN_SHIFT 22
0 g; e% j& D: V1 ?2 L - #define ITCCHEN_SHIFT 23+ F; `/ d' n% `
- 2 @( m7 {9 y$ O" ?/ Z2 d
- static volatile int irqraised1 = 0;
& V& i* }9 O3 Y8 e - static volatile int irqraised2 = 0;$ _1 f/ n3 \6 } E1 S
1 t$ [* O: T$ ]1 V1 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& n: @( \( i4 v; x# X. R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 S2 y5 y, Q5 e1 z9 N! k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. W! o4 K+ ?! r* }: ^ - # d2 |6 f* @% p% {" L) A) g5 c
- dma_addr_t dmaphyssrc1 = 0;- T" r ?+ {7 x) l" v& M7 y4 S
- dma_addr_t dmaphyssrc2 = 0;
2 p8 t+ d: g9 p, O4 ?; f - dma_addr_t dmaphysdest1 = 0;7 [ L8 [6 L8 f; I
- dma_addr_t dmaphysdest2 = 0;& ^; k# b% n' f H' ]
- 9 [( J: N S2 z/ S$ y! f! e/ G
- char *dmabufsrc1 = NULL;. G5 w9 U1 u; n
- char *dmabufsrc2 = NULL;
{3 a# b' d/ j8 c: E5 ]5 o - char *dmabufdest1 = NULL;0 @ [1 Z1 R" l) w+ k& f
- char *dmabufdest2 = NULL;
6 }: g$ h4 s& [8 g% z K* g - % q& Q$ X/ U0 \/ m0 B3 X7 {
- static int acnt = 512;0 K9 Z9 b% q8 T8 F9 c7 ]& r
- static int bcnt = 8;+ g3 { m v9 _, y
- static int ccnt = 8;2 E0 u( z* C$ |
- / k2 I' M* ~8 j' X7 c( K& F
- module_param(acnt, int, S_IRUGO);# j: k! a! s2 f0 I+ q5 {2 N
- module_param(bcnt, int, S_IRUGO);
& R; o( d7 T6 S0 ^% i - module_param(ccnt, int, S_IRUGO);
复制代码
3 u, I7 u) w% q: b7 w
) ~/ @* I2 K: ]' o' Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ b9 f3 t, Q' ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 U4 V, l4 h0 M2 c! o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ l) W# ^& b" ]/ K! y! X$ F m# t+ ]$ B7 k8 k) o2 X; S3 h
3 k' C) {/ `6 h1 z
|
|