|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 q" s# }" D3 s0 w e, f- [code]EDMA sample test application; e P& Q, t/ k" X" p% }9 v8 A9 `
- /*3 \& [/ K! ?. n$ D$ q
- * edma_test.c
d: ?' z. G* w - *3 f# A2 D0 ~2 A8 B0 ?6 V& R3 |1 L1 n
- * brief EDMA3 Test Application
5 [7 _4 D7 Z$ [- s - *. _- c5 @& k: J( h! e2 G
- * This file contains EDMA3 Test code.
; I! `2 G+ v$ H0 D0 B2 r5 i$ a - *& ~$ d# b" \( d U/ v: U9 ]5 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; R4 y3 v G- i8 q) L% S( e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* P& `* g/ K2 D& f
- * TO CHANGE." K" I& C3 J( V5 O* s3 t# g
- */ v% I6 X; z1 F4 r; X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; }5 F" Q! s9 o: Y+ a% A1 ] - *
) S( z/ X9 H1 l5 H" c) z& C; I - * This program is free software; you can redistribute it and/or1 t+ T1 | i1 I
- * modify it under the terms of the GNU General Public License as
2 i" j+ H* l8 f* d - * published by the Free Software Foundation version 2.8 L1 ^: D" [3 e9 O0 D
- *
+ `" ]) m7 ]2 y0 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I" M$ Z, `0 [6 s2 P o0 u& `' l
- * kind, whether express or implied; without even the implied warranty! ^% c$ z$ i" J, f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" w8 q- t2 I# _$ o - * GNU General Public License for more details.
2 q# h6 X: W: p4 a7 p - */) L; M+ J: O" ]5 Z }1 H
- ! u0 Z+ h( Y+ q
- #include <linux/module.h>$ S5 R+ Z& @6 Z, T, q% n
- #include <linux/init.h>. ?( }/ G& ]. D
- #include <linux/errno.h>: w0 c5 g, o6 ~7 y
- #include <linux/types.h>
* Y# C) \$ \* h I& m6 _ - #include <linux/interrupt.h>
; M0 {! v$ N2 P/ }% a/ Z4 N - #include <asm/io.h>' n4 D G6 N0 P* a; B! \2 I
- #include <linux/moduleparam.h>/ s- Q# p. P! E; E
- #include <linux/sysctl.h>1 r- \) g Q, d7 k) a! C9 C
- #include <linux/mm.h>. ?. V2 q# |4 \/ L# K
- #include <linux/dma-mapping.h>
d8 X/ i/ a0 {4 y! L6 n, h& V( i
4 c3 r( A. T% \5 {6 v- #include <mach/memory.h>. a- V, K& h; q8 L( u+ ~
- #include <mach/hardware.h>+ i: D" t) d# \& i, R
- #include <mach/irqs.h># a! ?7 R6 k2 v) d% B
- #include <asm/hardware/edma.h>
; l: O9 D' v8 V. T: g - % Z8 b0 s% V. F/ {1 J4 A' `; K6 S
- #undef EDMA3_DEBUG% V0 X; R+ K2 r. p
- /*#define EDMA3_DEBUG*/
5 g" F1 Q6 f6 ]1 G
0 G( R- ]' W6 V% s* o3 o" g" p% F- #ifdef EDMA3_DEBUG
* S* B' g2 O a0 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ \9 r" V5 a) F, ^& b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): r- l D' G4 H3 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M9 c, d+ S$ e1 P$ n* c( P$ b
- #else
8 U" W/ q6 h; m. ]# U1 B - #define DMA_PRINTK( x... )
/ {6 `7 [7 Z1 Z - #define DMA_FN_IN
- h- _! \1 s$ Q$ m6 B; C6 s' C6 t* l - #define DMA_FN_OUT
w V7 ^) P9 h" n$ E - #endif
" x0 x/ U) c+ Z6 }: V* l8 U( u
8 ?. e( B9 q0 w, Y/ V" l0 u' h$ G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 X6 @* z$ s3 \9 h$ g" t3 w" Y - #define STATIC_SHIFT 3- ]0 U, g0 c) S
- #define TCINTEN_SHIFT 20
8 }) c4 V- U2 `7 f- [, I* ]7 w' s$ ^& E - #define ITCINTEN_SHIFT 21; M0 p! g" {* s1 R
- #define TCCHEN_SHIFT 22
; @9 K$ P4 m' ]$ W6 K7 c - #define ITCCHEN_SHIFT 23
, h4 P6 N7 M2 `2 `. S: `! X- u
" V9 H9 @2 E# z m6 Y4 E! v- static volatile int irqraised1 = 0;$ p, _( G( {$ h# v' S) k
- static volatile int irqraised2 = 0;+ D$ f6 p7 M( T! f0 ?
- 9 u8 L% |) @1 F; a; l+ b0 R3 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) L; q$ T, @7 _8 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 t4 G' T ?. t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a$ [0 M2 Y& t
L1 R* |2 S9 X0 J4 l- dma_addr_t dmaphyssrc1 = 0;
7 ~( q& I& d* [2 ~ g" V3 S" k - dma_addr_t dmaphyssrc2 = 0;" X4 q$ X2 t, ]1 s
- dma_addr_t dmaphysdest1 = 0;5 K( x) z! t1 ?# t6 W7 n. L
- dma_addr_t dmaphysdest2 = 0;
* ^2 N5 C$ _ b$ p7 C" M - 9 o+ C0 e+ I; X; _0 _9 Q$ A
- char *dmabufsrc1 = NULL;/ Q* _0 q! i3 o1 \6 y
- char *dmabufsrc2 = NULL;8 \* p- \! ?/ F+ h$ E' J$ P
- char *dmabufdest1 = NULL;6 j$ R3 f( w0 ~, S2 n
- char *dmabufdest2 = NULL; I( h3 \% r- r5 ^( _: Q6 _
2 I; C: g& n% x! o) d) x% O- static int acnt = 512;
% r3 y4 c: R. }4 u% S9 O - static int bcnt = 8;
# H! R+ d) p0 m" { - static int ccnt = 8;8 o7 W3 T. Q* a, t
/ H0 t% l- s; c: s( _- module_param(acnt, int, S_IRUGO);1 `% ]1 y, ~1 ]
- module_param(bcnt, int, S_IRUGO); }8 J: e2 `0 y+ Y/ }$ j0 u$ I& z
- module_param(ccnt, int, S_IRUGO);
复制代码
! D1 U, r) T# E! G& X1 Q% x2 l1 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 X' _ ]1 y3 @/ o9 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 G6 b/ _5 V: v1 I" f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ {# T* e5 z! j- L" R
1 A' z$ n2 {( y" @7 \7 X7 \2 T3 z
) ~" _' s! f( L/ V1 | |
|