|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
|/ M& l. E4 C- N5 J- [code]EDMA sample test application7 l. E9 s) w; Q# a
- /*
% E# ^4 u8 Y |" F: p, X- g - * edma_test.c. X; v' r$ [2 c8 H6 z$ Q
- *
( r6 o) G# d) H! `- |6 J. m - * brief EDMA3 Test Application, R1 H+ N6 l- C7 m5 @5 ~- R
- *9 g- H, W# k7 S7 }
- * This file contains EDMA3 Test code.
/ ?. I7 G+ }; Z9 N. G9 M3 P - */ i( i, v* q$ t6 V; o, q) I6 u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 @0 R. O5 n3 Z% {; T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" A: R4 |% C1 j9 f P" ^ - * TO CHANGE.
1 R- d% G0 t) \# G7 g9 C- H - *8 E$ Y( z' C* t6 Y! x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C7 w9 G2 g* Y/ K k% J
- *4 |7 p$ v7 T# w& I& z- Z3 s% V
- * This program is free software; you can redistribute it and/or! Q) t+ e' ^$ n+ d, V
- * modify it under the terms of the GNU General Public License as8 t1 d+ P5 ]/ B" u
- * published by the Free Software Foundation version 2.
$ d: V: g* R, B/ i- D - *. A$ i1 `9 G" ~2 l5 L3 p* V5 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 ^1 J P3 k) \6 R4 o - * kind, whether express or implied; without even the implied warranty$ ^3 ?4 Q( a8 L% I) F4 H& @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 d& H5 f0 z: ]+ B s) L* M% Q - * GNU General Public License for more details.6 @0 w+ e% k* h& g9 q2 m* Q6 @
- */0 A# T2 N3 n1 V
U+ Z0 ~6 x/ O5 Y' w- #include <linux/module.h>
$ w7 e7 Q7 Q. F# [ L8 w. ] - #include <linux/init.h>
0 R- {4 Q1 K' `. V% k9 \ - #include <linux/errno.h>9 [! b8 q$ I: ?* c- |9 k
- #include <linux/types.h>
! h# G: L F5 T/ x - #include <linux/interrupt.h>; E* G- Y( m- u# m/ |/ D& s/ j
- #include <asm/io.h>; U# v! }5 N$ a+ w% M
- #include <linux/moduleparam.h>
( H5 @7 q4 E- Z+ @( G* a7 y6 n1 P' l4 o/ ^ - #include <linux/sysctl.h>
# n2 J8 d; g4 y - #include <linux/mm.h>
7 C, d# |5 p: U5 j ?& ?& E% ` - #include <linux/dma-mapping.h>6 I3 ^5 l: ]) o
- " J4 A% j8 t! F/ ?
- #include <mach/memory.h>
) t3 J* A$ A; a" n1 _ M5 B2 ~ - #include <mach/hardware.h>
, d& ]! D' e( B3 p# U4 P! n) r - #include <mach/irqs.h>8 Q4 Y$ r: T- ^% [- ~
- #include <asm/hardware/edma.h>: a7 k" l3 R. ]3 D b. [8 ]
" ~- a2 H. r: B- #undef EDMA3_DEBUG3 ^0 n. ]" `1 b: H b
- /*#define EDMA3_DEBUG*/
: s' V) |) z8 R
% J8 Q8 u/ P0 E' X! `- #ifdef EDMA3_DEBUG
& s( k' _1 W: s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ P/ v. [% g+ c2 x" [$ ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 k& t( k6 E& {: u l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& ?5 U: T: v) c$ C& P8 K5 ` - #else
! h; _* y* G6 R( R* o y - #define DMA_PRINTK( x... )
7 B/ j- _$ g8 h4 H2 y; j - #define DMA_FN_IN" J: V! ]$ \" N' R/ p8 u# X% E6 b
- #define DMA_FN_OUT# k0 |. x2 _' E) \) Y
- #endif6 ^# M6 |. T1 m- P0 [6 Z3 J0 A
' j. s# p* I1 e: W/ c- #define MAX_DMA_TRANSFER_IN_BYTES (32768): x! z, Y, ~% K W/ ~
- #define STATIC_SHIFT 3
' P1 c: x! k) s5 Z3 p4 f% o4 q - #define TCINTEN_SHIFT 20
7 ~% v6 g- R9 Y+ l - #define ITCINTEN_SHIFT 217 D9 L& b) G/ p6 f0 a! H
- #define TCCHEN_SHIFT 22) V! L, o3 ?# `; y o
- #define ITCCHEN_SHIFT 23: o% S ?6 N# _- _/ s5 S
- 6 Q& K' e0 `' X/ W
- static volatile int irqraised1 = 0;; G- @' U' n/ r! W; {# C6 J- l( M
- static volatile int irqraised2 = 0;
! y! w) H; I8 t* Z) m) Q* l - 1 F5 o6 s: l) Y, ^' H" \0 _) ]2 n& k9 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^! f% `5 s2 J/ U" N# q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 u! W/ X8 i! W/ m5 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 d; ~1 B' c2 V2 w% h, S- T
/ E- W1 n2 |- B4 ]- dma_addr_t dmaphyssrc1 = 0;
" F; D$ k1 K! O8 x( o Y p - dma_addr_t dmaphyssrc2 = 0;5 ]9 e6 g, f" f0 `) y& ?. n, z
- dma_addr_t dmaphysdest1 = 0;
5 h6 b0 C5 W3 } l( |' d8 \& r6 C - dma_addr_t dmaphysdest2 = 0;
( s% I Q6 t( C( A; f* ]2 D" w
* f# M( x4 i% ~2 T0 m- char *dmabufsrc1 = NULL;
+ U8 A* `$ F$ J& J% o - char *dmabufsrc2 = NULL;
- M2 D$ R. o' L+ i9 m; y - char *dmabufdest1 = NULL;
5 ~) |& J+ n5 b - char *dmabufdest2 = NULL;: Q+ c/ ?% Y- a: U
- 9 @' d2 H9 U `& t* |: _2 k7 V
- static int acnt = 512;
" ?# f6 `; Y9 K1 R: [ - static int bcnt = 8;
( i4 W% w9 `7 Y h5 ] - static int ccnt = 8;0 E: c/ h* V7 h. B' `9 E
7 U9 A. q# G. z9 \- [/ T, `- module_param(acnt, int, S_IRUGO);: O' L# W- l8 @ W; h A& y
- module_param(bcnt, int, S_IRUGO);
s$ B G. U8 }. ^4 h - module_param(ccnt, int, S_IRUGO);
复制代码 1 G$ @6 D2 p1 w; S% b* W
. |" q8 V- }( L! Z7 h9 ]% R% M. P n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 W6 ?5 V! e) ^0 l7 D: Q+ a8 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 }) v4 K( T4 H" c, _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: D1 r1 w! q8 p4 q/ B+ X
6 l1 E* d& x+ p
4 s% o8 p/ @' c4 R9 a1 `+ | |
|