|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
} Q9 X6 h1 r1 J4 F7 [- [code]EDMA sample test application0 H, n$ O6 G, U$ Z
- /*
; ]6 ]5 J4 N/ [" x$ L - * edma_test.c5 i1 Q* }- p( `4 N# I
- *, A6 ~9 k. m6 m
- * brief EDMA3 Test Application; i7 g4 J* {6 r- w
- *! m4 S7 A2 O* p0 }/ Y
- * This file contains EDMA3 Test code.: Z: [# ~/ i1 m6 Y' A+ q
- *! X% j/ q, T& y7 A5 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 p8 h. m0 D+ h3 j6 U5 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ^% S2 D7 q) Z4 u" l7 l7 h% D - * TO CHANGE.
6 U8 t0 \7 k- | - */ y4 t% u, V$ p# a# e, A* F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 |, O% @; z6 \) M! h% S1 O
- *5 J2 ]& h; }+ |! l1 G: V
- * This program is free software; you can redistribute it and/or
+ {4 c2 f$ E3 m/ L' { - * modify it under the terms of the GNU General Public License as2 j' x* h( X. e9 p9 s% l
- * published by the Free Software Foundation version 2.3 s# i: _! L% o8 n: r, G
- *
8 i* ?2 k3 r* w6 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 B! K, k8 k; h: Z - * kind, whether express or implied; without even the implied warranty
7 c7 e8 I+ f$ F( |" M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" r( v% x1 H( S' \ - * GNU General Public License for more details.
6 n1 [" W) b6 S9 [. X0 x: d - */: }+ w- N+ _0 D2 I
- 9 v3 z8 c' I0 u# q
- #include <linux/module.h>, c& U9 b: Y/ H' ~( x* C) Z( r/ @
- #include <linux/init.h>
, j9 O3 i# m( N, l - #include <linux/errno.h>
4 Y8 p ?4 s, r) V1 j9 }* O - #include <linux/types.h>5 j5 ?0 c& n7 D5 }) i; b
- #include <linux/interrupt.h>/ r. ^: D* ^+ C. t6 L" I
- #include <asm/io.h>/ T6 ^0 J' p' R4 {0 S
- #include <linux/moduleparam.h>
5 {, m" i- H- E" d$ R% Q - #include <linux/sysctl.h>
2 z1 }7 g' h4 K' X - #include <linux/mm.h>
( v+ a7 y. c2 Y0 g3 l - #include <linux/dma-mapping.h>
) J( S& ^& U! l0 s- M; h
7 S+ ]1 u, p$ \8 A& w- #include <mach/memory.h>
& D0 l$ A, Y) t+ Y/ `+ ?/ U - #include <mach/hardware.h>
- E% i/ q9 j5 U2 s2 M" Q9 f - #include <mach/irqs.h># P6 I. g' E5 H; N5 W- v
- #include <asm/hardware/edma.h>5 _% d% T* A" ]; b4 }
5 r. l. A3 X S! F/ ]0 X- #undef EDMA3_DEBUG' ?# D+ @8 J- k5 ^8 I, H
- /*#define EDMA3_DEBUG*/# o; X4 B( H/ _& c2 a; H; J: l
* D% h* u. S9 F- #ifdef EDMA3_DEBUG) [6 {4 f3 k. U5 B) v! E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) M/ w! k( m' S# |- C5 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 k! E! g' E8 z" T! z k9 V: U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* H6 B0 _. `0 P: k" a' _2 u4 B, c D* {( k
- #else( [8 H6 ^) o c
- #define DMA_PRINTK( x... )( _* w3 G! i" e1 X
- #define DMA_FN_IN0 C, [7 E' ~! s
- #define DMA_FN_OUT3 d8 \, @2 p# s8 H$ _ s# A
- #endif# k# q/ g p. @
* d" l/ m/ e$ o( v9 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 Y: z/ N5 B1 F3 q
- #define STATIC_SHIFT 3
1 F# V/ C' y5 \: ]* I9 A - #define TCINTEN_SHIFT 20' H! M+ k2 \& y% B7 x
- #define ITCINTEN_SHIFT 21
3 `6 V! s) `3 a' p4 d8 P: L* _/ |2 C - #define TCCHEN_SHIFT 22* j# i) N- ~3 L6 P4 |) ]# I
- #define ITCCHEN_SHIFT 23% g2 R$ T( Z5 d9 z6 _5 H
- / h0 E( k* R1 J7 _0 h* L
- static volatile int irqraised1 = 0;
% ?3 N) X1 A9 J& g) N& I+ |1 g - static volatile int irqraised2 = 0;# V# m& j1 K1 x; w) e3 w
- 5 t# y; x6 L" S/ B5 @! L, z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 B1 T- O: Q/ {, L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z K6 v/ o+ u3 b+ T: a5 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' C- o7 f3 V3 G) e8 S5 ?2 Q
- 9 |% l: V/ u& J1 b" ^, r" f/ U# R: h* ~
- dma_addr_t dmaphyssrc1 = 0;
% Y0 M5 T* M0 X+ ?" L. T0 R3 K - dma_addr_t dmaphyssrc2 = 0;( b* w; r/ |. P' E# i5 i
- dma_addr_t dmaphysdest1 = 0;' M2 E% {! T/ Y# ^, {6 _
- dma_addr_t dmaphysdest2 = 0;, }& }" T d) D/ r# H( @
) L. l# M3 ] B" t% n9 @- char *dmabufsrc1 = NULL;: x- J: C5 @- Z* K5 @3 h; w4 \
- char *dmabufsrc2 = NULL;8 r- l( T0 w' `; t& G: f
- char *dmabufdest1 = NULL;
* @7 [! q) x* V9 @0 I7 l9 [. T - char *dmabufdest2 = NULL;
+ E; }! I, ^- }) X4 B5 _. e
( s( [ F. D" F/ i3 Y3 c" a- static int acnt = 512; Y# r+ E9 R1 N; W7 ^
- static int bcnt = 8;
2 q- d, R& a& r4 I8 g) ?: T - static int ccnt = 8;0 L, r' E/ o+ G6 E
- ! r5 d. L, c8 g9 l& C9 p' S+ p" B! U
- module_param(acnt, int, S_IRUGO);
3 A* ?5 J7 e2 \9 q3 Z! {& q - module_param(bcnt, int, S_IRUGO);& k8 A7 x9 }/ N9 N/ j
- module_param(ccnt, int, S_IRUGO);
复制代码
{4 z+ [$ \. P, r3 S% o: E
, H* n" w' X) ^3 A' |6 S: [4 A6 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' c5 ?6 l. Z1 h _* q- ^& P# |+ e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 J, ?% z5 Y5 Q( J1 x X& j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 q C# t# r3 K9 i
% l0 Q. B$ V" Y! N9 o2 a" m$ E: i5 p- K( `/ b
|
|