|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! U5 R2 g3 G/ m. O- [code]EDMA sample test application
# a$ E. v, w. Z7 \- i' P3 y" D8 [ - /*1 i& a3 l: J% u4 @0 N
- * edma_test.c
2 O/ z2 ?/ s7 I2 m+ ~ - *
0 `4 T, l. y/ N/ {4 B; l. T - * brief EDMA3 Test Application( j/ i; s, ~7 w, d0 v
- *
6 G- Z" a* N8 D5 L9 _+ |4 A - * This file contains EDMA3 Test code.
! p! d& l% V3 N/ d! Z' w# Q' A9 { - *
! f# K) m, t7 v) K+ t( V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) U1 z0 ~* X% z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. V, o/ ^& G( _/ U5 d
- * TO CHANGE.
4 P+ \4 ?* w1 }6 \" f - *9 x# b& Y$ R" |8 `3 @, `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! W0 s; `3 ~$ B% N& U3 s - *' ?* E# ^; E$ x) n0 F1 Q
- * This program is free software; you can redistribute it and/or1 y4 p( d5 g v- l- c
- * modify it under the terms of the GNU General Public License as9 J: o$ l! H) U2 G# N# W
- * published by the Free Software Foundation version 2.
3 v; y* T+ ~+ H. o8 s+ ?) h - *
! D T5 r3 ]6 ?/ _& v) L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! N# J f D3 H! w - * kind, whether express or implied; without even the implied warranty
6 E7 m& C- F# f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) X2 [) G9 U& F( z
- * GNU General Public License for more details.7 z3 s9 }- [- ]" l( J* }' e/ z
- */
2 t- W. b1 C, l8 C/ v/ V8 `
2 m8 W% E8 {4 e5 b7 V& G- #include <linux/module.h>) Q) L7 N% ?8 w0 E
- #include <linux/init.h>! P4 J+ j- u+ n }
- #include <linux/errno.h>
0 k! U! D( F+ f# v! r( E - #include <linux/types.h># J6 D7 |3 ]& s6 B9 Y
- #include <linux/interrupt.h>
; w; G. G+ C1 e3 i3 u - #include <asm/io.h># _; H" Y6 Z# \9 G* Y
- #include <linux/moduleparam.h>& |! s4 N! r, t1 q# H# Z
- #include <linux/sysctl.h>
/ Z9 I4 p$ v) T+ U - #include <linux/mm.h>/ W& D2 z$ w( m1 U+ {: x
- #include <linux/dma-mapping.h>
p) ?* M7 Y, D) @+ k
% [2 Z/ j0 W& f# E/ @2 N- #include <mach/memory.h>0 S$ `; K( |7 u; S
- #include <mach/hardware.h>
4 }8 R4 ?1 \5 m5 M- p4 M - #include <mach/irqs.h>
- ?( \! M$ F1 |: q, j) ] - #include <asm/hardware/edma.h>
6 [3 U+ N% B( w1 F% ^0 m - 8 u3 I* w) q a6 B" m
- #undef EDMA3_DEBUG
( t( T; q- |( d/ J( [3 u - /*#define EDMA3_DEBUG*/
; F/ \& ? ~! r+ N/ }# G - ; A& T0 N* X/ }2 W
- #ifdef EDMA3_DEBUG
% j/ k9 u/ r% L# t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& m' Q/ X7 D; i* [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# V% P/ p. t; ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! I( h% s+ B0 w. [3 s. L' F! I+ F
- #else
* X9 J- u/ b2 h1 Y2 g: ^7 [ - #define DMA_PRINTK( x... )1 u4 l3 ?8 l, G8 M4 W1 P1 ^
- #define DMA_FN_IN2 C6 C% C) r) b
- #define DMA_FN_OUT2 U# k* x5 Q' x' f
- #endif& r; K: p. s2 q# V: j1 m; \. o, x& Y
8 \& `$ x2 g1 ?6 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( r1 V1 C- C$ r& n. h5 F- C; y - #define STATIC_SHIFT 3
, l; F8 W. H: v- J" q4 i1 B6 T - #define TCINTEN_SHIFT 20- u A" [4 W# H. }9 q
- #define ITCINTEN_SHIFT 21
7 D4 n' w( _6 a8 M - #define TCCHEN_SHIFT 22
: w& G# l+ B& [( Q; _5 C; w - #define ITCCHEN_SHIFT 23+ P) U2 E! `/ q2 r
) A" D% W, m7 W' \% ^7 w- static volatile int irqraised1 = 0;
7 C) `( \9 B* a, R - static volatile int irqraised2 = 0;' k8 c3 y- P5 m l2 M5 \0 O
- - q: Q; r/ L U; c3 v/ J6 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z$ k8 u0 Q; J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# v/ A, _+ E6 c! {( n+ D0 h! l1 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" A, |/ b t# p. t8 s$ i9 ~ - ! a. [. U- @2 ?( R- T9 v
- dma_addr_t dmaphyssrc1 = 0;
; N N- E/ u" P- u, ^2 e - dma_addr_t dmaphyssrc2 = 0;/ j7 {& r) ~$ s9 {- a' E+ Z
- dma_addr_t dmaphysdest1 = 0;: H, ^& a( L( y* E/ d$ M
- dma_addr_t dmaphysdest2 = 0;$ s i8 Q6 N8 R- g
- 7 ~) |9 G" v/ h# t- ?
- char *dmabufsrc1 = NULL;
8 c$ g: n* h; I( X- Z: ]7 R$ } - char *dmabufsrc2 = NULL;
" x. _5 }( U4 Q/ Z# |# N$ ~ - char *dmabufdest1 = NULL;
9 V' i# W" ~' ` m2 K: n% H - char *dmabufdest2 = NULL;
7 }# Q% {4 M7 ]. F* G
0 Q/ M1 A, y: H* C( e- static int acnt = 512;+ M4 k* R/ i, X3 j# i( ?
- static int bcnt = 8;
$ A' K& t, z# O3 ^0 i - static int ccnt = 8;
1 C2 n7 n: }0 R2 L; i - 6 Y" [( ~2 F! F) ]1 B
- module_param(acnt, int, S_IRUGO);
- d8 Y7 l: I$ u* Y: m, G- m& h! G - module_param(bcnt, int, S_IRUGO);! o2 B% V- S; P8 }* D$ g
- module_param(ccnt, int, S_IRUGO);
复制代码
4 ^) ?, K U/ w/ I) q. t8 @; t1 }% \: c5 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ m" X0 o2 c0 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ~- w& A) [+ m4 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( d* G, i0 w+ }) L
$ i1 u8 b: m0 I4 @6 {6 k5 I+ U) z8 S# Z3 Q! P7 p; y
|
|