|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " D9 ~0 B+ ~- z# ^$ h
- [code]EDMA sample test application% s6 I4 o$ j) y
- /*8 A5 K, G* n$ |* V; m2 E
- * edma_test.c
, M N, ~4 {. T' \ - *! z3 Y% N7 O- x o
- * brief EDMA3 Test Application( K' N7 ~) j$ b# m, q
- *
+ l+ R' p* O9 Z; d - * This file contains EDMA3 Test code.3 U: @* f0 g: Y2 p' Q# u
- *
- ]% L( G6 _# U' F T' ]: ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! r0 o$ T: E8 I. \, G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Q3 ^6 l0 R2 Q0 U- v) i$ K( O - * TO CHANGE.
# B4 a6 b# w3 H: L2 @6 ^$ ] - *
9 h6 j# a% H; m2 s5 }( ?4 D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% z% Q; _3 X' v7 q7 R* x8 }
- *- G4 o: {9 R- F) L# P
- * This program is free software; you can redistribute it and/or
D& J& \2 Z" W9 m - * modify it under the terms of the GNU General Public License as3 [ F8 C8 f; ~& r! c; G
- * published by the Free Software Foundation version 2.
; Z9 A' a( t, H1 h0 A! Z$ A - *' i: D6 c7 {0 ?8 V! \; H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# \4 r) M4 T6 V4 f) D
- * kind, whether express or implied; without even the implied warranty
3 o2 ~: o4 V `" r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ W1 o" I! b7 q
- * GNU General Public License for more details.
: ^4 @2 m$ s! |; x0 C& d/ V - */
% W d: f: ^- G6 ^; U% _, ]
' V7 l( G' y" T7 O- #include <linux/module.h> a5 d# s& y3 ]( |: p2 A
- #include <linux/init.h>
' Y4 `3 @8 y$ |7 A/ a" L - #include <linux/errno.h>; m+ p4 ~ O3 Y: o, q/ x
- #include <linux/types.h>5 R- |, m( S" H9 c
- #include <linux/interrupt.h>: ^" A( H" T3 b6 g, y9 y
- #include <asm/io.h>
. Q( |* j: Y$ N* m2 L - #include <linux/moduleparam.h>
3 Y5 }& _& v s4 w - #include <linux/sysctl.h>) C7 i3 Y0 J, l6 s2 D* x! _
- #include <linux/mm.h>
) p9 N! U F" ] - #include <linux/dma-mapping.h>& _5 x# S+ [! m
- ( F9 X/ v: [2 |' k
- #include <mach/memory.h>
1 h1 W! h+ B- T - #include <mach/hardware.h>
2 [: F3 ~9 k7 p; A" A - #include <mach/irqs.h>1 y( F2 y" V$ ^8 |/ J# h. p9 Y
- #include <asm/hardware/edma.h>
3 }& { R: z- x! W% M) |" C - & q3 `6 ~4 r) E7 T0 ?7 v
- #undef EDMA3_DEBUG
9 ^. g2 \# h9 `% v# [7 ~( Y2 G - /*#define EDMA3_DEBUG*/6 o" t% m9 Y$ b- c) T: [9 ^
- " j5 J; ?- g7 r+ x) ?( a: W
- #ifdef EDMA3_DEBUG
# o1 F) J5 l1 ?5 M3 L, I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' t" Q. \4 H" _4 J2 R* U, V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 b$ t% [2 B2 [- m; x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" {7 ~ |' Q2 o7 Z - #else- o: u& ~* }5 f7 E/ a4 |/ B, n6 {
- #define DMA_PRINTK( x... )! {6 r& H" e9 a
- #define DMA_FN_IN
% F2 Q! Z; I* c% W - #define DMA_FN_OUT
- q8 W3 i: P( X - #endif
2 z2 N+ U7 D( C7 O6 X9 _9 T; c
4 u. W( Y% J) ^ p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 E8 d( v$ b P5 K% E7 n
- #define STATIC_SHIFT 3
) k% X6 v; p' S' ~ - #define TCINTEN_SHIFT 20+ p& Q, s1 L# D! D1 f7 p1 s
- #define ITCINTEN_SHIFT 21, M" V% G, D6 n+ ]( G
- #define TCCHEN_SHIFT 227 z" M. }% K( P0 W a
- #define ITCCHEN_SHIFT 23
3 L; {, e- r- D4 V
3 j" q: y |' L8 r' q" r2 j- static volatile int irqraised1 = 0;
+ ~! n# D) ?! f" Z: i - static volatile int irqraised2 = 0;3 N- X$ b& L1 j8 D6 z$ J* J
" o8 o- C8 O9 K g: g* a$ p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 {3 O1 m: N5 J4 G( V2 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^: ^) v% n$ P9 a6 U: `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 I% T' j9 j0 N) O8 _9 [
+ G4 w" o* m3 W* n. m& M- dma_addr_t dmaphyssrc1 = 0;
* q+ h: E; q* Z. o, Y - dma_addr_t dmaphyssrc2 = 0;
1 B' C. E% \- E" o" I) u3 f& O' S5 ` - dma_addr_t dmaphysdest1 = 0;
) l4 G) k$ X4 b y9 a7 ^ - dma_addr_t dmaphysdest2 = 0;
5 S' X1 k8 Y: ^3 b, |* H+ a, [! ~ A - 9 m8 d# c4 t" L7 d: M. y0 O# W+ o4 r
- char *dmabufsrc1 = NULL;* n1 d7 @! i7 b6 k8 w( }+ }
- char *dmabufsrc2 = NULL;; G7 E G0 z& K6 T- z
- char *dmabufdest1 = NULL;
4 Y4 m6 g& D. f4 F3 M - char *dmabufdest2 = NULL;
* a, k3 W# J0 D' n& _ - 1 U, p8 c: M; H' ]" y) o: R
- static int acnt = 512;
) Y$ T& }5 r( H0 H5 {8 F - static int bcnt = 8;. c z* m: V" E; J; K+ x
- static int ccnt = 8;
4 o: }& h; V) U5 Z* t: ^5 j2 l - ' ?1 ]3 z" o; v" Z! k
- module_param(acnt, int, S_IRUGO);
/ [$ k" g% w3 t; b' A9 ~: o - module_param(bcnt, int, S_IRUGO);
7 j( j# ]3 M) x1 H* z - module_param(ccnt, int, S_IRUGO);
复制代码
9 g- C0 [. v$ }* S! j1 p5 s. q& k$ \- C% Q" n/ z3 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, V( v1 y( H' earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 P3 z: }+ X: ~6 T' I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" c9 J" O! z0 x! e' J: k1 V
0 ~9 n7 P+ L8 }% t [% \$ d
5 g6 ?/ y9 ^. X |
|