|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 Z8 s- S0 f7 |# v F/ b
- [code]EDMA sample test application2 Q' I8 H+ `3 c2 A* g
- /*9 y: R5 c' o0 f; ^( ~" w: z
- * edma_test.c3 d- ^$ \+ F5 \- `, a: V
- *
% O4 u8 K, j) E. P5 P7 ? - * brief EDMA3 Test Application: o( M$ \( M8 w( x9 U& T! ^; _
- *" }/ S' q y; c6 X$ l4 k
- * This file contains EDMA3 Test code.+ L+ g1 Q- J/ Z/ h% H7 c) D+ P
- *. F3 _+ P3 E5 d6 u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 m# `' X* F9 n. M& l" f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. F( o& t# K% i# L3 g; x
- * TO CHANGE.- L4 o; Y- s9 q( _. s
- *( E; M5 Z4 n! Z: r+ c( M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. r6 K0 U* b9 v; d3 d. m - *
, E& T& `2 ~# Q - * This program is free software; you can redistribute it and/or6 y' ]5 g+ H( M0 t2 A$ _
- * modify it under the terms of the GNU General Public License as
' T4 O7 D2 Y4 x9 ^: f. ~ - * published by the Free Software Foundation version 2.' D8 K3 t# }& \; X
- *
. r2 K- E' t/ v; K% h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" t( o3 `2 l! {; X# ?. e - * kind, whether express or implied; without even the implied warranty( p& R* L# M! e0 U: B7 A2 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& [# m4 G7 {/ l! Y+ {
- * GNU General Public License for more details.
! l2 L. F$ L; H. ~8 M - */% K* E3 h7 l) M- Z4 C7 Y$ s
( E6 U2 W2 M7 ^. K' D' x" f- #include <linux/module.h>( Z- H3 }) i/ R% h, j% y6 |
- #include <linux/init.h>
- m( R! C/ n+ `' ]' H6 N9 V1 B0 C: s - #include <linux/errno.h>% ` b4 K% g; ] m+ _
- #include <linux/types.h>5 ]5 I8 d8 S5 P$ U {
- #include <linux/interrupt.h>
: I% Z- p7 ?% ]( h5 {0 l& y7 k- O$ u - #include <asm/io.h>5 @/ H3 F) r% r1 z# I2 O H0 c
- #include <linux/moduleparam.h>& `) a9 `1 m1 T" N/ @$ p! r! [5 G$ c
- #include <linux/sysctl.h>: E. H& k1 |9 E" @, z
- #include <linux/mm.h>' D7 d4 Q, }5 H) K. Q3 U5 q5 @
- #include <linux/dma-mapping.h>% V4 i" m, k6 _2 S Y) X( V
- ( u/ e8 i! e/ j1 P1 y
- #include <mach/memory.h>/ T. s V9 V) `' {# N) O, B
- #include <mach/hardware.h>
4 v* A9 { s- E3 _6 D - #include <mach/irqs.h>
! n6 t3 }( m1 { - #include <asm/hardware/edma.h>
- M1 e# W p# t$ n8 z4 o5 K6 [ - 4 b7 I# {2 n2 N# v' C
- #undef EDMA3_DEBUG1 ?0 v+ x4 W) V2 D
- /*#define EDMA3_DEBUG*/ J% L! N k$ E9 y7 u
- " K% o, Z8 ^, V1 o7 J
- #ifdef EDMA3_DEBUG: ?( f k$ l. I; _: i/ N" L* S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. d; T7 q+ J/ f* L- a2 Y' d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, ]! C7 x( ]1 w) @6 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) e" s$ ]4 p( ?4 D' Z - #else( |2 }+ \ z. }
- #define DMA_PRINTK( x... )
. v3 k2 O, R) c6 b - #define DMA_FN_IN
6 E6 B; h$ C2 m) ~! B6 T$ H - #define DMA_FN_OUT
; R7 Z7 t4 c. h1 f# C2 J - #endif5 p. A% L1 N# s+ c8 p5 m' Y& Q N
" X! ?5 g$ p% J, K- #define MAX_DMA_TRANSFER_IN_BYTES (32768); V, X- d; q! L' ]5 r
- #define STATIC_SHIFT 3
- `0 t# Q& Q+ L% K7 s y! o1 ^ - #define TCINTEN_SHIFT 20
' {' J& ^7 M$ J+ S; R8 ? - #define ITCINTEN_SHIFT 21
" z ~) ^6 C" H( g0 V- R5 ^ - #define TCCHEN_SHIFT 22
( s8 }; J$ Y; m J, Y9 x, z - #define ITCCHEN_SHIFT 23
H& n7 p0 G) I
$ {8 b# f0 x0 x5 A, U' H- static volatile int irqraised1 = 0;
0 u2 P) L5 W2 z: G0 H( M - static volatile int irqraised2 = 0;. }4 p: |$ d |9 {' V: `) C n" c
& Y) d" q; f& \$ N; I! s d' C2 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
}, z9 e4 V4 t5 L7 R: x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p' P2 E# n5 [( i6 E$ @& E% O3 M7 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ?0 ?/ y/ a+ Q* N
- / U* D/ @6 |" L' K# |' \4 B, X
- dma_addr_t dmaphyssrc1 = 0;6 ~8 N, \9 ]/ q! n* z
- dma_addr_t dmaphyssrc2 = 0;
L$ Z# p$ y, c K# ~ - dma_addr_t dmaphysdest1 = 0;- c; m' E2 H( z+ R
- dma_addr_t dmaphysdest2 = 0; G2 r# ?$ _. H
6 N4 ]" e4 z& Z2 F" s& d: s- char *dmabufsrc1 = NULL;5 P) e2 c/ ]4 P: U( ^2 l
- char *dmabufsrc2 = NULL;
: M! M% V: {' e. | - char *dmabufdest1 = NULL;
: s: `5 O( }# u1 R) m: s. f - char *dmabufdest2 = NULL;4 u& {6 Q# ?7 w5 V# L0 `# j6 A& S
6 K; W2 Z) c4 f; Q- static int acnt = 512;( e! l% T! @; Z; G0 B6 w- j, [! t$ Z
- static int bcnt = 8;# _& Y1 a2 V# `. X& L( F; q
- static int ccnt = 8;
7 {8 D" \3 R+ Z; @+ S
2 ^' z {7 f3 R- module_param(acnt, int, S_IRUGO);/ i2 ^; ]* L: ?- i9 D
- module_param(bcnt, int, S_IRUGO);# x8 y6 K g! g& o$ X* \" u& V5 r# a
- module_param(ccnt, int, S_IRUGO);
复制代码
+ `+ Y6 P; L/ o* L; I, }
7 F. C' Y1 ^) b, E1 N2 b' E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% A" {) w5 d( @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! r! J3 F' G$ u" w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: E4 K8 e2 G& F9 I+ C: L+ d2 P% U
, y! L1 Y2 i& ?, v3 a |
|