|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( B2 Y2 g4 z+ F7 q- [code]EDMA sample test application
$ Z# C4 J9 T/ e0 L/ u! \ - /*8 o9 Y9 `) T! `; c g+ P( Y
- * edma_test.c' f# O, q' O0 n
- *
7 w& q) D- E* I, N5 @1 U - * brief EDMA3 Test Application# y/ U: b2 ]. y9 u+ D0 e
- *
" f$ t2 I: s0 q" K3 L - * This file contains EDMA3 Test code.
3 N- O* H! J0 m2 E; p/ U s - *
7 N, I) `$ _/ v) R B" [3 }; j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 f- ]* m! E5 W/ k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& U4 G2 J( J; V% w* r' q9 \
- * TO CHANGE.
{* \0 |; L$ Z' A" h* X4 W9 Y - *: r) k6 v0 t' j0 v% G+ C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 D6 ]( c. H/ u7 [! T3 S# F& h - *
, W" Q$ p0 D7 k, q3 @6 Q1 v* r - * This program is free software; you can redistribute it and/or9 t" k$ W1 p# ]0 |* L; m" M
- * modify it under the terms of the GNU General Public License as
/ v" W4 j. A: _, a1 a* D - * published by the Free Software Foundation version 2.
" i! N+ C7 [7 H( u; l$ Q- G2 y$ g& u - *
4 q, g% j, f8 w% V N; ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' r+ q; I/ T. B v- X
- * kind, whether express or implied; without even the implied warranty
$ i; F7 j' h/ l5 {6 U1 F0 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& |9 J. V& p* ? - * GNU General Public License for more details.
' {9 w0 P# O7 ^' V2 F - */3 d3 g" q; c3 o1 c
; O- ~! t& v7 i- #include <linux/module.h>
1 O& C3 u: a# B/ {9 X& v - #include <linux/init.h>: r) b+ @8 O% \. ?
- #include <linux/errno.h>2 n; f* s1 w6 p; Y
- #include <linux/types.h>
E1 c$ j' L+ t9 _7 ?2 }; l) X0 U - #include <linux/interrupt.h>
6 h5 Y' j! J, { - #include <asm/io.h>4 K2 z# U" c* K6 o
- #include <linux/moduleparam.h>0 A. w1 Z. A0 A) t
- #include <linux/sysctl.h>
/ l, K8 K& h4 M+ K - #include <linux/mm.h>
/ @4 Z) ]4 C7 s9 p! S1 [, Z - #include <linux/dma-mapping.h>; X% p) a- f! T2 ^* i7 J
- 7 F, K: w2 O, W" \+ c! {3 T% ]
- #include <mach/memory.h>
, W' J" R; c2 m, L: y - #include <mach/hardware.h>
3 l0 H" h( H. R5 Y8 \5 I - #include <mach/irqs.h>+ R" K# H+ Y2 ^7 z; ^; T
- #include <asm/hardware/edma.h>
1 i8 J/ s6 `3 ^ - % _. K0 ^4 L' [% n# {
- #undef EDMA3_DEBUG
4 y. P& \& u. y+ L) ] - /*#define EDMA3_DEBUG*/
7 L4 {/ `& G1 U8 O - 2 y3 K* Y# i! Q- t1 I
- #ifdef EDMA3_DEBUG
8 o; ?4 c. Y2 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* F1 Y1 k& t$ G& {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( W8 ?' E- Z) E, Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- c9 z* F, Y# _8 R. R9 b - #else+ u5 ]/ I& T7 |0 T4 b: |% y. |
- #define DMA_PRINTK( x... )8 H4 M1 ^1 U3 C4 q
- #define DMA_FN_IN$ n+ P% k2 _- }* I
- #define DMA_FN_OUT9 h. ?' \6 D$ H% f
- #endif* ~7 j3 S( |% ?, | e
/ m" D9 J& s% S7 C _8 }1 b Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% m7 `: H- q7 T! C- m B2 t4 C - #define STATIC_SHIFT 3
2 V! y" l x1 l$ t9 Q8 Q/ M - #define TCINTEN_SHIFT 20: c D3 s* m+ P6 P
- #define ITCINTEN_SHIFT 21
; E# g3 A- x9 h/ T- O, U4 y* A - #define TCCHEN_SHIFT 22& N5 G; N3 Z) b" G3 H& o
- #define ITCCHEN_SHIFT 23
% P8 G5 [% d/ L6 B* O" j6 p! Z
, k% l% y2 {2 [+ ~; z) I- static volatile int irqraised1 = 0;9 B* e8 Z3 s0 l5 ^; Y1 w) x( k% d# N
- static volatile int irqraised2 = 0;4 b, T0 s3 X. N' Y' t) ~
( |, t* r4 [; J9 F7 ?, Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a7 |3 W6 C l \ k$ S7 A+ ] v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T/ E$ H' Z9 L; `0 B. v u3 d- }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 `1 ^8 z* }+ h( X7 m% a
# v8 B& l# q7 W; q6 y1 B# L! i- dma_addr_t dmaphyssrc1 = 0;
D* {7 k2 i2 a" {0 p' w! v - dma_addr_t dmaphyssrc2 = 0;, P1 W j5 N5 B& a% J" B4 T
- dma_addr_t dmaphysdest1 = 0;
6 x" o( s, @( w# l1 N' u' ~ - dma_addr_t dmaphysdest2 = 0;5 H$ @# h" ^- w; D: |$ K2 ?& y
- ( x! F" N5 g$ Y
- char *dmabufsrc1 = NULL;
# v9 H9 n- t/ c$ b5 Q - char *dmabufsrc2 = NULL;
6 |9 i* a! R# _* c7 ?7 E - char *dmabufdest1 = NULL;
! {& W3 k' [ B- I - char *dmabufdest2 = NULL;1 A2 Z+ h* r: ^1 V
- 1 y4 r7 K3 A- Z
- static int acnt = 512;3 u; T* s7 V8 r7 z+ k
- static int bcnt = 8;$ [4 n1 S+ u( }
- static int ccnt = 8;
; T4 Y5 r; n1 \! L5 _7 m) Q
" w; O' B; l0 g" r% i' n- module_param(acnt, int, S_IRUGO);0 O+ G6 g4 v G
- module_param(bcnt, int, S_IRUGO);
2 ?% j1 D6 s3 I& m% e g3 [ - module_param(ccnt, int, S_IRUGO);
复制代码
1 G/ I( r' }0 {+ H" a* B: d' K& @5 B5 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# o. j8 ]5 v7 H& barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a) l: S9 n2 Y* G' g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 q% C4 s0 ]+ F n2 k6 ~& e
- w$ n! D) r1 q4 ?# ^5 g- j. X0 i
- Z- d4 O x, J
|
|