|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ d) i3 U! E+ |: S8 i& I" E; S- [code]EDMA sample test application! Q3 p# x6 w* i
- /*
1 [% A. o* [) b+ O6 m, _& z' P& B - * edma_test.c: {) W4 r$ x4 U- b4 p- s Y
- *
. g. c$ U9 D4 D' d- ^ - * brief EDMA3 Test Application+ `9 B' v( _9 H' f- c
- *
$ i3 I5 m5 y6 x3 Q# n- J - * This file contains EDMA3 Test code.
% r- O; r' R& H* q @$ F8 R - *
/ }0 c: k3 r# `' Q: | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 v! P [7 }6 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, [: w4 ]2 E5 r& [& l, f - * TO CHANGE.# T* u- t* | f* g: ]2 W
- *8 [6 t/ C" A: p# ]4 ]! o w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 D$ m) X) Y% C& M4 Q! u" g. ~$ K - *
4 d1 |) h0 F$ r# D0 e6 U - * This program is free software; you can redistribute it and/or5 w! K+ V1 t8 L5 x9 F, E
- * modify it under the terms of the GNU General Public License as
% B* L: L3 n! P& ~+ m' b - * published by the Free Software Foundation version 2.
7 V+ h5 _1 Q4 F& T2 b, _ - *
! k! e4 A. }- \ w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any g% V; \ P8 D
- * kind, whether express or implied; without even the implied warranty' l* G' V9 B7 n' ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 L2 N. w1 n; h7 C" f# ~ t, g
- * GNU General Public License for more details.
* |5 X, Z1 _4 n, b# g) Q4 y. _ - */! ?1 i/ p& L5 X- Y9 J# o
" W/ K K. M! x& [2 {- #include <linux/module.h> i$ J1 o: a# a# k) \
- #include <linux/init.h>
' ?7 u' k1 f) ]' r* `) f- ? - #include <linux/errno.h>, d& y7 a4 K8 i4 v- v* b" e
- #include <linux/types.h>. O- `( w0 o. D0 a
- #include <linux/interrupt.h>
, ]" |3 s# X' h7 O8 g: J* Q - #include <asm/io.h>
5 g6 D0 `" E, s% I7 \ - #include <linux/moduleparam.h>5 a6 q$ O" \. B, I; ]. J
- #include <linux/sysctl.h>+ W7 v5 y5 j2 w. C" e1 {( }
- #include <linux/mm.h>
, b. a1 q$ V- [( {$ D" p+ O! z - #include <linux/dma-mapping.h>4 k7 m: g' O! L1 d
- ; }8 ?9 E' \3 \" j: v1 h: L
- #include <mach/memory.h>
4 H" J! x/ @( t1 U# S - #include <mach/hardware.h>
5 }8 r4 ^3 {3 x - #include <mach/irqs.h>
0 r' E8 c9 F3 H b - #include <asm/hardware/edma.h>
" W4 E( A3 l6 G# a) a7 c
& j0 G$ M/ D& l- K- #undef EDMA3_DEBUG
1 x: {3 H" b6 K - /*#define EDMA3_DEBUG*/2 h0 q' B1 p S0 l
# P& j, e1 J6 y; I _$ K' m7 C! M- #ifdef EDMA3_DEBUG
/ F% \" E3 \' K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! _1 m- ?; D3 B N; e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 {6 @4 @, _& e. E1 Q/ ~; y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 i6 P4 H; r$ M* B. R6 N - #else
0 m/ A0 c, @% t. t# z! q - #define DMA_PRINTK( x... )$ O! e" _# R( C' b+ ?5 t( i
- #define DMA_FN_IN
2 k E. Y B7 G7 g' v - #define DMA_FN_OUT2 ~6 h0 J0 F, s' `+ n
- #endif$ ?" B" d0 Q/ m+ _1 q; |
- , S4 w" X! N0 S+ q" i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( J+ ^2 u6 b: l k5 V$ {- z
- #define STATIC_SHIFT 3% |( F6 N5 P$ p8 n( V' G
- #define TCINTEN_SHIFT 20; Q9 R( ]- L: V4 J& M7 }: P
- #define ITCINTEN_SHIFT 21
: r, E* V- t7 @" `4 o, ]7 k - #define TCCHEN_SHIFT 227 E" v, Q8 ?( A
- #define ITCCHEN_SHIFT 234 O' H7 I& @ n8 n; f
- , F8 r/ w+ d. s A5 d! _
- static volatile int irqraised1 = 0;
5 `3 F3 }& S# D4 O2 `: j - static volatile int irqraised2 = 0;/ X' d6 ]$ @& P! I% p& g
- # N- n4 H p( ]9 y5 p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C5 m% l. G" N L* |( [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ n) |2 Q3 S1 t+ ]; A9 w1 B3 A1 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) n8 e. }. d' m5 v3 v9 g: J8 {
' O. E4 i: ^ w: h3 Y- v- dma_addr_t dmaphyssrc1 = 0;
7 D' n& s, V1 \: } - dma_addr_t dmaphyssrc2 = 0;
5 D$ R$ u" Z8 A+ a. U J - dma_addr_t dmaphysdest1 = 0;8 |( N/ d2 Y n3 _1 x( D* r
- dma_addr_t dmaphysdest2 = 0;
+ J: y1 J4 f9 k! K: ?: \
; e: g7 q( x+ l' I7 l- char *dmabufsrc1 = NULL;
! }" S/ H9 R {& M - char *dmabufsrc2 = NULL;- {) M8 l9 h' O# d- J0 x: i
- char *dmabufdest1 = NULL;
& O0 m9 Q. F6 r* {& I/ p( L - char *dmabufdest2 = NULL;
! n! ?3 `. u4 F- P: Z. q3 b8 A
/ A7 T! x2 R" q2 o6 x- static int acnt = 512;
8 }3 [; h, c1 |: o/ G - static int bcnt = 8;
; S# N' J! c# d3 {: J - static int ccnt = 8;, ]/ w3 T9 V/ `" |* A
- % o- q1 e5 _4 U. K
- module_param(acnt, int, S_IRUGO);! K0 i; s2 J O5 Q) c3 L2 @% T1 Z
- module_param(bcnt, int, S_IRUGO);+ g& b' _: }0 j, }7 W
- module_param(ccnt, int, S_IRUGO);
复制代码 ' A2 q. O% C! v7 f! ^
& c A6 v1 Z0 q% n/ a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 s4 V/ k5 l/ _( w" }" F& ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 {& Y$ `' K0 R* O5 S& z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 j) r6 W6 B% N
/ N$ z% f+ c' Y2 M4 H1 d* d; [) g( g* J" r0 n0 P+ N
|
|