|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* z4 C8 B" ?. R: M$ C# _- [code]EDMA sample test application
: g4 K# _- a" Y g0 e - /*) Q- q2 A# l7 T+ e' w
- * edma_test.c' C; {1 ]7 P, \8 W3 z% Q- }2 M
- *
! Q9 O0 |# o8 @! f( J& ^! W - * brief EDMA3 Test Application
; ~ T3 {$ S( R. r. o0 l2 O6 T - *: e" c( V& g" \
- * This file contains EDMA3 Test code.# L( e+ H1 W* D8 }+ u8 [7 C
- *
! N# ?# ^" i' O, j- i# R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 v: q% c# ]1 b8 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! H9 W( ~0 y2 ^+ }( n/ p, D' ]
- * TO CHANGE.
& Y- S5 W1 C3 L1 v - *
4 E' ^) x7 y* C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! x; _9 p2 _ Z3 F0 o% c4 `: [
- * f1 y4 c( U. Q
- * This program is free software; you can redistribute it and/or
0 f) N/ T- \9 Q- l# q8 U( u6 J - * modify it under the terms of the GNU General Public License as
8 k# L7 U1 ^5 V1 P1 @. s$ k - * published by the Free Software Foundation version 2.
0 c3 X, J' R' I1 B; p - *1 }. r& p3 m3 @( q0 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 r' r& T' Y, m3 q' B6 x/ _ - * kind, whether express or implied; without even the implied warranty) Q) W" [0 m5 R9 B& h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# |9 ~" X! b- J" Z! b3 a: V8 t U
- * GNU General Public License for more details.
/ h9 T' Z9 r7 b. e" }4 q: A - */
) [# s \. O u$ t$ c! y - # U& ?1 K. H+ V$ d8 q) M
- #include <linux/module.h>0 ~% b' B9 u* `/ j6 W- M; B
- #include <linux/init.h>
* @1 V/ S* ?2 W) I! @9 }- V - #include <linux/errno.h> g$ @$ w9 Y' j8 w @" u
- #include <linux/types.h>
' Z$ q3 ?+ R- }/ s - #include <linux/interrupt.h>5 G$ Y1 A; d7 G$ \9 V3 w0 k2 h
- #include <asm/io.h>/ J; i; ~& \* J9 E, O
- #include <linux/moduleparam.h>
# }, r1 S$ J# w( j/ n2 h - #include <linux/sysctl.h>- g; s# h" x7 P9 d7 ~) s
- #include <linux/mm.h>
, G/ |1 L3 k: \ - #include <linux/dma-mapping.h>
% r: m5 u9 b% K. i8 r! c: l8 K
6 T l. D' @6 S6 m0 m: d0 }) `& a- #include <mach/memory.h>
, a' \; w& @/ y& u# ]6 t5 {; u# X - #include <mach/hardware.h>
2 j# Q, X4 K K7 b: F! x9 x - #include <mach/irqs.h>
3 s& B8 X- A6 u6 N - #include <asm/hardware/edma.h> {3 o/ g! J* r0 M* e& k! F# K$ K8 b
- 3 ]% r8 o2 m; L% s
- #undef EDMA3_DEBUG
! A5 f2 i0 F" e# M+ A3 S - /*#define EDMA3_DEBUG*/
! H3 e' h# K; o9 H5 ]3 F- \9 @6 H
& W* B$ P; U" Q6 |- b- #ifdef EDMA3_DEBUG; c6 n7 o3 R/ z% k+ K3 [ W% g' i0 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 H: s* Q7 F" Z9 ?6 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! x! I) y& T6 |% Z8 X* @+ k" V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. o" D* b- n. _( k8 `* i! l - #else' ]* ~: `5 L) e/ s Z& H7 R$ u
- #define DMA_PRINTK( x... )" P8 P& Q0 E- ~8 [
- #define DMA_FN_IN+ O" F! T0 a2 ?5 o+ v1 d* x
- #define DMA_FN_OUT) {( h. g1 e! L D. S8 o" g
- #endif# h0 g2 k! l# P* l
- . p# s3 ?0 o- {( ~- D6 X! o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) @, [& t" Y, Y; H( T+ _* z& ? - #define STATIC_SHIFT 3
9 `$ R7 P, _/ V# T7 \" j - #define TCINTEN_SHIFT 201 K- b( W% } F6 C% R/ v
- #define ITCINTEN_SHIFT 21; ^0 | e# o/ W* F& u# V
- #define TCCHEN_SHIFT 220 y1 a1 k% T. @9 U* v
- #define ITCCHEN_SHIFT 23 n2 B3 J; g% U7 y5 _8 ? J7 K
" }0 z. I3 D3 X- static volatile int irqraised1 = 0;6 N) a: B6 R) M- K, P( w
- static volatile int irqraised2 = 0;( o- \. h0 i- T5 ~( N' D% R
, ^6 l- Y: ^; D6 A) [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M3 o7 u: f6 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; f( ^% B& p' b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P5 @7 `. M) \/ y5 t! H* w) S/ u& @; s
% C# A: m! |* H: U: D- dma_addr_t dmaphyssrc1 = 0;6 r j6 m4 h5 H
- dma_addr_t dmaphyssrc2 = 0;% d% r: a2 S% j
- dma_addr_t dmaphysdest1 = 0;) L6 s3 G9 k9 Q
- dma_addr_t dmaphysdest2 = 0;6 u) X; z" K) @( Z% a
4 R/ @' n- E3 ?+ z- char *dmabufsrc1 = NULL;+ c1 t% S9 `9 t
- char *dmabufsrc2 = NULL;* b( B! A7 e( W, B1 e$ {
- char *dmabufdest1 = NULL;. D1 `' t1 b8 [+ D8 `' c: X/ r- m
- char *dmabufdest2 = NULL;7 A, Z E$ \9 l. y @$ ^4 H4 I
* l/ ?/ g6 S( q, x: \* S" ?- static int acnt = 512;
/ U' J2 x5 r h. `+ u9 U - static int bcnt = 8;
+ p4 x+ D! y: R) M Q1 x - static int ccnt = 8;
8 b7 F) P1 h$ ~9 O9 b- n" i& w
! l5 |7 a# [0 H$ Z0 n- module_param(acnt, int, S_IRUGO);
4 p# S" ^! \9 G, e' v( W& ]+ L - module_param(bcnt, int, S_IRUGO);& J/ K9 h# u: v
- module_param(ccnt, int, S_IRUGO);
复制代码
$ \+ ]% k% e- ~, ^- m6 Q3 S4 y4 B! m8 p) ^( n1 N" {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ~! v1 e& K/ l; H- l3 A9 N9 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- g* D* |2 r# b/ x, b5 c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ d0 a. h) @) u5 s. G& K
& S' k) X; u8 D m9 O( k% f9 Q& \
2 v4 B3 {; M& }. J0 N |
|