|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 d! B: \6 M0 o* i5 g" f- [code]EDMA sample test application+ U5 ?% n* v r/ F+ H) \# \; W$ O
- /*
! |. e* Y; Z. i - * edma_test.c8 q( [1 _( H, g, _! M- t. d
- *
( X2 \1 W2 R- D2 M, g W! g- p - * brief EDMA3 Test Application
1 ]2 w* u9 _; i/ m# v% P( M% }, { - *
7 q1 x1 B8 y- U8 Y3 t0 t - * This file contains EDMA3 Test code., j7 |; U, e V! C. J
- *
2 s7 S. O# l' a9 J9 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" z, U$ o9 E( Q! q# \& B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT U" I, f- Q1 A. F- Q
- * TO CHANGE.
1 b3 \; O) P O! } - *
% O& H8 c$ h- F8 E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( R# `0 d+ v5 I- e0 n
- *
" L) t1 f7 h* z. T4 N. S: H - * This program is free software; you can redistribute it and/or- K, m- D9 A( ~$ b& \ s
- * modify it under the terms of the GNU General Public License as
- _, T# P2 l6 O4 X/ m7 o$ j - * published by the Free Software Foundation version 2.8 K) E0 h0 L* x$ ~& @6 @* I8 F E
- *1 `( `6 m' _6 O" D+ Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ A9 M1 \8 D0 @3 R( ]0 }0 t - * kind, whether express or implied; without even the implied warranty
8 w+ `" h+ c0 q5 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ {1 k3 o `* } o- u
- * GNU General Public License for more details.- R! p: z$ H* m& u7 g9 n# _& q" o
- */- l& k% l# K$ K' Q( a
/ q$ l& y3 E( v3 [- #include <linux/module.h>
; O, X. h. v: i) i. o/ e - #include <linux/init.h>
6 D* M$ W- r$ s2 A1 F - #include <linux/errno.h>. I, {2 Q6 y6 a) D$ ] P
- #include <linux/types.h>
2 G- j- n+ f- L$ w! B8 j1 Z - #include <linux/interrupt.h>1 U$ |2 N. V/ x* y9 N' W
- #include <asm/io.h>2 V! h3 J; v: P
- #include <linux/moduleparam.h>9 c# L! Z( x1 L. Z
- #include <linux/sysctl.h>
, g8 e6 W# [7 P" ?1 X. q - #include <linux/mm.h>
$ u: G4 k5 \0 J- n. j$ D, D" q - #include <linux/dma-mapping.h>1 }$ _) ]; {9 B. J0 M0 P
) l/ w+ u+ @7 q! r! o9 c5 c$ S- #include <mach/memory.h> P+ n% y v: h
- #include <mach/hardware.h>
- K& n( z$ A5 o4 t - #include <mach/irqs.h>
, a* w8 U+ u+ D) E- x2 K/ B - #include <asm/hardware/edma.h>" K7 c& [) t+ ~
0 r0 \4 r8 H% y1 L- #undef EDMA3_DEBUG
3 |9 w6 N* h! _1 u" e - /*#define EDMA3_DEBUG*/6 L7 @0 N. I. a5 F6 g8 R
- : s- T; f4 _& U' p# l
- #ifdef EDMA3_DEBUG3 u& G! N+ l& t3 J# q1 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 P4 l9 ]* R! H8 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( M7 S7 |" a/ l+ ^7 j! x: e& o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" p$ N9 Y. }1 |2 W, E - #else0 T, ], b/ Q0 l$ p+ L1 u
- #define DMA_PRINTK( x... )/ a; C+ [2 n; `0 Y0 x& ]
- #define DMA_FN_IN6 X) D! S1 Z$ @
- #define DMA_FN_OUT
) S9 G6 F& @7 P$ I5 L - #endif
0 J( h- E/ Y% \* S8 K - 4 e/ ?, W+ g5 T* D6 V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' B; n6 G5 N j - #define STATIC_SHIFT 32 Q4 W, E3 ?' z( t4 i
- #define TCINTEN_SHIFT 20
) K w1 u* u/ Q3 F* K; p5 V* v - #define ITCINTEN_SHIFT 21
/ _- p( D+ I# w" N - #define TCCHEN_SHIFT 22
' @. A! w. d. j6 o - #define ITCCHEN_SHIFT 233 J: |, s3 C2 N$ ^
7 ` S d9 Z6 G! }- e- static volatile int irqraised1 = 0;' w5 u, h( p$ g) N7 Y9 ^
- static volatile int irqraised2 = 0;
3 O4 L( d" j2 \ - & d' `- f( e+ s7 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 q+ L1 F- b* \1 T! ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l5 r1 N% l; I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, d5 `! ]% t. r3 \3 B& g - & W9 M# `! X n3 X! K* l) U$ H+ g
- dma_addr_t dmaphyssrc1 = 0;
8 T/ m# v% p6 @( T: [/ G - dma_addr_t dmaphyssrc2 = 0;
7 a; Q( T* b/ Y8 S4 ~; k - dma_addr_t dmaphysdest1 = 0;
, y4 l# e7 D' s - dma_addr_t dmaphysdest2 = 0;
$ [% B5 D) t; i% T9 d' G! E - , y: q* s( J( H# r) m0 |# i) y/ r( v
- char *dmabufsrc1 = NULL;1 `8 y2 A& ~- H! R* G, N" x
- char *dmabufsrc2 = NULL;, ]3 o9 U, p3 `' G/ t6 S N% ~
- char *dmabufdest1 = NULL;/ K8 U6 O6 N( }$ S) X
- char *dmabufdest2 = NULL;6 A* K: c( N+ l, v/ g
F% z' P9 Y, N% L G ?- static int acnt = 512;
& ^$ _# ?4 b1 V8 m) h* q) U - static int bcnt = 8;8 ~8 Y- a/ u/ k: h2 V
- static int ccnt = 8;7 E3 E+ D) C. j+ g6 z( B
% j$ g# _0 u5 T' z9 }% t$ V- module_param(acnt, int, S_IRUGO);% O; W# g C4 g0 Z4 P* u
- module_param(bcnt, int, S_IRUGO); Y3 h, b; D, }# Y( R; X/ Y
- module_param(ccnt, int, S_IRUGO);
复制代码
3 Q: u" C4 A' R, R9 u$ e3 }; j2 S$ n Z& K' q% d; A6 A% U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 S# x- |$ }& u7 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ W1 p- v$ g/ l4 _$ D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Z% G/ j" m1 U, N) f6 y! s0 R
3 [9 ?' R( Q! I2 b6 h' h
5 x: \( ^" n" P7 ]$ w6 c& r |
|