|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 n! f& C* D1 n5 X( H; L- [code]EDMA sample test application+ N P V4 \1 [: a: |; ^) P' R
- /*
% a7 G7 d- j' J- D) l - * edma_test.c# Y5 K* A: `8 ~, A T( n
- *
: P% {6 L% ~; Q6 E6 ^: g* E - * brief EDMA3 Test Application
8 f" {6 j* e; {! @ - *0 Y" n4 [) B0 H2 ?
- * This file contains EDMA3 Test code.$ D Q. j+ s2 p( E# h
- *7 }7 B- [1 t- z" s5 L" M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" q' H: a% D3 W) I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 b; t1 T$ m7 I+ m2 ~/ C7 U
- * TO CHANGE.
+ `6 T( _3 `: o8 x - *: e$ E1 k# ?* z# X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& }$ I9 _2 U9 R6 L* H V/ S9 u! e - *
. s+ Y6 E* {" Z5 E - * This program is free software; you can redistribute it and/or, y- o9 y; ~/ D* Z* Q
- * modify it under the terms of the GNU General Public License as) t# _* z, ^4 A t
- * published by the Free Software Foundation version 2.7 y( y: W" N- U( ^, K
- *
- Y. m/ u1 |. Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 q7 e5 \( d6 e - * kind, whether express or implied; without even the implied warranty
. I& [$ p/ n6 \8 m: x) N' v& v q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 [# o% k: n9 b9 _) Y* f - * GNU General Public License for more details.
0 Q5 W6 E0 Q6 G7 C1 {- S - */5 u) L1 J" e3 B3 z* F
9 G: h5 {$ }6 n( c& }* Q3 C- #include <linux/module.h>
$ m0 B3 n# f1 @' {( Z - #include <linux/init.h>1 S0 [, u" `, d& P
- #include <linux/errno.h>
' G: S! I. V5 \9 [2 h - #include <linux/types.h>
6 B9 p6 B; w) J8 T4 o0 I3 X - #include <linux/interrupt.h>
! o7 ^' P2 h0 o) ^0 I2 t: T - #include <asm/io.h>5 V1 I9 x; n, @; y' y
- #include <linux/moduleparam.h>4 y8 P9 P. g+ M
- #include <linux/sysctl.h>
& Z, n% [ o9 L. J) G7 M% O/ F) A+ S$ h - #include <linux/mm.h>
5 Y9 y0 k# D; ]$ O7 z% o - #include <linux/dma-mapping.h>7 P0 R/ A* R4 ? e
- ; A- @* G5 L# V6 T
- #include <mach/memory.h>. R$ G5 e) N5 k# M( d# i) U- n
- #include <mach/hardware.h>
% h( N4 V1 w" ~$ Y! `( t - #include <mach/irqs.h>; d( Q [: o6 T h
- #include <asm/hardware/edma.h>
! g/ `! J, g4 Q' r: V" w - ' ~6 N, A1 {9 z! R3 X8 f! C$ B
- #undef EDMA3_DEBUG
' t, V! w% A; W& @: E( l3 t4 f: e - /*#define EDMA3_DEBUG*/: d8 ^3 q, O+ C0 o
2 H% g$ U; ?6 r- #ifdef EDMA3_DEBUG
$ a6 R& d$ q; I" |% M" `7 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 f- _8 K/ _9 r- t. d h9 V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 a( s( r. b) w, @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 M/ C0 q* o% Q! K
- #else
2 g- J9 M3 E0 a: Y, O- u7 B - #define DMA_PRINTK( x... )
3 M* n/ l8 _( O& C6 D) ^" I8 r0 z( N; b - #define DMA_FN_IN4 W" M4 S0 D6 L6 g2 N
- #define DMA_FN_OUT
% O t0 U; G6 V - #endif
1 y! z% n, G) Z# |
$ S) Y/ s j3 }' b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' [; H/ j7 h# g. g0 V7 e7 Z - #define STATIC_SHIFT 3
, u( _$ d* a$ q9 m v9 D, ^ - #define TCINTEN_SHIFT 201 @0 `& S8 z) y6 t' v
- #define ITCINTEN_SHIFT 212 f* I+ n+ Z N+ z
- #define TCCHEN_SHIFT 22
' [ B& E7 s: V - #define ITCCHEN_SHIFT 235 M& n+ m' j/ a% S) W
- * }- J; x( v% M1 k
- static volatile int irqraised1 = 0;; C3 N$ _6 B! R& ^: T' l9 P% d7 _
- static volatile int irqraised2 = 0;
y7 S/ _2 z/ x* I - - E6 l+ `+ ]* e; v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 D. d+ }& J2 }6 H% l- N' Y) U, K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 o' h8 m( T8 r% L q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( O3 Y' `9 Z2 H/ S+ D% y2 F. e: k7 M& k
3 f9 K/ ]$ k$ c. O" V( Z- dma_addr_t dmaphyssrc1 = 0;
6 O$ R" ?, n/ d! G - dma_addr_t dmaphyssrc2 = 0;5 Z. W! e, l: V, C7 @
- dma_addr_t dmaphysdest1 = 0;
! a0 @" t5 D9 d" h. j# T4 W0 W - dma_addr_t dmaphysdest2 = 0;
- s3 p) ]& [6 Y+ g6 q$ p5 O
3 Z+ X/ ?7 O+ A' e9 U- char *dmabufsrc1 = NULL;
: x' |0 I- U3 K" B - char *dmabufsrc2 = NULL;
* z9 A' P( |1 a* A( c - char *dmabufdest1 = NULL;2 t, l4 s: V ]
- char *dmabufdest2 = NULL;
# T, n8 I4 [2 W& S3 c3 p- F' I - 5 }$ U, S* Y7 O& F
- static int acnt = 512;+ `& y, B M) G
- static int bcnt = 8;/ W4 ^5 @$ ^7 b. @ n2 k
- static int ccnt = 8;* e+ G% W2 g4 N0 Y; b& \
4 O- v# g$ w P% E- module_param(acnt, int, S_IRUGO);2 ^, [! c; c* k; R
- module_param(bcnt, int, S_IRUGO);
1 m5 ^6 D/ a, { - module_param(ccnt, int, S_IRUGO);
复制代码
6 H& J5 @4 N% @& Z
1 ~# m; c; f+ }- _, n4 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ^3 I- l8 C) Y/ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 j% G* F' H- g6 o, K; f8 L6 p" ?( f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& e. o* o2 c, R. a# c8 X& Z4 _. ?' x* ?! b# t3 \1 z6 \
- O! S; L# }9 f' g4 Y |
|