|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) X$ g+ U4 I* N# \" n6 c \ m
- [code]EDMA sample test application
- ?2 ]# ?% a' U4 F7 a - /*5 O1 _7 e1 S' b& E6 X" `$ a* C) B1 z
- * edma_test.c* g" O3 n. s5 R. i3 {
- *
1 W2 D7 [% p: a. e2 q" f, F( U - * brief EDMA3 Test Application f* L# V& f ^8 y0 K
- *
: m3 |& s# G4 } {3 G) I( `$ Z - * This file contains EDMA3 Test code.0 X b2 M% i* X# J$ g* t( l
- *
! g, g5 E! N: ~9 D/ A d2 `$ N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! k) g; `. @# @) W0 w3 I. X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 [7 l7 I' a! e5 u* f" o+ k/ u - * TO CHANGE.
' y; i d6 t1 V - *" }1 d! H# x! U+ R, r% y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// J2 N7 c! E; \- `2 Y& T& Y
- *" S* }, o+ X& o# P
- * This program is free software; you can redistribute it and/or) k. r1 [" s- [ ~! v, w. J: {+ q3 [1 ^
- * modify it under the terms of the GNU General Public License as
" n M$ d8 t+ S6 \9 F - * published by the Free Software Foundation version 2.( y) C# `3 |; b1 W) \
- *
& ~* G* R- C, ~/ P, Z5 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e- B d) k4 X* C3 T' _* u; O
- * kind, whether express or implied; without even the implied warranty9 M! Y- z2 R# E0 B3 n# D; z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- G' j- \1 M$ A( m' h
- * GNU General Public License for more details.- ?' n+ G5 S. r1 w
- */
/ E7 i- f' F6 ~0 e9 K& i
% ^! D/ k# ~5 H- #include <linux/module.h>7 p1 X* I+ Y. A
- #include <linux/init.h># u& s- R8 y* l$ I. {
- #include <linux/errno.h>
! F+ G5 h0 l+ @8 V* Q: X - #include <linux/types.h>: G" I1 N8 {+ v$ _2 k7 p
- #include <linux/interrupt.h>4 U, [0 Q' j) H% j% P' b3 h- j( `9 I
- #include <asm/io.h>
4 w% v6 y1 `8 i& @7 n - #include <linux/moduleparam.h>
& d- |, f. s3 g- e) s) P/ I+ X - #include <linux/sysctl.h>
' E6 n/ c2 I2 a+ G: _1 i - #include <linux/mm.h>. D! E6 m) B8 X4 N ^/ W# O
- #include <linux/dma-mapping.h>
% R* m. @9 [, g+ Z) {% W# J7 m9 C - & Y, _2 v8 O- U# K3 q5 `: [& r
- #include <mach/memory.h>
- x! C9 O3 z8 l& w - #include <mach/hardware.h>. t. @3 q$ F: q) j
- #include <mach/irqs.h>
2 I: L1 S9 M% k: s$ f& w: d - #include <asm/hardware/edma.h>
5 }8 y; @4 @4 x7 {% c! u, T - ; U. O: E8 u; k; o
- #undef EDMA3_DEBUG8 V( m5 {) X& `2 j7 h
- /*#define EDMA3_DEBUG*/
+ g6 p9 e$ j: {2 | - 6 y% c1 P$ b9 L2 x! p) H
- #ifdef EDMA3_DEBUG
4 Q' f, L) z9 [8 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 Q8 [- g* Z( Y/ F$ o" K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ y/ g3 ?1 P. x+ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( q; z. l" v: Z4 x$ k
- #else
/ W4 X$ A9 K0 r& e7 B - #define DMA_PRINTK( x... )
3 X2 B1 X# O9 z) n - #define DMA_FN_IN& \5 r) ~% n( i
- #define DMA_FN_OUT5 C+ Z* i! f+ o% ~
- #endif
7 Q+ N3 z; D/ `" r( [3 Z- l' @. C - . A/ I8 G# ~& h+ V4 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" i* q, X4 O, i9 s
- #define STATIC_SHIFT 33 _2 S5 ^: s7 `3 F4 G( F
- #define TCINTEN_SHIFT 20% t6 g) c& x; ]/ D+ P
- #define ITCINTEN_SHIFT 21
0 U( _& j4 E& X" \ - #define TCCHEN_SHIFT 22
9 d! l9 l7 m7 c2 z: H# E: _* | - #define ITCCHEN_SHIFT 23" V8 E( v# W9 U
# S& A" ]2 t# O% K- static volatile int irqraised1 = 0; L" G. z7 d; N. ^# K) r
- static volatile int irqraised2 = 0; B, U7 J: y' d
- ! P7 }6 G. h3 ?: A6 B: G+ N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Z2 ?) g6 z7 S5 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f% |# X/ c0 V; V9 Q7 a6 \1 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 h' K2 x. N% r( X6 Z7 j5 Y
- " D' ^# R5 k; E; z: W
- dma_addr_t dmaphyssrc1 = 0;
& l) }# A- q" s! A - dma_addr_t dmaphyssrc2 = 0; k& Q& a9 F2 }+ v
- dma_addr_t dmaphysdest1 = 0;
0 r% }+ S/ K4 o& v6 a0 Z' Y - dma_addr_t dmaphysdest2 = 0;% ^5 D# J8 t) i! }! T
/ W5 E! k, H: r( `6 B" O! Y- char *dmabufsrc1 = NULL;
7 @+ x; |% k( C ~- f* c+ q - char *dmabufsrc2 = NULL;
" f4 I w$ Q% Y) h8 P& g$ {! p5 j: o# z - char *dmabufdest1 = NULL;
1 i1 t0 i% c4 h: U. m# h: U# y& q - char *dmabufdest2 = NULL;/ M5 a% |5 d$ ~
- 3 N0 d9 \" t( I7 Y: |0 N
- static int acnt = 512;
( \$ G/ t4 H+ [+ G& S* S - static int bcnt = 8;7 r3 Q4 C) o3 e1 h1 z
- static int ccnt = 8;
0 ^" u- t7 N( c! E/ F" C- T% r - 5 A) Q' F/ D/ ^
- module_param(acnt, int, S_IRUGO);
2 K1 m! e: V A5 S: F; W - module_param(bcnt, int, S_IRUGO);
1 V$ U, W9 a; E$ {$ l, Y - module_param(ccnt, int, S_IRUGO);
复制代码
! T' B' u# r, c$ t. J6 d5 ~
, ^! F( t* A; k* @- T: U7 e6 N# H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 x+ }, N) I& a- G8 g k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% ~/ V3 Q+ ?+ J K t; ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* a% m9 P7 U) ^; |, D8 H
1 a: c3 }: O: C3 K* U3 K! J) V: o7 Q, N) m3 V, l" S% ]
|
|