|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 |! \8 Z. |5 b7 n; K* _
- [code]EDMA sample test application- j. I' G) Z9 I. f
- /*& t+ s% k% r2 B
- * edma_test.c
! z& E, M; P7 X5 t0 z - *
8 V' u2 T( q. j - * brief EDMA3 Test Application- K/ p0 \. V7 q. y! L u% d
- *" r0 c1 i/ u, _0 L
- * This file contains EDMA3 Test code.
/ O3 M% C$ s. i2 L3 J* E8 s6 p - *
5 r2 P+ y% ~; J* t6 U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ g1 E# J. O% \7 L- e6 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; a" \9 {7 z# \+ K/ p
- * TO CHANGE.
5 K& s' u' G u. \, X+ C: C l - *
: i1 O B4 N; `2 g* { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% X( p; {# }! v+ a
- *
7 }; F0 E3 N* G4 [. N0 C% c - * This program is free software; you can redistribute it and/or
8 N' O9 c& X% _+ _+ C, a% Q - * modify it under the terms of the GNU General Public License as2 Z9 d5 w+ n! {; f6 Z( [
- * published by the Free Software Foundation version 2.
8 w9 m' z" Y W+ S) k4 p0 Q1 g - *
7 i1 H# e7 p; u# R- o% O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* f' r S7 L6 X- n
- * kind, whether express or implied; without even the implied warranty
& K+ f, y9 W: R& f7 d! n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 I' x; S4 Y' a# d. e - * GNU General Public License for more details.
7 S E; D, J1 s" W' ^: g. M( d4 B& e - */. E% ~ g' G7 I6 o/ q5 [/ q
% }' u6 Z4 t3 {& z3 w- N+ R& v' z- #include <linux/module.h>$ Q+ c& I0 Q: p/ b8 R8 s
- #include <linux/init.h>
( u3 w+ q1 H4 U- x- e - #include <linux/errno.h>$ \# ^" ?/ V! M6 n, x, _
- #include <linux/types.h>* s' }3 O2 t( V& M0 X3 @
- #include <linux/interrupt.h>- J1 }3 r& ?- L, w& M; T9 H5 |
- #include <asm/io.h>1 ?- T2 ^, N9 l# @4 P+ V0 L% V
- #include <linux/moduleparam.h>3 Y( U9 Y3 @5 h
- #include <linux/sysctl.h>) J/ e1 h4 _ }. S% t7 m" B
- #include <linux/mm.h>
: K6 {) H* A( M4 J+ P1 }0 w - #include <linux/dma-mapping.h>9 Y2 x/ L# I/ r1 S8 a1 S" {
- ) ]& X1 B9 J7 X7 a4 W- P
- #include <mach/memory.h>
6 [5 |5 E1 P9 o" ] - #include <mach/hardware.h>' S' N8 S# K- [/ e- r0 e
- #include <mach/irqs.h>
# B) s0 ?- a- g5 T - #include <asm/hardware/edma.h>4 b( n8 x4 ?, F- [1 m/ ^9 j
- 0 J" {7 W B9 d8 K) S, B3 O
- #undef EDMA3_DEBUG
3 @! R! b. Y1 d& {, x. f% q - /*#define EDMA3_DEBUG*/9 \/ @ ~, P+ w3 Q/ D; N' m- K
- 1 r* \1 K- p, L4 {. B7 T
- #ifdef EDMA3_DEBUG
7 c" h" Z- v# q0 x9 p% s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. e' f# w4 N- R3 x, N9 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 U) l! H$ u) `, M4 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( J5 J4 Q$ e( y; O/ W7 R4 x& I - #else
' R* F0 ?4 x4 A4 {3 J2 B - #define DMA_PRINTK( x... )
' V0 ~% u; g" _ - #define DMA_FN_IN7 t8 ^5 x6 |6 T. ~8 B9 K$ s
- #define DMA_FN_OUT( r1 Y1 L9 i* k( X/ m
- #endif
/ V6 v7 p; Z: q, I! ~$ i' v7 D0 } - $ t8 F/ w B" U( J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 ^( C6 ]7 j3 z$ F. d/ d# h
- #define STATIC_SHIFT 3
4 Q9 w& o* g0 d, @$ R - #define TCINTEN_SHIFT 20
/ ?1 N- y0 v, M9 T; w - #define ITCINTEN_SHIFT 21- c. E- c1 i9 Q0 Z7 _5 D8 L
- #define TCCHEN_SHIFT 227 G: B0 Y0 O' {# _! \1 W z0 w
- #define ITCCHEN_SHIFT 23
/ N+ Q! k3 A7 y0 ?5 b! [ - + x ], E0 ~9 R l% l
- static volatile int irqraised1 = 0;* K2 X+ G, }( R- g/ v; T, w
- static volatile int irqraised2 = 0;
7 H$ _( B- N2 D - 9 K; l, t2 T0 V4 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q8 i# N I* _3 a+ |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i$ o$ E- {$ }! r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j: O8 v: W) o' I
7 J& ~% E0 d5 H; p% v6 r2 a' t- dma_addr_t dmaphyssrc1 = 0;
' y- D3 b4 @3 \3 d6 R - dma_addr_t dmaphyssrc2 = 0; T7 s# |: X8 I- b
- dma_addr_t dmaphysdest1 = 0;
$ c3 E, `: ^; V - dma_addr_t dmaphysdest2 = 0;
" w& B. P* T U! y" q - 3 a) \+ s9 m7 s% R) x
- char *dmabufsrc1 = NULL;
2 b5 @( R1 K3 E0 {, U - char *dmabufsrc2 = NULL;# T" |% C3 Q9 {! E
- char *dmabufdest1 = NULL;
6 I6 I9 l: U+ g/ j: w" f+ l3 ? - char *dmabufdest2 = NULL;; |! J9 {8 H. o1 c$ V. ~' t* d+ m9 b
- . E8 K, r7 n4 |9 v
- static int acnt = 512;3 f- S+ d* Y5 U6 L: L( ?3 x8 ~" B
- static int bcnt = 8;
6 u+ q3 k$ E$ u; d% d6 \, m6 } - static int ccnt = 8;
( G! S8 z1 K2 r1 P/ f
, G' N; B8 l! u- module_param(acnt, int, S_IRUGO);3 n2 I$ X$ \2 ?% ~
- module_param(bcnt, int, S_IRUGO);) _7 v9 S4 S' g+ g* x
- module_param(ccnt, int, S_IRUGO);
复制代码
. n0 t8 A9 f9 L$ b" J$ e3 c4 X2 c% c9 ?% t% o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ?0 c7 w# v+ q3 O% H* {4 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' b$ O* ?, t! h. L8 L- G" B! P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 B: X5 [6 G; ~7 }* f) b
9 Q8 y+ p% J! c! @ y" x- X- |( G ~, _5 i$ K% `* p% o" q
|
|