|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# O E# P+ u- M( p) n9 n- [code]EDMA sample test application/ V& h: W$ T( v6 J
- /*
# f5 m( h. ~( [: z. _: w7 ] - * edma_test.c# a8 u$ W A+ m# }8 i$ X7 C5 i
- *
* b8 k7 G8 L/ t+ b. F - * brief EDMA3 Test Application( C' S, Z+ }/ q2 V% H. C5 ]8 B( c
- *# u# m) W9 _% z. U. p+ W2 |! K
- * This file contains EDMA3 Test code.; m/ u0 z: l# |0 w3 u; K$ H) g, n5 I
- *6 ?/ o* I* }6 k) \" w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" Y0 I* X$ }$ k; o9 L$ k1 L1 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, g' O7 H% g$ ?7 c6 V - * TO CHANGE.
3 Q# @, A( b* p4 n, j$ k7 e - *: a% Q7 I# |# ^' f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ K% u. S/ Y9 t
- *$ B6 q$ ?. K+ V7 Y4 b
- * This program is free software; you can redistribute it and/or
2 B. I" z; L+ G a, G - * modify it under the terms of the GNU General Public License as
% {. N* C3 Q3 t+ V: Q - * published by the Free Software Foundation version 2.
" E& x' ]" ^9 X2 u8 m - *& O% |) S! S- e" D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any ?1 a1 U K' s2 B- b6 S* L3 |
- * kind, whether express or implied; without even the implied warranty
4 ~. j8 L5 g# t, G3 v& }: x# [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
E1 U a! O. I/ p! l8 m - * GNU General Public License for more details.
6 h" o4 r% o9 h+ X" ?) |+ B - */
1 s" P) U7 P. r8 f# c& \, I* a - ; W4 G& y' f6 Z9 E# w) K- q. {
- #include <linux/module.h>/ u8 t) |' t2 c" k
- #include <linux/init.h>
( K* q8 }# C# s1 b* w8 c5 w. U - #include <linux/errno.h>
$ c- X, i* a# J2 {& I4 L - #include <linux/types.h>6 Q4 e3 Q1 p8 u
- #include <linux/interrupt.h>
- B# e" L* i2 R6 o6 a - #include <asm/io.h>( u+ _' ]& {- q; W! p7 P. H
- #include <linux/moduleparam.h>6 G u8 N( U0 }0 r
- #include <linux/sysctl.h>
! v4 u) n8 L1 y6 N* h - #include <linux/mm.h>1 X5 K( R) @3 h0 C1 r, w/ q
- #include <linux/dma-mapping.h>: z, p. t. R- l2 ?
. u7 q& S& n |; c- #include <mach/memory.h>
+ \: p3 h* N4 f1 { - #include <mach/hardware.h>
, Q( s2 d' n6 p - #include <mach/irqs.h>
1 W9 z. C; ^- x: S% [$ k$ j0 B/ g - #include <asm/hardware/edma.h>
9 f% y# x1 W1 Q! Z - ; I9 P/ p2 s4 A6 ~6 U' H, c0 r
- #undef EDMA3_DEBUG/ `7 @& g7 y6 U7 h' R
- /*#define EDMA3_DEBUG*/
4 S& E9 C' ^( K& Z/ C6 } - ; x4 Z1 ?3 H9 z* y: y* e; z
- #ifdef EDMA3_DEBUG3 F, A7 {# f9 d5 k y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), q5 G/ V+ J: C- E) V. r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M, \6 ]9 Q6 i4 \$ G7 U( M* A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. w$ Y# u4 }4 I% _ - #else
& S7 F4 }3 z' C5 N' R5 r - #define DMA_PRINTK( x... )
$ x8 G* s9 y* g8 B - #define DMA_FN_IN
0 y0 \0 O: ^" c! M/ [7 q - #define DMA_FN_OUT, B# T7 U4 E$ u/ i1 [% K& U* f& c
- #endif- w/ S) p; N: E8 }, B, Y1 b
- 4 Z8 W7 d+ O3 Z; }7 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- x3 V2 f" g! G1 L; g7 W
- #define STATIC_SHIFT 3, u* Y3 ]6 Y" a! B( V
- #define TCINTEN_SHIFT 20
2 w* q _+ T! p- ]. y5 w - #define ITCINTEN_SHIFT 21. @ u4 K' C% [' S6 @
- #define TCCHEN_SHIFT 222 f0 b; ?# Z7 S y* R
- #define ITCCHEN_SHIFT 23
0 f0 ^6 N6 W/ |4 j$ K8 r
! J; T% e" k6 T! j- static volatile int irqraised1 = 0;
) X0 B- S) Z# M, q& Q9 j# K) h - static volatile int irqraised2 = 0;
& P2 Q4 l4 M" P2 \9 S/ w3 H
+ b1 f4 ~9 |+ N5 N7 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 F" I6 {* J. E1 ~# {8 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T2 N) J/ R" h, J4 ^1 r7 O* G: ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( d+ J1 `* ~0 c u' i2 _
2 o' }. i5 E2 b( \- dma_addr_t dmaphyssrc1 = 0;
4 {7 j" p$ I C( j* z - dma_addr_t dmaphyssrc2 = 0;
, Z% E7 t' B& C) G; T8 r - dma_addr_t dmaphysdest1 = 0;' s7 ]3 P9 n3 G% s" ]
- dma_addr_t dmaphysdest2 = 0;
7 \' W, A5 q/ L9 S4 X* E/ j
% P- N6 f% p3 q ~/ ?( E1 K- char *dmabufsrc1 = NULL;1 v4 z: O9 M) b! C0 f
- char *dmabufsrc2 = NULL;, G2 O% e/ s1 W' ?
- char *dmabufdest1 = NULL;; F- Q3 X6 ?" q! t
- char *dmabufdest2 = NULL;
# z" M! }& n8 d3 k
9 W" g+ x+ D' R9 Y2 @- static int acnt = 512;
( K6 Z7 @4 V; v- R - static int bcnt = 8;
% H7 r4 x: |) l( p0 s0 p - static int ccnt = 8;7 \7 Y8 N$ m3 B u
# G% y$ o. K7 d0 w: q- module_param(acnt, int, S_IRUGO);
* f7 L8 W$ C/ e: J" ?8 } - module_param(bcnt, int, S_IRUGO);
6 f0 g* }" _" T9 T8 }' y' G9 ] - module_param(ccnt, int, S_IRUGO);
复制代码
7 s) L: `) z" t8 ^; K6 F3 M) d* d$ h3 E/ U; f0 z9 A; d+ Q2 y4 \, A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 s, |. E U: ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x: N2 G; B" k/ s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 u/ ?) Q8 ~2 ^
! n5 q$ X) |9 b8 Y$ H
6 M) [' n/ x8 h" S$ O# }1 |# {3 t |
|