|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ B% ~' N0 l( j) \* E) u& a- [code]EDMA sample test application
' u$ @: o( c) ~ h- n: v* [ - /*
( q- Z! X4 S) O7 e4 x+ R9 o1 m& `) l - * edma_test.c- U% r" A7 n: L7 |( E
- *
) p0 I5 q2 Z8 A8 g - * brief EDMA3 Test Application' h" l9 O. k, _
- *) ]+ X4 I U5 ]
- * This file contains EDMA3 Test code.6 ]0 p) K) d) f, B
- *
7 S! I2 y) ]' g* J. P% e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 v# }6 C8 H4 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Y4 v* m$ ~# v1 G+ F
- * TO CHANGE.7 ^; }0 H, X5 u9 `
- *, |( R1 }- W; |# S" u( H# ~& m6 \' v+ k9 E+ r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 P& h' {- {# n" X+ ?
- *4 [* u% |5 H9 U$ N/ p1 I. B; p
- * This program is free software; you can redistribute it and/or& Q( m" M" @: q6 z3 o
- * modify it under the terms of the GNU General Public License as
5 ], D w& f# _6 w. ^, K - * published by the Free Software Foundation version 2., g9 k. \9 h. M3 b
- *8 ~. @% {& Z' X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: S- W5 Z) L/ U9 c3 D7 ` - * kind, whether express or implied; without even the implied warranty
4 I( p( b }# n$ P. N; | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 ]5 Z# s; ^% o6 M% |& y - * GNU General Public License for more details.! n8 _; u* @7 x8 d l
- */
5 H9 K6 f7 u y: t
* X; l3 L6 D% @& `' W2 y6 e. |7 d- #include <linux/module.h>
( m: ]$ Z$ g7 q - #include <linux/init.h>3 \. O. o* \: |2 K! ~& b1 N+ N: q
- #include <linux/errno.h>
2 e; m0 l/ k. j2 j$ @8 p - #include <linux/types.h>
, ]* l' a$ j- i9 n) Q0 x - #include <linux/interrupt.h>8 j! B6 {$ w8 _ z3 u6 k
- #include <asm/io.h>% _- a- Q, F) C7 |. q+ m- `( c
- #include <linux/moduleparam.h>
- K/ x' ?3 s+ P% \ - #include <linux/sysctl.h>
. x$ t1 U7 U+ K) |: c - #include <linux/mm.h>
) v( y2 ?9 t7 x* } L - #include <linux/dma-mapping.h>
4 ~, I. F5 e3 Y# L/ g: ~8 E
# @ n+ E7 X% L" ^' ^" x- #include <mach/memory.h> g3 P- ~* p! p: _( c5 g, U
- #include <mach/hardware.h>1 ]8 ~8 `4 c" Z7 r4 J9 b
- #include <mach/irqs.h>' f0 R9 D" ?# s- I( N1 z& X% A: h8 N
- #include <asm/hardware/edma.h>
/ p: ^5 V" D) }5 O; s) B J
+ u" Z, S2 b! e7 B3 K2 D3 }/ g4 |- #undef EDMA3_DEBUG
) Z$ e) u0 P9 b6 p+ I8 ] - /*#define EDMA3_DEBUG*/! w% N, F& n4 C7 x& ` y
- ( F$ b ~& H( V& d
- #ifdef EDMA3_DEBUG
7 ] B3 |+ X s2 B U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ^/ o" v! C6 a' t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 N/ ^& w, S6 i4 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 K7 S9 \0 c( f7 b1 o* T - #else
" E& {% c8 Q( }6 {0 d - #define DMA_PRINTK( x... ) D* e d! l' ?+ p- _" O
- #define DMA_FN_IN
5 W+ V: L1 z; X0 i S1 M - #define DMA_FN_OUT
1 n- v/ Q2 l" V2 _: i5 @% M - #endif
# N/ {* ^- D% Y5 r4 y( ^1 { - ! \$ l0 P2 B: t' ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; Y V: ~5 L6 O - #define STATIC_SHIFT 3
4 Z+ {$ k9 b% e) | - #define TCINTEN_SHIFT 20! _( V& K! q; o/ E
- #define ITCINTEN_SHIFT 21( f4 Y0 L% J6 W; q Z1 d
- #define TCCHEN_SHIFT 22
8 k1 L5 K! o. ~ - #define ITCCHEN_SHIFT 23
, g7 a0 n }6 w
+ o" m+ v# f# f- static volatile int irqraised1 = 0;
! {8 R$ u5 o3 L" H! B - static volatile int irqraised2 = 0;
7 m3 E2 ]0 M+ H* D
0 V! o% _( w1 I# b2 z0 N' x) K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 g3 n& Y: ?5 |- c# @5 I5 H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }* j }6 q4 Z/ C9 J: g: ~& i0 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i2 O# Z: y7 j$ U8 @
$ H1 D! ~: W' b+ I/ H |. J- dma_addr_t dmaphyssrc1 = 0;* s9 V' y% e; s { Z5 O
- dma_addr_t dmaphyssrc2 = 0;* Y4 ?% V- q0 o0 ~. {
- dma_addr_t dmaphysdest1 = 0;
/ H$ Z9 _8 y- I2 L h" G - dma_addr_t dmaphysdest2 = 0;
' O q/ G. V. h; |
j% d; j2 g' C7 ?% I r- I0 Z4 _( f$ X- char *dmabufsrc1 = NULL;
) D7 m% K0 }' r; M$ X4 p$ g! J# @- E - char *dmabufsrc2 = NULL;
9 V9 D* U3 j2 @6 h" p( x3 H6 O - char *dmabufdest1 = NULL;! [% {* z. E& Y! W( E; f
- char *dmabufdest2 = NULL; u# k& i$ Y" E& ]3 ^
* T- ~. s- w% g1 p: U( j8 c- B- static int acnt = 512;
4 Z. F6 w+ {0 N) m$ a d - static int bcnt = 8;
( F/ U% W/ u, s& N. q | - static int ccnt = 8;; U: X% q7 h/ U5 z
- ! n! p3 h! {: K3 o5 o2 Z- H
- module_param(acnt, int, S_IRUGO);! B- E6 t: @8 z$ ], ?( M
- module_param(bcnt, int, S_IRUGO);& z/ y/ f2 F- `1 R/ g1 y9 R) P6 h. x
- module_param(ccnt, int, S_IRUGO);
复制代码
5 ]" ^1 [( v; @) [$ ~2 a7 ?2 N' h! n! c' j+ j" A) D' p4 ]" `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 V2 Y+ ~6 m/ l6 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; J/ {2 T8 `! T* n& w1 o3 V& |) v g" {/ I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! S+ O! W- t" i4 y
& k7 L& r- F- P
' t6 \ G5 ^+ g: U |
|