|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 e' a G+ p* G( {+ V- [code]EDMA sample test application' ~8 i% d! A" H3 Y- l4 ~
- /*7 _7 b# u" ?. ~, Y2 Y* p2 W
- * edma_test.c
n0 e' [7 M$ _. j - *4 l! j# R4 h0 R
- * brief EDMA3 Test Application
+ m3 { W0 N3 i# l, T/ n& U2 s v9 a - *
5 [4 J+ H8 w+ r- q+ U; D' Q7 Y" t, P - * This file contains EDMA3 Test code.6 s; v0 _% E( X) P
- *8 w* J G4 X7 ^; W4 L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 B$ m- M6 K$ @) Y; Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ w/ o2 c' b( N4 S) p! }) p$ M
- * TO CHANGE.* X5 @ H6 ^/ c- [& d5 X) a. O
- *
/ }9 ]# f& _$ Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' O Q3 U5 n, b/ V# ^7 H
- *
+ {8 E9 h+ p. `0 r2 c1 i3 ^9 k9 R7 ~ - * This program is free software; you can redistribute it and/or) n: G4 N7 H; `$ E, p; d
- * modify it under the terms of the GNU General Public License as
$ W# o1 w; ] u% A - * published by the Free Software Foundation version 2.
! i; `0 B, Q8 H& P4 |2 D - *
% _+ F8 r0 _7 k# b* ]! o5 L9 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- A+ ?4 C* |$ N- |- _. ~8 O% m
- * kind, whether express or implied; without even the implied warranty
) U! R# U' O9 I; ]7 [; r. [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 ^+ C5 b/ H: c
- * GNU General Public License for more details.
! A) i( x F3 b& S$ z - */
. }7 m3 L+ k! k
4 S/ E# W2 L0 F8 r- #include <linux/module.h>$ K2 C, K4 \" U Z0 e
- #include <linux/init.h>4 O: {+ b3 [4 c/ v6 z9 J; V
- #include <linux/errno.h>
8 f( |! y! {- y; w+ s - #include <linux/types.h>
% H m% g! X( k+ H! Y - #include <linux/interrupt.h>
- w( u6 L5 t, S \) N5 | - #include <asm/io.h>
* b7 d# a4 \6 L. X$ }( O+ K. C - #include <linux/moduleparam.h>
2 z3 I( s) d# C - #include <linux/sysctl.h>$ h( u/ A3 f+ G3 F# {7 A; ~
- #include <linux/mm.h>6 v5 O; [. Y0 I& W4 d [
- #include <linux/dma-mapping.h># w! g Q: q/ s0 Q3 Q
) ^4 J3 O- _0 V ?7 g- #include <mach/memory.h>
& Y' q( e' X+ Y+ e! g - #include <mach/hardware.h>
/ M: N9 d9 U7 g+ Y% z9 b" |1 ~ - #include <mach/irqs.h>
0 H$ a2 B3 p% `9 B; Z - #include <asm/hardware/edma.h>
/ c y. `7 g+ z- g* Y - 4 B/ F: J0 m* r; F; O; G7 Z F
- #undef EDMA3_DEBUG, J7 U# y! G' |/ Q" ^% h6 ^
- /*#define EDMA3_DEBUG*/
/ D/ x9 d9 f+ r: f# y" a
! a6 _" M' B6 o; h" h) g$ l. F$ P( x- #ifdef EDMA3_DEBUG
; E0 o* u/ `) `! w5 }* J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ D1 B( |' j; z& `. Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 O0 Z( }& G; a, C% \6 k. L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ r; m( Q# N/ e& _
- #else6 {' p2 Z2 h/ e' h0 L
- #define DMA_PRINTK( x... )8 u- O" {% q* R/ [- q, [2 ]
- #define DMA_FN_IN5 j3 z. J" _1 b$ d: g
- #define DMA_FN_OUT
' c" z5 J, k* F/ D! c6 E - #endif
( E% V; u, Q: ^5 B7 ^ - % L+ ~2 d6 ]% K/ }' q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- g4 S* L$ o/ ^* ?/ o9 E6 q
- #define STATIC_SHIFT 3
# Y- G! y; b+ j" S - #define TCINTEN_SHIFT 20
2 b& \+ c4 `+ O0 H+ D1 P2 s - #define ITCINTEN_SHIFT 21
% H! Q! F; H6 R: q2 r# x - #define TCCHEN_SHIFT 22
3 I6 g! @3 c1 ]7 L% n0 Z# E - #define ITCCHEN_SHIFT 236 r) W) Y7 u; F/ ~" [+ {
# \9 L: |4 X7 P7 x- static volatile int irqraised1 = 0;( x, u7 {" F3 W
- static volatile int irqraised2 = 0;- ?/ t6 v1 U9 ]0 \, c; v7 m
: v( ^" k" ^0 L* g+ S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- [2 g; e! h0 Q. F4 o# j3 y" E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q9 U" w( `) p9 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ?+ R6 B7 m1 q/ x: U - + T2 f* @* ]0 J j* V" @# r
- dma_addr_t dmaphyssrc1 = 0;% ]1 Y' x$ q' ^8 o) B
- dma_addr_t dmaphyssrc2 = 0;# P2 ]: t5 i2 y$ e. @
- dma_addr_t dmaphysdest1 = 0;& m9 M w1 x" J& m: V, L7 I
- dma_addr_t dmaphysdest2 = 0;
3 y$ @! V: g/ ?, L - o0 K- {2 X/ {4 e2 Q
- char *dmabufsrc1 = NULL;+ V1 l8 ^0 b3 x
- char *dmabufsrc2 = NULL;- O, R0 j$ L, A9 I5 `- w8 d( B+ i
- char *dmabufdest1 = NULL;
$ {5 t7 T+ \1 d3 T - char *dmabufdest2 = NULL;8 s; }- J3 v+ Y" x5 G+ `
+ T6 ]6 e3 e& a% y4 D4 r- static int acnt = 512;
& h. C8 N( L( M+ P4 n6 C - static int bcnt = 8;
+ q9 P) J& c7 v o: R - static int ccnt = 8;- i9 b/ X( I7 Y4 G$ X
- - V8 ?( z. m0 S( }
- module_param(acnt, int, S_IRUGO);
. E% a; O; P7 | - module_param(bcnt, int, S_IRUGO);
% s6 ] R+ _1 F; L. F# \ - module_param(ccnt, int, S_IRUGO);
复制代码
, \( N4 j: w) t
$ X, r: N2 o1 C: c7 B" T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ?. w7 K8 D0 T2 I5 ?. R# L$ \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 R+ E/ s0 B- S( C" z8 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ O6 A2 R; e3 S n
3 A1 k% e: T. p1 W( ?8 E0 f, M- ^3 Q. S6 v, c8 k3 E
|
|