|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& m' p& x) l. H) W- [code]EDMA sample test application) M; F3 }% U3 H; K8 [' [
- /*) {% P5 z* k7 l$ ~
- * edma_test.c
7 N. j4 [* i& I3 b: O - *8 {4 }, B3 R5 ^
- * brief EDMA3 Test Application
2 _# w c8 D$ X* f. k7 ^ - *4 }# y5 U, X3 v5 s
- * This file contains EDMA3 Test code.3 B, E( v3 J: E; A
- *
# e+ |1 a6 L) r+ W, C# | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! e8 n: E- L, K9 l2 d' N: D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 j5 G& E! J0 {" g4 S; ?
- * TO CHANGE.
/ b5 [9 d" T% e% N6 G$ P6 d - *6 ?* |+ D' S$ h4 ]) z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 w# l5 _' z5 i9 C3 Z: R - *
% d3 Z* X5 H- G- Z - * This program is free software; you can redistribute it and/or7 q0 I$ \* F7 {1 l) N- ]) b) N; o6 H
- * modify it under the terms of the GNU General Public License as: w' o2 Y2 h0 ]) P3 k7 W3 [* z
- * published by the Free Software Foundation version 2.& X% E6 e! b8 l4 g7 ~; D) B5 w$ c
- * |2 a: [$ a7 l: f6 _9 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
z _9 \' [3 I ?2 K7 q b - * kind, whether express or implied; without even the implied warranty
) i4 |$ H S9 V7 k6 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& \% ?( x, p- k. ?0 I; k7 d - * GNU General Public License for more details.+ C! n/ D# A+ j5 T- B0 b
- */9 t F# R' @6 E. D7 W
- * y# u; V7 S1 R5 M: {8 \* H
- #include <linux/module.h>% D0 b) I9 |8 z$ m A0 y
- #include <linux/init.h>
' U0 V9 J) n* F$ a5 m - #include <linux/errno.h>
, k* I% o/ k6 g ? - #include <linux/types.h>$ x9 G# G7 y: c
- #include <linux/interrupt.h>9 Z8 r* Q9 ~- j$ G% L9 d7 W
- #include <asm/io.h>5 P: Z7 M; C$ S3 H5 m9 c5 \& Y
- #include <linux/moduleparam.h>5 c( Y4 u8 y) w" ~9 J
- #include <linux/sysctl.h>
$ D# ?3 l4 k) e% o7 r9 p# \ - #include <linux/mm.h>
" g2 _" u5 S2 p! k$ c9 U1 X& ^5 W0 \ - #include <linux/dma-mapping.h>
$ b7 b6 M& V7 J7 |$ L; p; V - " m" s( o: n) F# M p2 D
- #include <mach/memory.h>
' v* F! E7 p' w6 V, I' j7 ~ - #include <mach/hardware.h> T( h+ t6 {8 h0 U2 c: M0 J) U' p
- #include <mach/irqs.h>( ?2 E( x3 M! j. _9 ^- O
- #include <asm/hardware/edma.h>
4 r5 S/ k+ W2 a3 J' E& m* T' Y - & [! H' B* A: X7 v6 W' W" V
- #undef EDMA3_DEBUG
& k! s$ y% u9 u. W% m* E9 X9 F { - /*#define EDMA3_DEBUG*/! t$ Q3 P8 d! i; C) C, l, {, o& s
- * B7 ~! L. J6 v# a7 g
- #ifdef EDMA3_DEBUG; a5 U; b4 ?' h. Z) b( g: L @- o4 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 T7 d% {: p+ {4 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 ~7 T N* ?2 f0 _+ ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b& U' X- G: ]
- #else2 [4 H5 g7 ?* u7 F6 P5 n' Z
- #define DMA_PRINTK( x... )
% p/ f6 o9 r. J, e1 i; E - #define DMA_FN_IN
; R; |- R: O# t6 H( @4 ? - #define DMA_FN_OUT# O/ l1 K9 J: y$ p3 M
- #endif
' ]* H+ T9 U: @& a' r* V - * y2 y( w/ u6 f6 l& m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ d0 }5 U; e, t$ r1 z$ y7 y - #define STATIC_SHIFT 3; _# G' A: C; T6 |5 c8 Q' O; q
- #define TCINTEN_SHIFT 20
q3 p4 m& ~& b0 r2 P1 | - #define ITCINTEN_SHIFT 21
q, g8 m& [# J7 { - #define TCCHEN_SHIFT 22
8 p# t. K# C7 ]8 q' Z3 T - #define ITCCHEN_SHIFT 237 [! E: Z1 l8 \; Z. o1 C
# H' k7 i$ m( S- E' Q- static volatile int irqraised1 = 0;6 E+ `6 P1 f% c: u6 [3 w2 K; A
- static volatile int irqraised2 = 0;' y% ]2 p6 |- D* |
- ! I! Y8 b- p( [& v5 L) \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ]" r7 \! H0 S7 a9 D. A! x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: l' y) B& Y* U1 O* [2 x# ]$ { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ~ {* ~6 _9 l4 K# H x0 D
* G, }0 U& v! C/ T+ e- dma_addr_t dmaphyssrc1 = 0;% P& u# L4 s9 N
- dma_addr_t dmaphyssrc2 = 0;2 @* _; k3 s( I" J7 G9 {0 k
- dma_addr_t dmaphysdest1 = 0;1 f6 S9 Q; C, T1 ]
- dma_addr_t dmaphysdest2 = 0;
! r9 B! ?1 S% u# v3 y - - W$ H2 k5 R4 |, [$ P
- char *dmabufsrc1 = NULL;
- D( J9 i! L! d - char *dmabufsrc2 = NULL;" J& d7 c2 t3 P- S0 V
- char *dmabufdest1 = NULL;
8 r1 k# y4 p/ n' `, E - char *dmabufdest2 = NULL;8 k# R) c x# f: q) ]+ N
- . `, m& ~# z; `' [5 b, x5 s& r
- static int acnt = 512;& i1 Z& V6 f2 C2 ^* M, d0 D: `6 `
- static int bcnt = 8;# W% j3 @: m; c0 v' @
- static int ccnt = 8;
' E3 M# d1 ?1 I$ o7 I0 z
+ a! r" L! J2 G- module_param(acnt, int, S_IRUGO);2 x# i# F* x" I+ ^
- module_param(bcnt, int, S_IRUGO);
6 l7 g7 i7 C) U4 ?7 _ - module_param(ccnt, int, S_IRUGO);
复制代码 , p$ K: t/ ?/ a: l1 b
3 W0 X1 N( ~& w9 s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
D* F6 t5 d. G! H F8 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* u4 T7 W6 Z8 Y3 V" A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* z1 S) F" {/ u* r7 J
Q+ |1 \: r8 f E. [
3 ^) C, X2 ~* `- Z- H- A: r |
|