|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ n% R; J" {. q; z5 j- [code]EDMA sample test application
. O; N C. u- | - /*
+ m+ u5 j4 p0 R; C: l8 f6 g - * edma_test.c
4 p, i3 U( v% V: m( E3 n - *+ J2 v2 W5 \# F1 n& C% c! X
- * brief EDMA3 Test Application
5 L6 [4 O" }( w2 M- X: q7 R - *
, ?, E* N- ^9 M! c$ x - * This file contains EDMA3 Test code.
! P# o, A2 K v! W2 m( S6 M6 D - *
' A1 {6 s7 v ^. i# v/ ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ J" Q, T0 w, d3 m+ h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 ?/ d4 e E' _) W9 y/ u - * TO CHANGE.
8 g+ A. u" q! t% X! S- e# T7 X) ~ - *
3 S3 I$ C) p8 @) t: _1 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. C3 o+ z( G0 k; X7 M' K - *
1 s6 B2 p/ e& y" o0 {; ~ - * This program is free software; you can redistribute it and/or. m: g- S/ g7 c- {
- * modify it under the terms of the GNU General Public License as [3 P$ B2 g: l: Q* G. o: c
- * published by the Free Software Foundation version 2.
, ^& c$ G1 _) B+ P% f7 W8 e" b: H - * D) \& p% \5 z1 [& y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
r5 i; }# u3 h' w* r - * kind, whether express or implied; without even the implied warranty
* D1 n% N! X7 E- L# I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ F- |+ d( X$ w+ z - * GNU General Public License for more details.
: t/ d6 [0 D( i) B. z - */
2 E6 P# `( P3 c' c1 n1 O2 ~; V
, @/ |: a& Y- _% m. p- #include <linux/module.h>
8 V' M$ |1 u3 g! L5 J - #include <linux/init.h>
$ J: w" n. L4 z t - #include <linux/errno.h>; v5 x2 |% U: B5 i9 m( I
- #include <linux/types.h>
' ^3 K N7 ^: R4 U - #include <linux/interrupt.h>* f! K8 `0 [2 v9 c& ^
- #include <asm/io.h>
, R1 U) [# Y. C5 O - #include <linux/moduleparam.h>( q/ E/ W. \! J" q! e# x
- #include <linux/sysctl.h>
# ~7 H. d3 [6 S$ ^. N - #include <linux/mm.h>
2 d$ h, M! V& y/ G. z - #include <linux/dma-mapping.h>
! e# z# v f$ E( w) ^+ W - ' b7 N6 O3 K, R7 \! R5 Y7 c
- #include <mach/memory.h>
- ^2 F. T, ?) r. V - #include <mach/hardware.h> N- T$ m& ` ^ G9 L
- #include <mach/irqs.h>
z1 e G9 g3 D, V" q - #include <asm/hardware/edma.h>
5 ?7 z0 E+ |4 Q4 W) X$ [ - 9 C! U2 B$ W1 P4 ]' I: V8 h
- #undef EDMA3_DEBUG& B4 A7 Z8 j1 x# S; P" u
- /*#define EDMA3_DEBUG*/9 }$ ~. u; K" b- [8 a: K9 s' U" X
+ K/ O4 o7 z1 v" X4 R- #ifdef EDMA3_DEBUG! L, r' W+ ?$ r3 |* M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 }) Q* j4 C7 H: {6 s5 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" r, q! n+ b* n( ]+ Q4 u1 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" o2 f8 J8 X: m$ Q! X - #else
( m$ m* \& l+ w! V/ N: _& T3 \ - #define DMA_PRINTK( x... )% T7 p) ]+ j- R( o. S8 N
- #define DMA_FN_IN
4 l. v" c: n% s/ @ - #define DMA_FN_OUT6 ?5 P% ]2 s N* d6 S' R- m
- #endif1 Q: ^& W2 N0 I
1 Z4 U9 m0 m) K1 |+ S W/ a6 J6 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768); L% h; B$ J! S1 g
- #define STATIC_SHIFT 3
X: g4 ^3 L, I$ v: d1 c& K - #define TCINTEN_SHIFT 20
7 h+ j% r+ h1 `" r3 L - #define ITCINTEN_SHIFT 21+ c, ]2 f. N- I9 c: Q! ?4 N
- #define TCCHEN_SHIFT 22! M3 \3 F S" ]7 k8 w
- #define ITCCHEN_SHIFT 23
; H. D/ p: X! V* u( l# W( d) @ - 5 `% C% ?& \2 U
- static volatile int irqraised1 = 0;& r% d- @3 y: m5 S6 I9 l
- static volatile int irqraised2 = 0;/ m( T. G, N6 E/ f2 I
- / j% T _, V1 t1 e3 Q7 y/ K) S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 C& [3 b0 r( U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 n6 i3 K0 Z) _: l( P4 d. \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B, @2 H' ?0 F6 d. N$ ^8 Y
; ?/ B& R+ }+ }& E, E- dma_addr_t dmaphyssrc1 = 0;
$ U5 U; {! G' N- S& L* ^+ A - dma_addr_t dmaphyssrc2 = 0;
% a8 h+ J* t! v5 K k% R3 |7 p3 I/ g - dma_addr_t dmaphysdest1 = 0;
5 f, G% e. Y4 W - dma_addr_t dmaphysdest2 = 0;+ l8 |, Z& F! n5 D5 t( ?# }
2 S8 j; L {# L, Q, a- [7 v- char *dmabufsrc1 = NULL;; C2 S/ o. n9 C2 B5 O# Z
- char *dmabufsrc2 = NULL;1 a; V5 I! a: c8 l
- char *dmabufdest1 = NULL;
' Q* B. S* P u/ |8 d$ a! W - char *dmabufdest2 = NULL;
8 P9 \4 e6 ^% E: ^4 { - 8 ^5 A! Z2 Y/ d4 O
- static int acnt = 512;
/ P! C s: o2 d9 X% P, @ - static int bcnt = 8;4 n7 k% N, Y+ B2 A2 J/ [
- static int ccnt = 8;
$ ?' G/ Q. \! \# K% j
( c8 p( f" `2 j; I3 O- module_param(acnt, int, S_IRUGO);- q6 K# ] h, p, v9 l, `
- module_param(bcnt, int, S_IRUGO);
0 y3 c1 H- m/ `: { - module_param(ccnt, int, S_IRUGO);
复制代码
" s. G- Y, A1 F. i' ? M, k! \& j& Z$ ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ _8 @, ~ s, _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Z( l F. a5 q& Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: [% ^+ M5 u; z* }4 ^: g
+ Q7 T# H; }( y* `
$ ^8 o" F+ K, }" k0 ^% p
|
|