|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 e& C9 G+ { B& v
- [code]EDMA sample test application7 B: c- X$ H+ u- R" E
- /*
4 N7 [- A6 Y# X; y. E7 J* o - * edma_test.c
- r: t( {- {4 S2 r - *
7 ?! X; q& G* `' i" I# _- k - * brief EDMA3 Test Application
+ k$ y0 e9 K2 d6 n# M0 v6 q4 B - *' ^- ? V: b9 }- F$ w0 x
- * This file contains EDMA3 Test code.
6 j7 D% {) U9 C Y# j - *
- G! Z7 K$ T! f3 f$ j) C0 A$ g" Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ e) q+ _1 c) p# F9 y9 U9 |0 z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 b* A) S" X4 Y5 c6 w0 t' | - * TO CHANGE.4 V" {+ E4 ?8 `
- *5 L1 f& e$ |# [7 c% G! w' g7 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" s; v8 p N- V1 P W& U - *
$ M- p- _- x' a6 g5 C - * This program is free software; you can redistribute it and/or
6 |* O& n* X5 z! v/ @7 S: e - * modify it under the terms of the GNU General Public License as
8 K/ w% a. \8 @ g, i - * published by the Free Software Foundation version 2.6 _8 g1 G, L) y% V* e) t! C# L
- *
# g" g7 d2 n0 I6 v: y2 S* ]1 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) Q2 u1 ^ G2 c# q7 j' u- b - * kind, whether express or implied; without even the implied warranty
, T, d& T* r6 W# J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 {) L7 N2 Y# b3 j, ^! K
- * GNU General Public License for more details.
$ Z* L6 ^& q& D) g# i - */9 Q: s1 c {9 ?( p
- ! G. l9 F( d# R) I9 ?2 @5 `- k% L
- #include <linux/module.h>
4 S5 ^$ j* g; ] - #include <linux/init.h>' _( ?8 c- h+ O- m1 c7 x+ Q
- #include <linux/errno.h>* w e$ b* H( V G" n
- #include <linux/types.h>
# h- I$ c* f- j" q - #include <linux/interrupt.h>8 j) e% X. U' @! |( {, K
- #include <asm/io.h>, o7 M S5 i6 j' ~
- #include <linux/moduleparam.h>
; ~5 J7 ~" G$ e( E$ \6 w2 } - #include <linux/sysctl.h>" c, l w s2 f G4 l
- #include <linux/mm.h>
) |4 W/ s% C, L" S( }# | - #include <linux/dma-mapping.h>) Q& V J8 _ H2 h) h
) Q+ l( Y7 G" `4 \2 I% p3 y- #include <mach/memory.h>
# H7 `$ w( j: P) j+ w! L) ` - #include <mach/hardware.h>( N% f* n3 G+ e' |
- #include <mach/irqs.h>
( @" O) Q% t0 C* u! l1 N! v - #include <asm/hardware/edma.h>6 X* H$ a( b$ e8 L( ?
- " z& a5 L, Z }( T* z
- #undef EDMA3_DEBUG
1 I& t% A% E3 ]- d - /*#define EDMA3_DEBUG*/
/ Q# C2 N0 x% h+ y1 ]* f
$ { C7 H* n4 a7 ]- #ifdef EDMA3_DEBUG8 m; a: M! ~4 d, g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 j% D% v5 u/ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 c5 ~3 J' C, E" k. U7 ^5 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* J* I! x" x9 Y# [ - #else: O/ p* }2 T( H5 _9 O0 @
- #define DMA_PRINTK( x... )- }/ V2 n' u! d4 \; Z3 A, i& _
- #define DMA_FN_IN8 s1 C. d Q* G! k$ ^6 ?# r
- #define DMA_FN_OUT
* M3 E _+ ]( T9 k - #endif6 p* I8 G, @: n7 ? X
- - b& Z# m9 _) T8 p: S5 o3 p( M @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) `; J+ M e/ a+ d' { - #define STATIC_SHIFT 3& \' i. u7 |8 O. o9 L& n
- #define TCINTEN_SHIFT 201 @, O/ i# u- ~
- #define ITCINTEN_SHIFT 21
0 V2 m" g! Q3 P/ y p - #define TCCHEN_SHIFT 22. E2 B3 O# \3 B* f0 x% U0 A
- #define ITCCHEN_SHIFT 23
; U- M( v7 T% @
/ p( i$ A5 l; Z3 r% C- static volatile int irqraised1 = 0;& V6 ?. X& q9 u5 v* b1 `
- static volatile int irqraised2 = 0;
. [$ V, S1 o8 H - 8 }' [& f) ~- K3 O9 l7 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! r; z& L! \$ A/ m8 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ c. f: E" \* @# p0 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" o" R# ^5 |+ ]7 T4 Q5 s) o7 }
/ }+ i D7 l" H% O/ ? B- dma_addr_t dmaphyssrc1 = 0;: U1 Y! i& Y" y8 \" N4 ^) x- J
- dma_addr_t dmaphyssrc2 = 0;7 ?1 Z: N- Z* L/ N: e6 P0 P, j
- dma_addr_t dmaphysdest1 = 0;
1 o6 ]0 u3 R- ]+ Q8 e5 ~& m - dma_addr_t dmaphysdest2 = 0;
- U% H& p0 ]5 j) l% A4 C
6 t5 E, ]- T6 f/ W* K( q2 t8 w$ |- char *dmabufsrc1 = NULL;
; Q& n, Q0 X. r1 L) ^- D - char *dmabufsrc2 = NULL; O/ U2 d" X; e. [. S, A
- char *dmabufdest1 = NULL;7 C( [8 w- E% z
- char *dmabufdest2 = NULL;
2 r& T5 p+ z" b# Z# Z
$ K- n, f8 O7 E+ r: o; k- static int acnt = 512;8 P+ y c7 K& i" u9 g
- static int bcnt = 8;
: K- D8 p/ i1 R6 \ - static int ccnt = 8;
8 |/ s) u: z8 x7 `
1 @# T5 N2 b4 [9 n) n' _$ y- module_param(acnt, int, S_IRUGO);
3 k$ \! z7 d9 y - module_param(bcnt, int, S_IRUGO);
( {& n" {$ r1 [+ p! v - module_param(ccnt, int, S_IRUGO);
复制代码
! @; q5 z/ q: l; g( Q
/ U& U' m. O7 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, t: j% x7 N/ a u/ E- I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Z; i1 l6 t/ d- `+ A' G$ o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: b o- w" J$ E. _9 h4 J
; L" I) j" F) a6 r6 k! x( v; L/ P% W4 t8 f
|
|