|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 P& @( V9 S/ S( ?3 {& a8 b7 t
- [code]EDMA sample test application' M& G5 V! e2 R, ]) D- m
- /*- s8 ?, \" ]2 p
- * edma_test.c
# q$ V+ V" G$ u. Z' S( L9 _+ z' z - *
' y4 G' o+ v) z$ b. M& U4 N0 Q - * brief EDMA3 Test Application9 O7 ~# H% s0 q
- *9 o" k2 F0 T. J7 j- G t. [
- * This file contains EDMA3 Test code.
) u, e3 g: r+ q2 [ y - ** L( d/ T* Z8 H3 }% Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ J2 t x' s/ B# o9 h ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 L/ G* s/ \0 C2 \ l8 U& X& L
- * TO CHANGE.
0 m1 \6 x$ g, h. P, u - *8 \6 a& f0 P9 C5 {5 m* U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 r' B; d5 V. u' N& [
- *- ^1 o2 C" c/ ?" O9 @/ V
- * This program is free software; you can redistribute it and/or" z2 Y" z1 M- D6 [
- * modify it under the terms of the GNU General Public License as2 u' ~, ~; Z, v
- * published by the Free Software Foundation version 2.- _! ~5 o7 b5 B, J6 ^: c2 k, C5 x
- *
; m% G/ I! u% Y: C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 t, S" N* t2 c1 E6 \, `, ]; m
- * kind, whether express or implied; without even the implied warranty9 z4 r) H7 j, w' u4 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% h& W1 U0 e' ^# x9 Q' Z
- * GNU General Public License for more details.1 q. x. Y3 _% c2 L1 b
- */
6 [5 B- ]5 O5 g2 P W E8 s - . i6 ]" ^; X7 |# B8 d
- #include <linux/module.h>3 i- e$ E% _; b7 C
- #include <linux/init.h>1 M3 F+ d u+ n( ?9 D# O
- #include <linux/errno.h>" M+ W8 k0 e7 K* j5 Z
- #include <linux/types.h>9 K7 y% W# S3 B$ V9 ?
- #include <linux/interrupt.h>1 v' t9 m0 B% M- C- p) L% \ u
- #include <asm/io.h>& r- u- v: s7 \2 p
- #include <linux/moduleparam.h>
. x$ B4 `9 S# v/ F8 W/ w2 [$ y. D - #include <linux/sysctl.h>2 I' Q) T8 y. w$ B
- #include <linux/mm.h>
/ {, o3 B# F0 o: t! Z4 G; j - #include <linux/dma-mapping.h>: {) f! Y, r% S
- 9 f+ P! d8 M. e( ?+ m% l2 D$ F
- #include <mach/memory.h>
4 g6 h. z: Y- u4 O - #include <mach/hardware.h>
8 D! C1 h8 O2 \4 T( E* b - #include <mach/irqs.h>
+ X, T( b3 M2 o0 b; \, ~ - #include <asm/hardware/edma.h>4 k# f+ S: M% c& B
- 1 h R9 m' q* b$ z, _# F
- #undef EDMA3_DEBUG3 i l1 ]) T- F p
- /*#define EDMA3_DEBUG*/8 t% D& I) o- i8 q2 S
; d3 w4 p1 I# d2 H2 ?. ?- #ifdef EDMA3_DEBUG0 m2 ]% n3 g' N4 V+ ?+ S& y0 L3 w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N0 Y3 f4 b' n" W" s& j7 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 w" K. M/ a6 I* ]9 E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); Z5 G% s0 u& W" c2 Y+ }
- #else( H0 z k+ W# w8 S `
- #define DMA_PRINTK( x... )* z2 C( |2 \, C5 w( w+ S' f
- #define DMA_FN_IN
, u i( \9 @$ N; n- M - #define DMA_FN_OUT
( G8 E2 p% q, U - #endif( r( f( i$ [1 W% I
3 E# X, [3 l2 q% Y# e$ k- #define MAX_DMA_TRANSFER_IN_BYTES (32768); K& o) @! P- k% B6 t6 t
- #define STATIC_SHIFT 3
2 B0 `! ~8 J: C, n x - #define TCINTEN_SHIFT 206 B6 U0 e* T y& ?# q/ k
- #define ITCINTEN_SHIFT 21
, F& g$ O# e& f* j' R - #define TCCHEN_SHIFT 22
- E; i: k+ G2 c% u1 f, B - #define ITCCHEN_SHIFT 23% R: H! g( S1 K9 m9 w% h$ f
. R }1 v7 R+ t0 b& ~$ Z" o! [2 \- static volatile int irqraised1 = 0;8 E3 r: m* B; |5 D# X" |) X
- static volatile int irqraised2 = 0;1 E/ S$ e1 Q0 t5 k
- q: z. h ]4 w7 S C5 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& \4 m7 I4 {* y+ N& q" w: [3 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G) T1 L! K0 j5 F$ l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p2 z# ]( S0 J E/ c' Q$ P1 P" }
# N- \3 a( q x2 Z- dma_addr_t dmaphyssrc1 = 0;
6 l! u9 F0 a7 Q/ I# |4 y - dma_addr_t dmaphyssrc2 = 0;
& W: b+ S$ h( W - dma_addr_t dmaphysdest1 = 0;- r; G# W( o, T0 C. q% b! C& ~
- dma_addr_t dmaphysdest2 = 0; o9 n" z: X# |# U/ i; t2 i
- * F8 ^! y7 a R: p, D, x
- char *dmabufsrc1 = NULL;: }$ W& |+ D- q. z4 \/ C
- char *dmabufsrc2 = NULL;* R- c1 g1 R$ \) o5 E3 v/ O
- char *dmabufdest1 = NULL;" G8 t8 J7 |3 T6 h2 N0 c
- char *dmabufdest2 = NULL;
( H# b" i+ |0 D7 B; V8 n' m
. n/ _' [& t$ E2 W$ ^6 Z- static int acnt = 512;) a5 p4 P6 |, E. D1 O" q
- static int bcnt = 8;
' H# ^) |, y0 R# I0 @2 y* @ - static int ccnt = 8;
, J/ I. J9 u8 u5 I7 N. n
1 L1 ]+ A: z' a4 N+ X! t3 w# L- module_param(acnt, int, S_IRUGO);
8 g$ d! i _+ E8 T7 O. a% Y - module_param(bcnt, int, S_IRUGO);
8 r8 u& ^1 B; Y0 i) E - module_param(ccnt, int, S_IRUGO);
复制代码
: w4 _* O1 L7 R' H; G/ I1 ?4 I* b; v; V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* P" z# C5 t0 ], ^3 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 f$ z' {; L( L) v3 `& `5 e% {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ d" m; v: q4 x [
" |0 ?! L9 Z. D, ^3 h& p2 N6 z! K5 |6 M/ n) X+ w
|
|