|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. N. ^* }4 s `) G" p6 S- [code]EDMA sample test application
# r9 ] E' S4 O7 c+ r, j - /*
$ t9 g7 `0 y* R2 w B) n - * edma_test.c7 @. W5 U. Q1 T# n
- *
- d" r a; i! F/ [# X - * brief EDMA3 Test Application9 k- z N9 Q& B8 x- Y$ j! X1 S. W2 b7 I# T
- *
3 h7 `. i% Z0 Z) _2 {- A) Q' F - * This file contains EDMA3 Test code.( ?; [, d i" K# g' M
- *
5 c9 K+ f) g# }- X' N2 L5 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. T% [. t% j4 L, T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% o+ X$ t) R% d0 P
- * TO CHANGE.
' r$ g: z4 L7 X1 b - *
! l5 L1 J x# c/ p. L$ t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( o5 L# j/ E1 K. {4 w) @
- *1 O- u3 U4 b7 X
- * This program is free software; you can redistribute it and/or( h8 v- l2 E- g! T6 t1 M2 V" @4 A
- * modify it under the terms of the GNU General Public License as
" z7 n" q/ w- D O! q - * published by the Free Software Foundation version 2.! S" L1 z/ `, h/ n. K: _* f
- *
- Q5 l$ c* p6 D1 {3 b( |& c, j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _0 o5 C; m: r; I1 H; z& t2 Z- z2 H
- * kind, whether express or implied; without even the implied warranty
- j* J, u. s% |, @" `* Z/ ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the W/ @, b# R1 `" ]! g& j8 Z: c$ |
- * GNU General Public License for more details.
/ Z: y0 o0 v) R - */$ G0 F/ u8 B( m% S. Z7 |- ~. `
! X9 w/ o' A( ?$ ]9 j, v+ g3 ?2 z- #include <linux/module.h>! |- l* c @* V1 _) f
- #include <linux/init.h>5 T- q# Z; A' b& [" p$ _
- #include <linux/errno.h>
( \! q6 ?% a7 H9 Z" F! T" |% v( k - #include <linux/types.h>7 h. x6 S5 B7 M: E
- #include <linux/interrupt.h>
$ Y% q6 Q% V5 E- V - #include <asm/io.h>
3 I: M0 t& q. w; G# A/ ~9 f - #include <linux/moduleparam.h>
) _1 V: }; \! e3 \ v - #include <linux/sysctl.h>
9 p6 d# y) k/ e z - #include <linux/mm.h>
) Q: d. S8 ~* t - #include <linux/dma-mapping.h>
+ g/ S9 s' z5 \( N
: C. ~8 V5 O5 A3 P- #include <mach/memory.h>! _ m z0 I: N# @) i
- #include <mach/hardware.h>0 M2 b, ~( s5 z1 a
- #include <mach/irqs.h>
3 p5 W/ c: _$ l - #include <asm/hardware/edma.h>; R" ^ ~! u8 B0 |; y9 ~+ b
% Z* w1 u0 A& `( S1 A* R1 m- #undef EDMA3_DEBUG
; }, u/ d2 ^7 a+ l. P4 } - /*#define EDMA3_DEBUG*/
1 E& k0 P! _9 G; w/ B- ^9 y - " p3 }& \# k! k7 Q9 U+ W/ _9 k
- #ifdef EDMA3_DEBUG- n4 P8 {8 o2 m- X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 O" T1 e1 P- g9 f, U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 A9 a* a5 O3 ?5 [/ W0 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 c; `; t; f# J" s( y# o+ M - #else. `5 {: @' [- r( D& N
- #define DMA_PRINTK( x... )6 n+ w! \5 a; e- x
- #define DMA_FN_IN
7 k) O) ]/ i# v3 v: A - #define DMA_FN_OUT) U1 G' o& D x! m4 V& k
- #endif
" {: U" r/ ~1 M$ k- u - & o0 d# h6 ~2 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" ^. F6 D7 P5 m0 I, x( E: w - #define STATIC_SHIFT 3
. \7 S, V$ C- W5 ^( C7 ~0 I7 ^ - #define TCINTEN_SHIFT 20, n: t! `# x' T O- O
- #define ITCINTEN_SHIFT 212 B1 @. q% J# J# L: C5 ^' E' p
- #define TCCHEN_SHIFT 22! i) |4 q4 u# `/ d1 \8 b' u
- #define ITCCHEN_SHIFT 23
3 o; Q- }% a/ y$ P6 L3 Y - : X/ M) k# s3 t, b7 W
- static volatile int irqraised1 = 0;) i" ~8 k* I/ X7 Q2 }* y
- static volatile int irqraised2 = 0;
9 ]4 S1 |$ k7 p }# { - $ S7 z( Q) t- c3 E6 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 O9 @* G, T$ c8 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ M, w2 R+ ^% G( c& ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, r/ t' i# Y2 V
- : ]# x" B, T- O: v
- dma_addr_t dmaphyssrc1 = 0;
$ i0 \' X4 ~( N& y* G - dma_addr_t dmaphyssrc2 = 0;) k- P- s2 k' G. B0 b1 y
- dma_addr_t dmaphysdest1 = 0;" P' S% c4 n( G
- dma_addr_t dmaphysdest2 = 0;. E! ]' [2 O% X# j* U+ N: R
5 g. g9 p1 @. m% t& _- char *dmabufsrc1 = NULL;
) ^0 c* Y- u- G p - char *dmabufsrc2 = NULL;/ a) V0 {2 b4 v4 c' Y" n
- char *dmabufdest1 = NULL;
/ k4 U: D% C( r. o& s" \ - char *dmabufdest2 = NULL;" E9 D& r: i+ Z7 m$ Z) [
- 5 {5 b8 M/ m7 M# J: b, J; ?
- static int acnt = 512;+ K: _- L; w5 }) ~- s
- static int bcnt = 8;# D0 i4 ^, ^5 L8 |, n' ~
- static int ccnt = 8;
& Y1 e- R7 B; t( \5 ]# ?; t
! i& |( |( x! G: M$ Z- module_param(acnt, int, S_IRUGO);
! w: U+ l* q& K6 U7 B: T8 I# o - module_param(bcnt, int, S_IRUGO);7 K- A4 b1 R# _4 k" s
- module_param(ccnt, int, S_IRUGO);
复制代码
# A: m# L9 X% ?6 P6 G& S# e. M/ w; |" i6 z" V( u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; W; t# w0 N* B, q% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 c& m6 x6 g/ G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! W* _8 v2 C- |
! W: ~, y. c1 ^( F0 d# M* N0 j4 [
|
|