|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 p3 h2 b4 r4 G8 o. f& X' }- [code]EDMA sample test application# U& E; L$ o7 P9 }: @8 x( @; y9 B
- /*' b ^6 M% Z! c* E) i; P( S# n9 n
- * edma_test.c9 Z& k% ^2 q% f) b# P+ Z
- *6 z1 ^/ z1 r6 M0 Y. z2 U
- * brief EDMA3 Test Application7 O" I7 E9 r+ o) B7 `% N4 O. o
- *7 W4 F+ U9 C: F! ~0 ]$ {
- * This file contains EDMA3 Test code.
% n" \- Y9 @9 L3 }; s - *6 L6 u. ?$ \2 a7 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 {) I& m) p* P R2 B" g! N; [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 Y! r! G, M2 d1 o: g6 @ - * TO CHANGE.
3 @( B8 s* f: x! e - *
/ ]7 K8 @0 K/ d5 t: H/ b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 y* L5 d; M9 }( d5 M4 }
- *
( x L) n# A! W9 n: c - * This program is free software; you can redistribute it and/or
5 `+ e& _3 s A. ~- j7 O. ? - * modify it under the terms of the GNU General Public License as! s Z- c! t+ B& d' @/ y5 W0 \# P
- * published by the Free Software Foundation version 2.1 @$ l! p1 a+ U. {/ y9 f; U4 E
- *2 B5 M3 r* u1 M+ b* E. i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' {( x- z( p% P5 O/ h& Q9 r0 i. S - * kind, whether express or implied; without even the implied warranty
! C! d4 }8 d7 P( X$ @, F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ^( O7 t% Q2 P7 C7 R& X* r - * GNU General Public License for more details.
2 \: ^8 C- E% i" V& Y - */
" k6 F+ J# H$ K+ Q - 0 D$ @% x2 }3 `/ i3 E f% `
- #include <linux/module.h>0 ]* ^) A, [& V( G# d0 B/ S
- #include <linux/init.h>8 Y8 a2 A$ F! M& O* V3 a9 n
- #include <linux/errno.h>
$ G5 L2 \+ x" p& T4 B - #include <linux/types.h>
; @! R8 ^; R: m2 O a& Y - #include <linux/interrupt.h>
" ^6 m* N! Z* `2 \% S - #include <asm/io.h>6 C( k& p/ P/ B! E# P
- #include <linux/moduleparam.h>+ f/ B. i, N5 e$ P0 O
- #include <linux/sysctl.h>; Z4 U, j& B( K+ t5 w
- #include <linux/mm.h>
- x9 d2 i. a' N. g6 ? - #include <linux/dma-mapping.h>- U* L) a0 z4 J: F; Z: C5 Z |
- - x# x" b' M( b: [- v
- #include <mach/memory.h>$ A/ R, W1 e, H* z$ w0 }& L
- #include <mach/hardware.h>% R, d/ y, D0 y2 E0 I z
- #include <mach/irqs.h>9 r" x" |: X, U! P
- #include <asm/hardware/edma.h>9 P1 N, f% \' l" | F3 u
- % r" e# h+ Y7 j* R
- #undef EDMA3_DEBUG
5 G3 D: m1 i3 _/ c' z8 S - /*#define EDMA3_DEBUG*/
" W% A0 L/ C! x) O2 o' X+ r
' G8 d& J# f5 A- #ifdef EDMA3_DEBUG! p$ `# X1 K4 g1 S( i/ [/ i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) r b- G+ q: ?* _5 b) V9 a: t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ j) P& @8 H. B4 ]3 A4 a; G/ | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 ?: p1 b" z( H+ a2 b - #else
% i; k T" q9 u( ` X7 |8 h - #define DMA_PRINTK( x... )6 `6 y2 \# w# e* L8 b% F5 l) y b9 }
- #define DMA_FN_IN
3 a2 Y% [: Q( G2 H% w - #define DMA_FN_OUT$ y5 R, Q' `4 J5 D& N# l
- #endif/ k" P1 L/ y! F# h5 j% v
4 G2 F$ t1 J4 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 R; p& @9 T6 u) }$ `2 S - #define STATIC_SHIFT 3, x2 q8 U* L$ H% e- L" M
- #define TCINTEN_SHIFT 20
2 N5 N* ?$ J0 J, s! w" T( m( t - #define ITCINTEN_SHIFT 21
. d" }8 i1 a+ a2 v# d5 [4 S- _ - #define TCCHEN_SHIFT 22
! V8 b6 Z" I: w: n+ t9 w - #define ITCCHEN_SHIFT 23
2 c) J7 g3 i, u0 F( n. O% U
% |' l7 k! z6 R5 h/ M' q- static volatile int irqraised1 = 0;8 I9 I6 x2 _( M- T' \3 N: Y/ U
- static volatile int irqraised2 = 0;4 _* y% r1 g3 [) \" L: t
- 3 m5 }; s. c8 e2 y: `, \* O" o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 N$ L3 ]/ K2 j. e4 Z- J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 i, F/ g0 y6 e& x/ Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 X0 s% r2 Q# M
- ' y# o" z6 j' B, g" c; P/ j4 `
- dma_addr_t dmaphyssrc1 = 0;/ R3 D6 `+ S5 i0 U7 T5 ]& `
- dma_addr_t dmaphyssrc2 = 0;
* V3 z- l- E2 G7 o8 K3 n - dma_addr_t dmaphysdest1 = 0;
1 |+ R9 X2 `0 e" K! X6 Y. ^8 p - dma_addr_t dmaphysdest2 = 0;
* z' U$ i) [: O
9 ~$ H( ~/ [+ X7 H- char *dmabufsrc1 = NULL;
# t6 D; i0 S/ z7 F, U- H: ] - char *dmabufsrc2 = NULL;+ R5 p% R# D. B( z
- char *dmabufdest1 = NULL;
0 ]- Z( ?) s8 z T - char *dmabufdest2 = NULL;* I1 M- o7 Z1 l# ~
* h6 X; [* k: B( i- static int acnt = 512;
( H0 q) Y$ q) y" J! R. i - static int bcnt = 8;
/ @+ r: m0 d* o% p - static int ccnt = 8;9 B. F2 w( g: j6 E- P0 G- t2 H
- 0 {8 s1 j( ^* r7 E% F
- module_param(acnt, int, S_IRUGO);
7 G8 R# q7 s6 t9 \8 v) \3 W - module_param(bcnt, int, S_IRUGO);
# c: J7 n {9 T8 ]1 L) v7 a2 F/ ^ - module_param(ccnt, int, S_IRUGO);
复制代码 # D6 x! M- |3 K4 w+ q1 \3 I2 ?
# O+ |1 l% F4 V9 b s3 u' k- q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ?5 a; g0 ~( z2 H* f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* }8 c: \! `1 Q3 p4 m; V/ p0 i$ ^0 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. S, \. ?# G5 B' t* A; e7 f0 `. A9 n; C( e# c$ }4 u, z
1 K2 R5 Z/ Q% Q9 M. u |
|