|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 c8 d. u* P& { ^1 Q7 k- [code]EDMA sample test application5 F; u3 K: e( R' T
- /*& J5 ^" d0 t7 y8 h5 A
- * edma_test.c. L1 ^- }$ `5 l* s3 ?& \
- *% u( X3 N- `' j2 N t
- * brief EDMA3 Test Application2 n( U4 y& W9 @2 }& |# G0 }
- *
0 R: A6 M) K! E- Y - * This file contains EDMA3 Test code.6 E+ h4 _2 d9 y
- *1 D! a& V& B/ {( e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Q4 l `9 J: p) e2 {4 A+ R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* M6 I- q/ e5 l/ `' e9 p; f - * TO CHANGE.
. S0 B @3 L Z% j, { - *
* K3 e4 {4 J* r* v0 Y$ A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) J, n4 U) ` S+ s. c
- *
2 G2 g9 p ~: \; `+ f - * This program is free software; you can redistribute it and/or
5 S$ f/ u. H4 J! _ - * modify it under the terms of the GNU General Public License as
# N \% F, O# D x - * published by the Free Software Foundation version 2.. W. A0 u* ~ v; J" N$ C. U
- *9 |' }: t& G1 X/ T9 l- _, Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H- ]' a7 N. a
- * kind, whether express or implied; without even the implied warranty
- u/ ^/ O( Z# ?8 Q9 f" \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 K9 \# ? u' |9 ^ A, @- U
- * GNU General Public License for more details.
; y: O J2 n+ }1 V, V - */
& K5 Q9 x9 e/ W! z' q
4 Y9 W$ C( y) s! F- #include <linux/module.h>
& O7 y: O: [6 t) C: g0 \# r - #include <linux/init.h>
P) a+ r$ ?7 R1 Z - #include <linux/errno.h>
]& L' e I5 k) r4 ^3 M# T4 h: q - #include <linux/types.h>
$ U, x) m% n8 G. I - #include <linux/interrupt.h>
- g' `* j, j% C8 H1 C0 B - #include <asm/io.h>
) g2 |/ b6 x( I& K. I0 } - #include <linux/moduleparam.h>
0 h( t+ X5 N* j. s' R - #include <linux/sysctl.h>
: C! [9 F$ v0 e* q/ A4 Q - #include <linux/mm.h>
: u; ^0 ~; G: M7 ? - #include <linux/dma-mapping.h>, Q; `# J3 |, f
- - n* @8 S, X; j; y# d
- #include <mach/memory.h>3 L7 o4 l/ q1 P2 n5 V
- #include <mach/hardware.h>
9 J: p4 N# `1 t9 F7 b+ [; d6 D5 w" _ - #include <mach/irqs.h>/ I7 @/ B7 Y3 Z i0 I) K B
- #include <asm/hardware/edma.h>* T: y! Y$ n" l5 K+ {" F# b
# Z( S5 _* J# F9 r2 I9 e3 @- #undef EDMA3_DEBUG
1 ~$ `: v1 j0 J1 e% p) C; P - /*#define EDMA3_DEBUG*/8 a2 d4 B6 @% Y0 K
; j4 b) I% l, i+ `" \- #ifdef EDMA3_DEBUG
) w: I, c! p/ N- x& k6 q; S* b( w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 B' U0 G" b0 d6 U0 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; w& w$ x! A7 E4 Z' C* N* S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ I3 I: H. @; o! Y0 i: ^1 L/ D - #else4 p2 j" y% \5 L) [' d: |
- #define DMA_PRINTK( x... )+ x1 h: K [8 \6 V: m' B4 }
- #define DMA_FN_IN6 ]2 f6 y8 b' r) {8 |4 p; U9 v
- #define DMA_FN_OUT- j4 O' r$ \, V
- #endif: D# m; y" D! |0 t# p& J" Z
' `7 O0 D/ i& a' B1 y/ J5 d1 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) g7 J" x+ Z4 t6 `7 B) e# v
- #define STATIC_SHIFT 3
1 u- x8 J: C! W) l - #define TCINTEN_SHIFT 20/ Q& B; D* n% ]: M z! `
- #define ITCINTEN_SHIFT 212 I; f. n* n9 q5 l4 K3 _
- #define TCCHEN_SHIFT 22
6 \* }( F. q* k* W - #define ITCCHEN_SHIFT 23% Y: M) h- J" r& P! y p
- ( B- S \7 [ [( k
- static volatile int irqraised1 = 0;- T$ R1 j' w8 c* O5 E. A; K T
- static volatile int irqraised2 = 0;5 k6 V; q7 S% J5 s7 t8 `6 k
' d8 q) U, c, x* S( B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& v I+ S# F& S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \ s7 P! \6 M8 o' p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A( J+ s+ b' T9 U% X: k
. b& b. T" s d1 i. W- dma_addr_t dmaphyssrc1 = 0;
- v, G! k: a) l8 P - dma_addr_t dmaphyssrc2 = 0;+ n0 B9 J. Z- K- c: z% d
- dma_addr_t dmaphysdest1 = 0;& }" n0 @( w# L( t
- dma_addr_t dmaphysdest2 = 0;
3 T: e- K& o' g/ x/ b( \) _1 e - 8 j4 P) u) r4 @% ?/ k" |6 a
- char *dmabufsrc1 = NULL;& b, i) G+ ]8 B5 o: W+ u
- char *dmabufsrc2 = NULL;
% q. e2 u6 L/ }" q9 g) f - char *dmabufdest1 = NULL;
0 w# d2 _* @& A9 z - char *dmabufdest2 = NULL;' H: d A! _$ x& M% H
7 p" \! k2 z7 Y" K$ e+ \- static int acnt = 512;/ }4 g7 {9 y5 i
- static int bcnt = 8;
* G' g; c1 N9 F% E3 c - static int ccnt = 8;
/ {( P' N% G6 g - ! P1 T/ a6 y! L; G* f
- module_param(acnt, int, S_IRUGO);* @8 q/ z3 x9 Y i! \
- module_param(bcnt, int, S_IRUGO);
9 Y( g) {8 Z1 W' ]1 K - module_param(ccnt, int, S_IRUGO);
复制代码
9 X' J9 J+ G6 |$ P7 M2 ?
. _# b1 M( E. F- [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p( Y: y) V: t, B8 Z4 m/ A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ X: y4 z2 R5 `- O$ y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- W: v% c$ i1 E; F+ @ I% X
( @( v, K. h( V$ x0 A
5 h( ~) F+ ? I% _ |
|