|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 l# j7 @: i9 f8 _+ j
- [code]EDMA sample test application
3 y2 N ~# a! u4 g6 b& \* O - /*3 i$ N' c5 y& H% D! F1 H
- * edma_test.c! I6 Y* |! z% P% N! T7 G D0 Y
- *
8 u( B; Q7 S5 @4 s" _1 u - * brief EDMA3 Test Application, k+ h4 a6 l+ M
- *% ~% o" B: i5 g6 v3 A
- * This file contains EDMA3 Test code.
$ L% H+ k) g0 z- r# x" S - *
- Z1 D( j4 [4 K' E: ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& a5 V% }# u7 }- W5 N8 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ~5 k- e9 a+ c% z# A) Q9 h7 i
- * TO CHANGE.& D4 h& L* d- L8 W2 f$ c& M
- *! N3 n9 v3 c4 S7 o9 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 M8 m2 z9 |9 u/ Y
- *$ h l4 v! N/ M+ n
- * This program is free software; you can redistribute it and/or
6 b8 ~: r! z$ b6 J' z- f8 X* d/ ? - * modify it under the terms of the GNU General Public License as# {3 {! z1 ~6 | P
- * published by the Free Software Foundation version 2.. }/ U' w3 _: o9 t5 M* ]$ }0 G4 X5 \
- *0 l, c; g) ]3 _# r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( `9 b. ^- \* X* ^2 h: q0 B8 C - * kind, whether express or implied; without even the implied warranty' m7 y' w; C x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; i4 K; ^1 e) n3 \7 G! `" w' G
- * GNU General Public License for more details., Z! B. s$ S! T; e* x' d2 f
- */2 {3 a0 X$ o2 A% Y- h+ K; D3 R' c
& ]& H4 f# }$ I( l* x* M4 M0 k- #include <linux/module.h>2 P6 p+ G: t- |. W" z& k) i, d) n5 e/ P
- #include <linux/init.h>
G2 ~4 B0 c' Q: e1 Z2 f& A' F6 C - #include <linux/errno.h>
, Z0 y5 D& V% I' r) u - #include <linux/types.h>
: x9 K7 a/ f: E9 I+ M# i - #include <linux/interrupt.h>3 x- ^) Q$ i6 G; L9 T% p& C
- #include <asm/io.h>
- S8 N& z; k8 b$ }( j - #include <linux/moduleparam.h>
& z& c2 B, W4 `1 j) B - #include <linux/sysctl.h>
/ e* f) |, O* r9 T( r6 `. v - #include <linux/mm.h>
+ ]4 F; C& u. a9 H3 J: u - #include <linux/dma-mapping.h>
7 l, N/ g5 E8 h - * l5 c* r# \/ o; C+ j
- #include <mach/memory.h>4 j. \# C1 Q% d4 G* J) d: m. p
- #include <mach/hardware.h> t n) t S3 Z# ^. o
- #include <mach/irqs.h> V: r8 `1 r( q: p! \0 ^$ y
- #include <asm/hardware/edma.h>
$ ^8 w6 _) [; L
4 q. w5 ^: A; j' ] e u! l$ d- #undef EDMA3_DEBUG
{6 h! G3 k$ \& c6 r0 y3 Y - /*#define EDMA3_DEBUG*/
" j1 K" E7 o+ n - 7 X& `6 g* \# n- ^3 n
- #ifdef EDMA3_DEBUG
( j( K7 z2 p5 R4 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- o1 V1 F: L B- _" |* X: U6 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: e0 V+ J& ~7 q* q6 U. I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 C. _0 m3 f% d
- #else
; ~9 e/ t9 K' c% d - #define DMA_PRINTK( x... )
$ {' \6 d) @& W+ s) |8 s - #define DMA_FN_IN- I9 C/ k# P1 Y) @
- #define DMA_FN_OUT
' i1 {) V7 |9 Z - #endif; K5 n7 s( x( k2 V; J% @ C/ x
3 Y% h6 W f2 a* M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" R! d/ {2 r q" [& J9 k5 R
- #define STATIC_SHIFT 36 i! p/ J' n0 y: E6 o
- #define TCINTEN_SHIFT 20
" i8 E7 J J4 z; Q; ]( O' X - #define ITCINTEN_SHIFT 215 W: s, `& o# G: n/ ^# U
- #define TCCHEN_SHIFT 227 o( Q! {% a& K$ _9 w% }
- #define ITCCHEN_SHIFT 23
# \. Y+ u3 o0 m1 \% F, d: |; }0 L5 @
$ B& `- b( \5 l9 X- static volatile int irqraised1 = 0;
( u6 a+ O" n4 ~- G: b9 Q% B - static volatile int irqraised2 = 0;6 G5 |7 Q0 f. K3 A5 p
- 0 \" K) n; a; G3 X' L- z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# U% n# ]- L9 m# u! P& s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# C. C7 p; l3 W+ D+ T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P9 v/ u; R; k4 k+ z
" j2 A; I# l" Y( L- b! t- X7 V- dma_addr_t dmaphyssrc1 = 0;
5 L( W0 o* I" B2 t- a b- ?1 V+ _ - dma_addr_t dmaphyssrc2 = 0;
8 P; _+ `7 d' ]+ B7 E& u - dma_addr_t dmaphysdest1 = 0;
: m( L2 N0 x2 W, f - dma_addr_t dmaphysdest2 = 0;# b1 d" u+ I" U Q
- 9 [( v" E @7 x0 B1 e4 J( ]
- char *dmabufsrc1 = NULL;
& @" `- }* r+ ` - char *dmabufsrc2 = NULL;
) H% H9 E! E& w: h) N - char *dmabufdest1 = NULL;
, N5 {# d2 w, m - char *dmabufdest2 = NULL;' a' H) d/ o/ n7 O2 K3 P
- 9 v! m' B2 Y- L! A6 t* H
- static int acnt = 512;% E! s% ?. ~& }: A
- static int bcnt = 8;
, D% S' K* i( F' w& J - static int ccnt = 8;) m4 {4 N h' s& B6 @: d
- ! y6 K1 `4 N2 U8 Q3 T/ t
- module_param(acnt, int, S_IRUGO);7 G* p/ D1 Y, `6 d+ a a
- module_param(bcnt, int, S_IRUGO);0 }) [- G; |) j x$ v c
- module_param(ccnt, int, S_IRUGO);
复制代码 * c3 L+ K+ j& F4 I4 |* F* n6 a2 h# b
2 @1 N- j2 U: s' I3 Q1 O9 B+ P% r* S8 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 w b9 p2 e$ X$ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 z# F$ q( r/ p! W, K8 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 D! g$ Z. }4 q" s4 K% W K8 ~9 _' U" U, \$ F# G0 X
+ r; z- V( }4 Q5 X. q
|
|