|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# J5 P! O: x& ^1 Y [( ~- [code]EDMA sample test application v* e- n5 |" M- |+ w, |6 H G @
- /*
# k" a& u0 F) N: B - * edma_test.c
1 q! |) P: @2 B! F- @ - */ P# s& F+ s) U' e* f+ r" t
- * brief EDMA3 Test Application8 k2 k. \7 h) L A! r( K
- *' r8 N4 E+ R0 r) Z$ f7 A b
- * This file contains EDMA3 Test code.
4 @, R3 S k! u, o - *
4 i! k) }/ d3 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* r8 _ k) |3 A" G- _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% |" U& S4 M) a' ^
- * TO CHANGE.; e9 `7 j3 W; x) {
- *
6 z8 d3 u) @1 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 |) P% k, j9 y+ S% H6 P
- *1 |9 b; d0 ~* G2 z8 i
- * This program is free software; you can redistribute it and/or$ A% A5 g+ [) n( T5 r+ z6 X
- * modify it under the terms of the GNU General Public License as
" l& }+ Y$ x+ x, m+ L - * published by the Free Software Foundation version 2.) }" {% x( D% \' \- r
- *
/ F, G/ Y" @# q5 q, w+ v9 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) w q3 B% l* b9 K& f6 o
- * kind, whether express or implied; without even the implied warranty. r( A; g5 J5 s- Z& D# ]: i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& S, E9 c9 Z1 @% A, H( z+ j - * GNU General Public License for more details.
! [4 [* m) s$ q3 t( \: P - */4 R! z" _. v7 M! _8 g$ f6 D" w" n
- ) E ^6 e. C1 G% G- ]
- #include <linux/module.h>
# V x, }5 X2 q - #include <linux/init.h>
. Z5 Z5 t# j# G. k4 o - #include <linux/errno.h>
- a) j5 y' x. Z& T - #include <linux/types.h>
, a% F2 B2 z% s& I8 _ - #include <linux/interrupt.h>
% l3 A- F. Z. p* ` c - #include <asm/io.h>" H0 `7 Y0 E( n
- #include <linux/moduleparam.h>: y: ]% U, B8 j/ z" T8 w- c* [+ q: \ g
- #include <linux/sysctl.h>
1 C: r1 m, _& d8 g& s+ ^$ k v - #include <linux/mm.h>
7 ]5 k" B# e% x: C9 ~( h9 Y/ { - #include <linux/dma-mapping.h>+ G5 q: d1 N! s, m J0 F+ o, @
3 M4 j9 {9 w+ ?' D# v- #include <mach/memory.h>) Q8 A$ i/ ^* ^8 ^0 K
- #include <mach/hardware.h>
v; A: f' W! Q4 X - #include <mach/irqs.h>
2 e$ Y' s3 n! P1 c. o - #include <asm/hardware/edma.h>
* U# S2 W* H7 S - " J5 _9 K; d1 h5 S+ v/ i
- #undef EDMA3_DEBUG
; f/ e9 Z( L! w% U# b1 ? - /*#define EDMA3_DEBUG*/0 ?1 ~, w* ~' H( ]2 w1 j! D8 n) y
- - ]3 g' l) N0 N, L/ ?
- #ifdef EDMA3_DEBUG
1 o/ T, Z* u" n- ?2 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ K1 S3 s: I( Q: U$ J0 Q5 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( |, s7 M% ?( @; H" o w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ~' p& `' M# N8 D. e0 {# k
- #else
5 e# j& ?! h% H6 |2 G - #define DMA_PRINTK( x... )
Y% m# F# y: d& H- N6 @) V/ J/ e - #define DMA_FN_IN
|, f; z, b: Y - #define DMA_FN_OUT
8 v5 Z; D$ ~5 H! n0 t6 i - #endif& j5 v, t7 k' g+ @
- ; Y7 t Z% q7 ~$ I) d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), _$ c: m; t* T8 D, {4 c9 S& d7 e
- #define STATIC_SHIFT 3
( G: `" \) N, V: n* q - #define TCINTEN_SHIFT 20
) p5 H, I( F/ w+ S! h - #define ITCINTEN_SHIFT 21
- t/ g, t2 P6 H - #define TCCHEN_SHIFT 22
$ O( h, q6 l! Y; c5 }2 A1 r' l$ W - #define ITCCHEN_SHIFT 23. C1 g2 f- {, B6 ^4 @: c
0 M2 A8 b/ D, w/ U5 T- static volatile int irqraised1 = 0;: A3 q+ e% [3 K- v6 B
- static volatile int irqraised2 = 0;
4 K f" y1 N) w% @' @& c) o - * `# B7 W2 s3 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* {/ j, z2 o' q! i# S6 d8 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T1 R, e% ^2 P: b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 t5 c0 i$ s+ n0 a
- 8 U) h' U( w' n2 n
- dma_addr_t dmaphyssrc1 = 0;
: ^4 D; h6 a$ {& \ - dma_addr_t dmaphyssrc2 = 0;" ]' b) y4 r) |) z' t! L% p
- dma_addr_t dmaphysdest1 = 0;
; z& o6 ]7 a) @7 l' Q) } - dma_addr_t dmaphysdest2 = 0;
: F M- r2 n- f/ ~ - 7 w7 G. {" z' Q* U+ J! T
- char *dmabufsrc1 = NULL;
; _4 ]1 W/ R( R( N - char *dmabufsrc2 = NULL;
& d( p# y8 q1 k' ` - char *dmabufdest1 = NULL;
( B% D+ P. H8 Y# p3 X1 h$ v5 d - char *dmabufdest2 = NULL;
' O$ |. W* n9 B$ ?- G; i( H' f - 1 Z- i% ?3 x* ?' n
- static int acnt = 512;
! `9 @' X, h0 R2 j. U4 K/ n - static int bcnt = 8;8 P' }& W( L1 B$ g/ n$ e
- static int ccnt = 8;4 s% h: X8 W; @" @1 i- o$ G
- 3 x; }, c: Y/ i! p( L
- module_param(acnt, int, S_IRUGO); a. @% \& i. }/ l( w+ P( u8 ?) {
- module_param(bcnt, int, S_IRUGO);
! r+ n$ E) G% m8 r" K - module_param(ccnt, int, S_IRUGO);
复制代码
; z W& z2 ?9 |0 T1 P1 v! g2 o0 ]: q( x1 b6 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ]5 O; r& V+ Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
I' J& X" }0 Q9 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 j; ]/ Z o J! e) D/ J- z+ a0 m% P: S
+ V/ \0 G8 e- c. p! S* F5 k |
|