|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! e' e* I6 X- N# R# O9 I5 n H4 S- [code]EDMA sample test application
- ?& ~: |+ `0 c: R - /*$ S& ?7 ]0 c: X7 x& E
- * edma_test.c
) h# u$ `7 X `! n% K' N: w; L - *9 j U6 _5 F% P8 j* D
- * brief EDMA3 Test Application+ U# g$ j# R# @$ o& Y
- *( X9 ?( y& Y, ?, e& }6 G; \
- * This file contains EDMA3 Test code.
" _. G* o; I @( I - *
Y2 U; {( r. e6 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 q& E7 w: l% z# i5 A0 @3 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; c; x2 f0 B& w; b9 l; c - * TO CHANGE.
, O" s! a2 E6 F/ r$ d; @ - *
9 p8 f) Q- ^8 ` Q1 ]' u, u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* M( i, i4 o1 d
- *
% Y! z# d: }& ~+ k - * This program is free software; you can redistribute it and/or
& j4 U7 ?2 K" N$ Q- t - * modify it under the terms of the GNU General Public License as& Q4 w4 B& `8 s% G a1 X7 @
- * published by the Free Software Foundation version 2.
) `0 y# c7 N7 ]$ K% U2 V; ] - *
5 r; V! u# |* V k; ^0 l7 P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Z; B3 u0 `3 m$ U: a5 Z9 x
- * kind, whether express or implied; without even the implied warranty! ~) W; t; ~+ K# C) b" x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 h) g0 n9 Y) O- T$ W
- * GNU General Public License for more details.
/ b" p0 Z \) E - */
2 x, t5 m( w! ~, `4 C6 z - ; Y5 \0 t0 c8 m
- #include <linux/module.h>
3 w0 A( y2 w+ ^( e) m - #include <linux/init.h> [3 s5 P; F! E' H
- #include <linux/errno.h>
% S& M6 J4 ]6 ~& A - #include <linux/types.h>
" n1 `+ i4 z& H - #include <linux/interrupt.h>
% S6 V' n, a" _; l - #include <asm/io.h>
/ v$ |3 J4 A& ? - #include <linux/moduleparam.h>* m& y. i, a; [, Z4 k+ S) [: W
- #include <linux/sysctl.h>& S$ L0 _ e, |1 p5 r8 [
- #include <linux/mm.h>) x/ R$ G4 F. q9 u" ?0 }' W9 h
- #include <linux/dma-mapping.h>; r9 ~7 X; C" R) c" Q/ A7 Y
3 W [ I T( M- V" x- #include <mach/memory.h>
7 r/ {7 N& s% P$ ^/ b0 Q8 ~5 _ - #include <mach/hardware.h>$ @' x; F+ G3 V, {4 L
- #include <mach/irqs.h>
( T" u0 c$ H+ S1 _0 b - #include <asm/hardware/edma.h>
4 K; O Q! v+ F- _5 e: W- V
% J c! k8 U, J% E3 A" Q) W- #undef EDMA3_DEBUG
( T: H: j1 ?% ^4 W9 x4 w - /*#define EDMA3_DEBUG*/8 M# ~" z4 w( {% c
- 0 j3 Q* L4 }2 c) O
- #ifdef EDMA3_DEBUG
0 h' x" ~0 L7 b: w" \! | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ ]# Q' L2 B5 ` ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 _! \8 f( I! ?! k' r- P, b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* T' c0 b- H, ~9 V
- #else
$ B. T# V; @: {+ f - #define DMA_PRINTK( x... )* e1 U8 q/ u/ e+ n. p& U5 M
- #define DMA_FN_IN
1 b( Q% c) j$ i! c - #define DMA_FN_OUT. [: S" [! n% C* I
- #endif
9 f. k- { r% K' ] S1 L8 v
, p$ {- x' U6 d* \8 ^" Y. _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! l4 G9 M3 ~% G7 v% [
- #define STATIC_SHIFT 3
0 c( g6 H, i" m2 A - #define TCINTEN_SHIFT 20* z5 ~$ t8 A$ O/ `
- #define ITCINTEN_SHIFT 218 O% x7 U: c5 v" F$ M1 ^6 W0 n
- #define TCCHEN_SHIFT 22/ T& _# I- |9 \) c# r+ d) c
- #define ITCCHEN_SHIFT 23; F8 i+ ? Q1 S1 p9 j, X. |2 F
3 V0 N& g* D ]1 d( c- static volatile int irqraised1 = 0;6 h0 V( m) X- k/ J
- static volatile int irqraised2 = 0;+ t$ P K% d3 v m
- 4 b- K/ v Z8 _ z+ E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ` n0 A8 r8 `3 s6 E/ @/ T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \( `( W& V& v/ Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% |/ Y4 L9 [3 p2 ?, T! A - ! o, m& F h" \5 ~, z; w. o
- dma_addr_t dmaphyssrc1 = 0;" i7 X5 j! i* G) t% }6 M4 G
- dma_addr_t dmaphyssrc2 = 0;. I5 ~* b. U0 ^
- dma_addr_t dmaphysdest1 = 0;4 D( D4 m" A2 N7 p! R! y
- dma_addr_t dmaphysdest2 = 0;- C7 ?- [7 y1 s4 F1 z
! r: s* \" K% K4 e. g- char *dmabufsrc1 = NULL;
( [: E+ h6 z( e) M7 R- f7 h - char *dmabufsrc2 = NULL; v1 p% p3 p0 c+ p8 v$ N
- char *dmabufdest1 = NULL;. a; Y& |9 s! I, ~6 t
- char *dmabufdest2 = NULL; `$ s: D3 R, T$ `
- ; i' T0 w6 n1 ^; y5 w0 B9 D/ s
- static int acnt = 512;! t# D. {2 P5 J* j3 e
- static int bcnt = 8;
/ J7 F& T% `2 l( h, z! u - static int ccnt = 8;. P5 T+ n: c# f( a
- # A1 R5 n! l5 @. x
- module_param(acnt, int, S_IRUGO);
/ @+ ~3 K0 p# H+ \# i5 ~ - module_param(bcnt, int, S_IRUGO);: }/ `* t: K. Z. X) q
- module_param(ccnt, int, S_IRUGO);
复制代码 " H, Y4 m; m5 ~
/ F* T) h8 z4 K6 { N, R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* B3 k( w1 D5 o h. f7 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 T i5 y a$ D% R2 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 K. x( X6 ~* ]! `8 J- |, P2 R" |4 h8 j0 e
2 z2 Y, ~) f( |7 _5 O |
|