|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 C! u& c _; F; T( V- [code]EDMA sample test application: ~: T, f m7 Q& X4 N Y
- /*
- b7 {1 P. `8 `9 `" w0 H% v8 D4 ~( U - * edma_test.c
# A: r( a4 \- e" L/ L - *
: s- M* _" c% d3 ~4 Y - * brief EDMA3 Test Application
# |+ J7 y: P; [0 b - *: H3 |" t9 |) y& K! m) v
- * This file contains EDMA3 Test code.
8 H/ V2 O1 k) U* y+ q j) I/ i3 \ - *
4 E {* T- i" k( `; ~ h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* N# |7 }0 i* ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ g* i$ w! E# x4 Z - * TO CHANGE.
/ M8 L5 I" ~$ e - *9 K% ~6 h: Z9 m- t) }+ {) P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, k8 _8 F5 I3 ^" ^9 j: P - *
) |4 j) O$ U ]. Z1 Q) @ - * This program is free software; you can redistribute it and/or
* [2 z7 n* x4 z5 F - * modify it under the terms of the GNU General Public License as
! _- U% {# c# g6 T2 y4 u' c( B4 m# |5 ~ - * published by the Free Software Foundation version 2.- E/ f$ h( Z. _: A% N }: j( j2 x4 a0 h
- *( n& r! h; z ?" `, a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ @$ [0 R& v Q1 Y' _% L! l2 y' b
- * kind, whether express or implied; without even the implied warranty
- I6 i! j0 N8 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 }! d) s1 V l8 t& h1 ~# D# E& {: F - * GNU General Public License for more details.
- ?5 m* F' _4 F z5 k$ {8 v$ S! ? - */
; g& B5 U+ d# _- A - . L1 r [+ ?" p% A6 s7 ]- i
- #include <linux/module.h>
m' b A+ s2 t6 i3 ]8 J' P - #include <linux/init.h>
7 @, W" m, }/ _ - #include <linux/errno.h>1 f# e& |+ i% O+ F3 J4 \) E8 o! w9 R
- #include <linux/types.h>
* q) D/ c. m5 a' S" v- w2 r - #include <linux/interrupt.h>
/ w; l; ~2 _$ F7 L& @ - #include <asm/io.h>2 G$ F4 N& t; r3 D, l% y5 B
- #include <linux/moduleparam.h>
. N0 b. A6 N' I5 Y( q' A3 Z - #include <linux/sysctl.h>
* d" l$ K3 X( P9 g2 ~- i) J+ m - #include <linux/mm.h>
: K/ Z% `# D) V" b6 ]4 I$ ^ - #include <linux/dma-mapping.h>5 E( i+ t) R2 E: l Y( g A4 w
( h( ^/ ~1 ^0 h. t" d2 a- i* g- #include <mach/memory.h>0 `0 W; E4 I1 d
- #include <mach/hardware.h>
) w P1 R2 v! ]4 B/ t - #include <mach/irqs.h>3 C1 T6 r/ S. E3 d _3 }: m
- #include <asm/hardware/edma.h>( ~ x+ a* y+ O
+ `& c% u' E: o" }" n- #undef EDMA3_DEBUG
0 Y1 e% A( V1 Q) i$ Q" e0 z - /*#define EDMA3_DEBUG*/3 y J; n2 H( u
- . _3 r/ w; u3 \8 U, ~
- #ifdef EDMA3_DEBUG
, m# C' h4 k$ J3 E9 a3 f: [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 [* T+ g* p& Q! S- _3 @6 m# B. K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), z* G. `) [" T0 G! E P3 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 v& M; B1 s8 Z3 X
- #else2 A7 n; {/ K4 ~
- #define DMA_PRINTK( x... )$ P" E9 r0 t6 A6 z2 Q6 J% g
- #define DMA_FN_IN1 J& X" K9 E4 B" x7 J
- #define DMA_FN_OUT
: V0 v7 p2 e* ]7 I! \) @ - #endif
$ A. z) C3 s6 i1 f% L - + w) t5 U6 a4 ^( X6 M) J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* ]. A& z$ [4 v ^ - #define STATIC_SHIFT 3
k! |9 x) N+ ~ k - #define TCINTEN_SHIFT 20
& I$ P& m) D& f$ \+ K3 x) |2 A - #define ITCINTEN_SHIFT 21! c7 k, F* r: L9 `" M, i* O2 F- D
- #define TCCHEN_SHIFT 22
, F# {" s7 K' |5 a/ g, U8 V4 \& S. b4 y - #define ITCCHEN_SHIFT 232 B" \3 J: ]; Y. B- L: L, `
- 0 l/ l4 N6 G) ~3 K5 f4 l0 q
- static volatile int irqraised1 = 0;
5 |$ `' w8 T o* T1 ?. x2 u" o - static volatile int irqraised2 = 0;
) p. I9 ~' ?3 {% k
! f/ q9 ?3 s. p9 p. f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 v) a+ M) O( ?0 I h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D3 O3 U6 S# f7 n1 d7 C4 ~- Z5 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V2 v% z3 c8 R# q. P3 |
# `0 }" O! y5 K, v- dma_addr_t dmaphyssrc1 = 0;
) P! g7 N1 \* u+ w$ `/ L - dma_addr_t dmaphyssrc2 = 0;
* b! [7 F$ L5 P3 L! y. f - dma_addr_t dmaphysdest1 = 0;
# j( T$ n% Z! K. w q3 p - dma_addr_t dmaphysdest2 = 0;. p/ @0 R6 @9 _+ c
- ! L0 X) @0 H& E2 y
- char *dmabufsrc1 = NULL;: l- g3 b6 Y' \$ b, W) `6 ~! t
- char *dmabufsrc2 = NULL;& _& u$ i! G; V0 L% R0 K4 }
- char *dmabufdest1 = NULL;8 z' E* M9 r" e/ x6 o
- char *dmabufdest2 = NULL;$ ` X& M8 A, d5 d" a8 q
; K9 S' S7 y D' u8 P- static int acnt = 512;
% F& K( \9 \0 j: `4 J4 S - static int bcnt = 8; i) l% D$ h+ D" u
- static int ccnt = 8;+ q8 X) E' U0 C5 |6 d, @3 e
; m- H0 v; g$ X8 p- module_param(acnt, int, S_IRUGO);
3 I! t( o4 ~( r" ^3 w$ \; r - module_param(bcnt, int, S_IRUGO);
" U% c. m7 T) @& t( p - module_param(ccnt, int, S_IRUGO);
复制代码 7 \* I0 ?+ R: M! o; T* C; u5 ]( r
( r3 J' R" p+ V8 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 i, w O; o: j1 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Z6 h" h. ^7 A9 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. U- ~0 W* b' z" M. `% ]( g) f, j8 P2 t1 {; z2 @7 `
; i4 f& k7 Z$ H3 V5 s
|
|