|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 X8 n# }7 F: v; _, S- [code]EDMA sample test application6 L- M- _. T, J8 }: }8 o. D1 [
- /*, t$ r& C$ V2 @2 i3 W
- * edma_test.c9 ?6 Z/ s5 N. k
- *2 d9 f! C7 O/ b# w7 k7 ~9 m& k
- * brief EDMA3 Test Application
5 `0 ~% A" p5 ~6 O% I" o. ]" E - *7 y/ e/ Y* f) @) P, ~* l
- * This file contains EDMA3 Test code./ H5 r- b4 h+ g7 S
- *
4 }% s2 \$ V$ j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! I! P& `% q. ^7 s% g5 b" m; k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; ]7 p2 D3 Z- i! i# e' _" e5 Z" s
- * TO CHANGE.
/ ? y! K/ H, t# B! V, Q" ~1 F' R - *
1 a, K3 ~5 E9 C, V' v$ T9 C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 H/ ]' L3 E: e# J
- *
* C2 ~4 d0 L! g6 M0 @; ], A - * This program is free software; you can redistribute it and/or
' i5 P0 n/ q7 `3 k - * modify it under the terms of the GNU General Public License as8 P! h) x; z8 ^/ }
- * published by the Free Software Foundation version 2.& v+ B- }1 |% |2 E
- */ t, Z; p+ D5 E V+ |& p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ |) [; |* |6 p
- * kind, whether express or implied; without even the implied warranty$ n! h0 r6 w, X% E- z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 t8 Z) m& q! x) k- @. Q
- * GNU General Public License for more details." Q% e9 H6 z2 U0 a0 d- X9 _
- */3 w$ a" O+ M2 l$ V
/ M) ^+ u& _/ C3 x- h5 ]4 z- #include <linux/module.h>
; u$ z- Q) @' Y- Z% A& M b - #include <linux/init.h>
, x7 l: A. N( Z2 } - #include <linux/errno.h>3 j3 }) K% `$ A3 [% u3 R O
- #include <linux/types.h>
7 j6 W f$ {6 U, g0 v - #include <linux/interrupt.h>
. Z* G' F& _# Z/ T/ l - #include <asm/io.h>
5 J) H# q6 k! R% A6 E1 @ - #include <linux/moduleparam.h>
' T8 C6 h; t! B( k# f S4 | - #include <linux/sysctl.h>/ l3 }8 r1 g! |
- #include <linux/mm.h>2 }' [& Z8 w3 A+ C
- #include <linux/dma-mapping.h>/ I# \/ V- Z u+ e: I
- ( x% S" M! u! i- j9 [7 V2 J
- #include <mach/memory.h>
! W' h# `- I- O3 U% v3 \9 l0 Y - #include <mach/hardware.h>
S v; h* D k: m5 W+ h - #include <mach/irqs.h>
& u, f: P) F- @- c - #include <asm/hardware/edma.h>
) {# F, ?' D$ H, J - # h* ^0 K8 O6 e3 S( i. O
- #undef EDMA3_DEBUG
; d) }4 W; L+ v8 l* }% F+ \: y1 e - /*#define EDMA3_DEBUG*/7 ]. q9 j( }. k9 O$ y
- * n W/ s9 D1 n9 y( S; O) h
- #ifdef EDMA3_DEBUG) i1 i1 o0 Q- P6 g$ O% r0 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( [1 [* e6 Z7 N1 x7 f/ z1 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ |4 p5 D, E2 Q) s R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): ^2 ~: |; c+ s0 L8 b- ?
- #else
; o7 I# L h Q1 G6 a) q - #define DMA_PRINTK( x... )+ I. [2 H: F. I% X
- #define DMA_FN_IN
) v3 T5 r7 H2 A" S' f# @0 ]2 j* R - #define DMA_FN_OUT
7 `$ z* n( x. {* w2 v8 M/ V/ f - #endif9 _. V7 V/ d- z+ |
- 2 c7 q5 b, z: p+ ~7 r1 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 r! E' Y" E7 L1 [; |
- #define STATIC_SHIFT 3
, ?5 f. j3 n r& {& f$ J2 _ - #define TCINTEN_SHIFT 20# ]5 O5 P. N, [1 b' B6 f( [1 c# z6 S
- #define ITCINTEN_SHIFT 216 }' r* G$ m6 ~( \
- #define TCCHEN_SHIFT 22
+ j3 m A2 D' \4 ~+ a9 h6 k - #define ITCCHEN_SHIFT 23/ f$ {* ^% S1 Y6 M# Z$ T
$ J" ?0 K Q3 D" |8 h- static volatile int irqraised1 = 0;: c0 l" J' }% ~
- static volatile int irqraised2 = 0;- t% a6 `1 a6 j8 n
- ; Q% W0 s- O& {! |% J4 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- g1 E i7 H, l5 G! ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {3 D3 i* H6 q( `1 \5 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N: H, L% z- Y, E
- 2 y/ M) W1 ]4 j% T p
- dma_addr_t dmaphyssrc1 = 0;
& R& F/ A; U( c: `1 q+ y - dma_addr_t dmaphyssrc2 = 0;, ^5 d! i. v! O2 N( `/ N0 n
- dma_addr_t dmaphysdest1 = 0;
7 N9 C0 z4 W) A, p/ h( v - dma_addr_t dmaphysdest2 = 0;
' D% J1 `3 S& Z; w. d
6 N" V' u7 l8 l4 C) w- char *dmabufsrc1 = NULL;
7 _+ y" q- ^$ I5 Z - char *dmabufsrc2 = NULL;1 w3 V5 p6 B; k! P+ \: v
- char *dmabufdest1 = NULL; r' @3 |4 {( |* ^" |$ N
- char *dmabufdest2 = NULL;: R) U/ u) L2 ]
& c8 x1 w' U2 b' v! ^8 O5 v- static int acnt = 512;
! T$ e/ T- L' `1 R, v. A - static int bcnt = 8;
" X/ P( |# d6 E6 \ - static int ccnt = 8;2 `. m8 r0 K' A; R+ V
- 0 Q- L& l+ W# n& M5 _* j, X
- module_param(acnt, int, S_IRUGO);
) h: b; a' { N) N5 j& N( v: W- ~ - module_param(bcnt, int, S_IRUGO);; q* E! u1 L! D2 N
- module_param(ccnt, int, S_IRUGO);
复制代码
* t+ {9 W! v6 g2 B; u1 C9 e
- z; N& Z, O2 R- ^7 x0 j. d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 Z# K( t4 E( N6 K. O4 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ ^. K- y8 O1 K/ D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 u1 ^3 y N0 ]; D; ~
( h8 L/ ^& F/ N3 q4 _9 I$ I2 t
4 h4 U. s6 G1 q; i" v
|
|