|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " d+ _5 \( Q3 C r" ^. E
- [code]EDMA sample test application8 L# {6 c: f) A, d
- /*' Q5 t, U1 {9 T6 V
- * edma_test.c
3 s, A/ ^# x( T6 A - *& e& @4 H( O1 i$ j
- * brief EDMA3 Test Application
# G+ e/ V$ F8 i5 v0 k - *9 J' n8 x* u* f2 {& K# z
- * This file contains EDMA3 Test code.& a* R8 X) ~* E! T
- *
) I/ e9 {9 J6 w# a0 O* `: Q1 q- g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) d: O8 d- L6 n. [4 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 \' x+ `+ P. S9 X8 g - * TO CHANGE.
4 S. t1 @2 f# C( Q s - *, G6 v& s% _" c8 T+ B6 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) s2 \6 r0 R. Y g) I
- *! Z$ U3 j! @3 B. h- b
- * This program is free software; you can redistribute it and/or
( s) n5 P; U0 e9 W7 t% T! r - * modify it under the terms of the GNU General Public License as
$ w& ^$ a' Y! N8 P5 M - * published by the Free Software Foundation version 2.' r: s1 [" X/ t+ c- H! ?
- *
" x! |1 D# I% C* `, B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 |! y/ J$ @2 f+ j% `5 } o
- * kind, whether express or implied; without even the implied warranty
3 o: K/ ~7 c, Q0 @8 [8 L) c4 a3 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Z" @' |- ^3 r+ L, l) w - * GNU General Public License for more details.
4 @/ W- j- r- Q) ^, q - */2 l5 U, P' F/ ~9 `+ z
8 Q# g* C, v, v3 h; G- #include <linux/module.h>% ~, D7 [+ l: T' {5 J' `1 M+ W: r
- #include <linux/init.h>, ~: \- e% {8 r% B# m
- #include <linux/errno.h>% m5 F6 p8 g1 C& p% Q
- #include <linux/types.h># _/ c2 W V( j3 @1 G1 P& a
- #include <linux/interrupt.h>5 g9 y- n+ [' o0 Q2 }
- #include <asm/io.h>( d8 q$ c) |& y L, W! _# \7 `
- #include <linux/moduleparam.h>
5 ]4 C& ~1 X* v( @2 p4 m+ o9 m - #include <linux/sysctl.h>
# i& H4 H; g5 l- F7 H - #include <linux/mm.h>. {4 \9 ~0 S. @- t
- #include <linux/dma-mapping.h>& @. B+ N7 d) K
# a& n% V4 _2 X1 u& V+ a( p6 ~- #include <mach/memory.h>/ x G# e8 f1 y) X! h
- #include <mach/hardware.h>
) h, r' i- I+ \/ W) }2 Z3 e - #include <mach/irqs.h>" {) o/ U2 Y* ~
- #include <asm/hardware/edma.h>
: I1 m' X. s- W% y1 f# }
9 m! M1 p' ~6 t7 \7 c& s- #undef EDMA3_DEBUG
, }6 o- G8 w4 E) Z, q/ W - /*#define EDMA3_DEBUG*/
' A7 V% c7 ?4 M2 r7 a+ x
& `4 _+ d8 L T* f: {2 {4 u6 h- #ifdef EDMA3_DEBUG8 U ?& u8 }* i ~% D( m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' r6 B& t' m1 U6 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 K, [" T. s5 [" n" [% g+ s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' K5 [6 u3 e# D: }& [; M6 d - #else
1 \( l% B9 O6 f: z/ v - #define DMA_PRINTK( x... )1 Z" A8 o! q- m( a/ O* a, p# y h5 V
- #define DMA_FN_IN
6 x1 N) \- m" b: f' | - #define DMA_FN_OUT
, R/ G2 g, E7 _8 m; Y& n - #endif0 M# N5 V m( N4 {
1 c; G3 D, x9 j0 N% N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 @3 u5 k# y9 N5 c+ \, s - #define STATIC_SHIFT 3# {7 ^! ?1 `1 a4 r+ k
- #define TCINTEN_SHIFT 20
& m7 v. x) G7 Y! Z+ K" J6 ?+ M - #define ITCINTEN_SHIFT 21; L+ {2 v* @' u5 V* F. L" d' Y
- #define TCCHEN_SHIFT 22" }8 H7 d# c. H0 D3 _5 W- Z, [; C
- #define ITCCHEN_SHIFT 23
8 g/ n; E% s8 S5 o4 @8 |8 m - ; y) H4 j+ l2 |8 I# g* w( y
- static volatile int irqraised1 = 0;5 H8 m, ?( T) v5 Q
- static volatile int irqraised2 = 0;$ L; H) V& V" q/ M. a' @
- 4 g& v6 e. L$ E) v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S2 ?0 f* A% i; D0 ~/ c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( }7 O9 C5 m6 N9 e9 d0 R! G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 I: s1 p* _$ J* n+ E# T; E
2 f$ a% Z) ?, f" Q* ~- dma_addr_t dmaphyssrc1 = 0;5 C- k: `" k# Q* a7 ^
- dma_addr_t dmaphyssrc2 = 0;
- y. g, L4 I3 \. C& S) G - dma_addr_t dmaphysdest1 = 0;6 E s: ]+ W0 Q5 }" L2 n0 e7 D4 v
- dma_addr_t dmaphysdest2 = 0;( L5 d/ z" r. {" M
! o, |0 O/ d: E' r0 T- I- char *dmabufsrc1 = NULL;
, n) d _% z. B$ t7 P f. _! J2 N - char *dmabufsrc2 = NULL;
8 |) r, W3 C3 G - char *dmabufdest1 = NULL;
! Y4 ^/ @* [9 M - char *dmabufdest2 = NULL;
8 \6 }. J5 i5 p - & U& z/ k/ s7 M# _
- static int acnt = 512;
% C1 i8 g/ G" V - static int bcnt = 8;* N$ G) H$ a+ t( b; e( Q6 C3 X1 |2 T
- static int ccnt = 8;
# S R' [8 m3 y% j( @0 F0 n4 J( E6 ^! g
; P4 `$ C$ P% i, s- module_param(acnt, int, S_IRUGO);
$ Q ~9 E6 S: J b" ~* U* T - module_param(bcnt, int, S_IRUGO);
' Q' y' b _" j+ u$ @7 { - module_param(ccnt, int, S_IRUGO);
复制代码 # j' t6 }) S. C$ U5 o. }% C
" E, p! f# R7 h2 n* g7 ~# ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; s+ V+ M6 w: ^& c9 X4 P earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) p2 M+ Z" O* }3 ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: k9 d4 C, |" g4 |4 I' h% f; Y
2 ?8 d# F; ]3 |2 P+ s r" ~/ @4 F
$ v$ G2 k" ^6 n7 G |
|