|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # s) `) I- N$ \/ V- ?* ~
- [code]EDMA sample test application5 v/ `2 }( G7 I( N5 W
- /*
2 F* c" [+ O2 z' G, L& P, w - * edma_test.c# L u2 g* \* f: }4 p
- *
3 _# A" y, Y5 |* _ - * brief EDMA3 Test Application" I1 G3 V- q" Y( ~% @; { D+ f
- *
* y9 r- x( n9 R; d - * This file contains EDMA3 Test code.( D. u7 ~$ H; _1 l' P6 W
- *7 i, l# J/ \" K4 G1 u7 X+ }' K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 Z3 i2 V/ H* ?6 e0 c' f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 h: M; U2 `+ [2 v9 b
- * TO CHANGE." p- x7 F5 T1 i, e1 g& B
- *
, m) B& T" r5 l& p9 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* D5 F6 U1 d6 w7 t8 B& k - *
3 P% i3 h! m6 ^% w3 L4 \) m - * This program is free software; you can redistribute it and/or
4 L1 j9 `+ S6 r/ U) R0 R - * modify it under the terms of the GNU General Public License as' b+ \; s( X" l3 O; a0 _0 f
- * published by the Free Software Foundation version 2.! ]1 W( u# O% A. Q/ @5 k
- *; r [1 @0 J, I* W7 c, y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: f. B* P1 [- n" U" R* Z - * kind, whether express or implied; without even the implied warranty
; ~- J% [$ F0 }: c# w: H4 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ |0 `+ p% B, ?% F
- * GNU General Public License for more details.
3 L( D) F; q2 p' t- h - */; d; \/ _' K) n& A
) c/ q" Z" l! A0 ?- #include <linux/module.h>9 K0 W# g4 C1 N5 D7 H
- #include <linux/init.h>. N& A" M7 \% p+ c" c) n/ P
- #include <linux/errno.h>$ a. i* y# {9 Q3 i! t! b8 k6 o
- #include <linux/types.h>
7 f, b! [* g c) t, Y - #include <linux/interrupt.h>9 O3 E$ \$ U$ R: P& L# O. n; t; l" t
- #include <asm/io.h>! x! `+ g$ B! y' A
- #include <linux/moduleparam.h>' m' N- m! m, b
- #include <linux/sysctl.h>2 R4 x; d+ C0 H
- #include <linux/mm.h>
( H' W; j2 b' ~/ t2 C - #include <linux/dma-mapping.h>4 ] y1 u" J8 i5 s! _
+ g) B- F2 E3 S+ ?- #include <mach/memory.h>
: H- N* Q% [& J& s - #include <mach/hardware.h>
3 P3 o7 l- C1 C: D% t - #include <mach/irqs.h>0 B1 S* o9 s- |$ L! i# b
- #include <asm/hardware/edma.h>" ~' s, {) F$ N m+ O7 y
- - G4 ~" G! q1 c Q2 i Z4 [
- #undef EDMA3_DEBUG0 Q6 Y2 [) J7 ?2 y2 N' `' f$ I! q) q
- /*#define EDMA3_DEBUG*/
" T8 ]2 V: X! e- H6 W3 }3 _
4 a0 K2 s0 ^3 E) B' g- #ifdef EDMA3_DEBUG
4 \% u0 ~+ I$ r4 j! X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 [6 j! }1 a& a2 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ m8 Y7 ~/ ^9 X) L7 K8 p6 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, ~$ a, I' y5 M. `: k - #else) H. f. s& r* y2 q
- #define DMA_PRINTK( x... )2 S( j/ i9 N" o' P8 R
- #define DMA_FN_IN
+ E1 y3 i7 T' t3 a n - #define DMA_FN_OUT0 i8 Z, e( D1 U' z, i% c
- #endif
; \- Y9 f) g, i$ J - " |- {( I+ u. `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" d& j: A2 j& B k
- #define STATIC_SHIFT 3- D9 B. A2 X1 Q5 a" I5 s4 Y! i
- #define TCINTEN_SHIFT 20
5 p! b; j7 ?# g - #define ITCINTEN_SHIFT 21. s7 B# [, r8 [* k j
- #define TCCHEN_SHIFT 22
$ a, m! A7 U. L - #define ITCCHEN_SHIFT 23
/ O6 d4 m G: z2 P& {. S - 7 I1 \4 P, }1 {/ a* Q
- static volatile int irqraised1 = 0;4 w1 k0 B, q' f
- static volatile int irqraised2 = 0;4 _. D z3 F, Q, R, n: ]' ^
- 2 @% |1 n ?. r. a5 x1 R* {! N7 I& j* E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y, O0 `4 h# [1 T/ Z* q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* B+ t) P d7 q) @% \$ Z# U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* l+ l0 t8 u5 m9 q* V
5 q, I; {! N0 g9 _( K" I. q- dma_addr_t dmaphyssrc1 = 0;6 Z* f s2 c* d* }
- dma_addr_t dmaphyssrc2 = 0;3 s0 K5 m) j/ a C0 ^
- dma_addr_t dmaphysdest1 = 0;% N- L* C. J- K# p! t, r
- dma_addr_t dmaphysdest2 = 0;/ ]+ Z+ R( s2 ]
- . m4 X8 O& {8 F/ a
- char *dmabufsrc1 = NULL;( K- u9 z/ T9 K: `" e
- char *dmabufsrc2 = NULL;& A/ C3 g# _' q! d6 O/ O
- char *dmabufdest1 = NULL;: [6 Y+ ^. o0 o; R* I4 ~
- char *dmabufdest2 = NULL;
) G0 w( m' z4 ~7 |2 W# e - - }. U5 C3 n5 T0 @' z O+ X
- static int acnt = 512;) J' s8 m N8 ?) ?* G$ n X
- static int bcnt = 8;) l8 f( ^+ u$ q7 |
- static int ccnt = 8;% R- s& m' @* c6 G9 ~
- * j# R& r3 W4 l5 W7 m+ I9 A
- module_param(acnt, int, S_IRUGO);9 R' \9 U7 [# v u6 c& X
- module_param(bcnt, int, S_IRUGO);
- o4 E+ Q* w# j5 n5 @/ V# }* h: M& [ - module_param(ccnt, int, S_IRUGO);
复制代码
: W7 Z, I. K# @- e7 P, S5 K5 o3 Z* t O5 K0 p" Q' U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% j* |: { `+ ~5 H4 S6 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% V) t5 V) L" T3 O5 R( W6 e' ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ d# T" r' K; t# \
; s. `6 L, m- Q* b$ @
. v+ c- z+ H1 x* \3 i" N |
|