|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* L- Z0 }' u# R. Y# g- [code]EDMA sample test application
+ {. Z8 ^1 D: ~7 | - /*: }! d G( z8 n7 {) E6 _) V
- * edma_test.c
0 e3 k4 ~/ V1 T - *
' U: v) p' X# [& {) {: ^ - * brief EDMA3 Test Application
) J- k( x+ x3 E0 O0 b - *
) b' P1 P! s3 o2 J( r7 P2 G* L+ q - * This file contains EDMA3 Test code./ ^% r @9 y7 c2 ]
- *
d3 m8 \3 F2 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' R$ ? V% w- q6 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 T# `1 U; P8 U7 P2 Q - * TO CHANGE./ U' R5 z( b, z1 j3 t+ s, _- a
- *
s* V- u' S% J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 g+ p% G% c$ B. T- k - *
+ R) @; A3 F, i- B - * This program is free software; you can redistribute it and/or
$ H0 c2 G' J: w6 p7 w$ [8 X1 W- | - * modify it under the terms of the GNU General Public License as
! L3 k1 \; K- J3 B - * published by the Free Software Foundation version 2.# ~! ~( W* {) n& _, d- U
- *# \; b y- { M1 x: n1 @: N/ o4 \7 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. f' ~9 ], N# d# w* ^' h
- * kind, whether express or implied; without even the implied warranty
# t: X$ ^$ A6 N0 y3 c1 F( I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" T0 P5 n, u' t* K
- * GNU General Public License for more details.7 P2 `' \, ?- q7 S" N
- */% d3 e: o/ a. `% r% C+ {) N! j+ v; U0 N
4 X5 `" {/ n+ ^$ Q" V4 O8 B% {* V- #include <linux/module.h>. C S' B9 s$ b% u) O/ T+ Z
- #include <linux/init.h>* a8 U& ^( K% H+ O; k8 Z: J* H
- #include <linux/errno.h>& q% h1 J2 h8 V; }$ V, Y4 i
- #include <linux/types.h>
! _: C$ H8 D5 F% [9 q: W" n - #include <linux/interrupt.h>, J) [$ |% F) I
- #include <asm/io.h>
$ _& F* t: I7 K" {/ \4 Y0 \ - #include <linux/moduleparam.h>
% `# @; s7 L* c ^ - #include <linux/sysctl.h>. J; C5 k6 K6 V$ H& c r: b
- #include <linux/mm.h>
: s! ^2 S+ u( [+ j, k1 D+ O - #include <linux/dma-mapping.h>4 B! R( S, x( T3 i( x2 \ c! M
- 0 M8 [) t$ i1 L# ^" o
- #include <mach/memory.h>3 r; A( M, F5 }2 p& u
- #include <mach/hardware.h>3 E# Y; n- x7 O
- #include <mach/irqs.h>0 m2 M8 J" s2 F! I4 _1 }
- #include <asm/hardware/edma.h>" w+ m! D5 R. C( f9 k4 T* I2 N4 T
- & S' L5 s9 x, T! l1 T
- #undef EDMA3_DEBUG
: f& q& w% S& J - /*#define EDMA3_DEBUG*/
) ]3 i) M$ j6 s$ C' \' }, c ^ - 6 p' a5 v9 V. m4 I! n/ e, R
- #ifdef EDMA3_DEBUG7 [( M. H @/ o9 D2 t0 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 n' D) n( H/ f4 b K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ a6 p* \! I t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ T, F4 k. P- t, ^5 h - #else; f$ c J5 w) e5 u8 H8 R# ?
- #define DMA_PRINTK( x... )# E" v8 h6 K6 g8 Q: q
- #define DMA_FN_IN
8 q+ O Q) Z. X - #define DMA_FN_OUT
# c" T4 `& O. r: I/ T - #endif: n8 F- _- X2 s
- ( p; H9 S7 X1 `& D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; _# c; f3 D1 @' B2 U7 ^% D7 q, T - #define STATIC_SHIFT 3
0 x8 `3 B: f; } ~/ m - #define TCINTEN_SHIFT 20
' k7 ^: G3 o4 G* e4 l$ E) L - #define ITCINTEN_SHIFT 21
. |, T5 C; X8 K7 |$ D* G - #define TCCHEN_SHIFT 22
r0 [6 p1 [% E8 q - #define ITCCHEN_SHIFT 23
; u: x4 A' V) J+ @ h! U
9 V7 I( Z( X# B9 l5 Y- static volatile int irqraised1 = 0;
3 E3 h, s- T' I - static volatile int irqraised2 = 0;, X! M% Z7 S5 r4 O
- : D j" U# P0 H7 P- N; e( g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 v: D0 }4 [# y% Q+ d1 ^1 d9 c: a K$ S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 z/ U! G6 [( K: m/ A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 y+ P/ Z! M. H
7 c$ |( k0 I, o8 \6 C9 F; {4 } e$ L- dma_addr_t dmaphyssrc1 = 0;
) W) ?! m# O# c, Q/ z: H3 H - dma_addr_t dmaphyssrc2 = 0;
) ~. i. f2 ~+ F, ?3 s( p/ }) U - dma_addr_t dmaphysdest1 = 0;
/ ] e' {" h! }( j" j# l - dma_addr_t dmaphysdest2 = 0;
! Y+ ^% r9 N6 L. i7 T1 D y4 C, q - ( {6 Z; @, r2 U- N" k
- char *dmabufsrc1 = NULL;, h, m1 [. i" z- J6 o+ a5 l
- char *dmabufsrc2 = NULL;# B1 E( c/ V# o" q
- char *dmabufdest1 = NULL;$ M, W; P% F: V: Z+ Q$ g( S( x
- char *dmabufdest2 = NULL;
! q; C, Q4 d5 Z* v5 r+ o - - W5 c: q+ |0 g3 e& U+ `2 n
- static int acnt = 512;
9 B6 b1 N% U: J$ ~5 W5 H0 H W3 z' G - static int bcnt = 8;, c( {. j( c/ v
- static int ccnt = 8;0 \2 _+ l+ b8 ] j! u3 G6 T: y
- + ]; f4 C5 d/ P3 ?
- module_param(acnt, int, S_IRUGO);8 }, p- v" y' g3 x& [* R
- module_param(bcnt, int, S_IRUGO);1 |7 I% d% e7 |7 {
- module_param(ccnt, int, S_IRUGO);
复制代码
' X8 ~- m1 d' C2 X, K0 q: M
% m. n* E, q: S+ k5 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 W; `1 p9 F. Z g! e4 q$ ~: s4 k1 Karm-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$ l8 \' b" e& o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 A0 C$ ?, ?+ Q" w* j
2 _# x) e! d" s6 U- M" h
( {! ]( r: H; F1 l- m# o |
|