|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " K) q% ^, {% ?, e1 G ^# [, y! T
- [code]EDMA sample test application
, J1 q1 L2 h/ y7 F - /*
5 v9 i' R, B4 x* I9 b6 ~# S - * edma_test.c8 e" V) @, ^6 t. b9 d! V( e
- *
' E' y( r& s6 H: n7 } - * brief EDMA3 Test Application |; h i, d; A, Y0 r1 U
- *
& J) Y* u0 {7 f( M" Y - * This file contains EDMA3 Test code.
, E0 C% s6 f# Z2 j6 Z+ L - *
: K5 m- v9 T9 q- a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; [4 G) }( K' Z1 f- x4 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 F6 [, z" P; v8 i" l - * TO CHANGE.
( x) m+ N: X+ r9 i6 M - *
( f+ z& z/ Q& c+ [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 d/ o( T+ s' W( O3 T - ** Q/ n! w7 u; X3 j! R/ B
- * This program is free software; you can redistribute it and/or
2 D$ J6 i8 N: u+ Z - * modify it under the terms of the GNU General Public License as
( `7 D5 _$ p K6 V; V - * published by the Free Software Foundation version 2.5 j2 e/ K4 [7 f
- *
9 j6 f5 Z9 }8 H2 ]; i2 i' \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 S! E4 p2 ]4 y4 W: M1 } - * kind, whether express or implied; without even the implied warranty
2 k) ]2 q+ R" a( M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( O: |1 b) ~2 L* \1 H - * GNU General Public License for more details.9 k7 A g+ b: D7 p/ o
- */
$ o) J9 N( Q. |" z) A% ] [* k
* d/ x t/ c: Y- R" q2 W- #include <linux/module.h>; _1 E1 o- c4 W: A8 u
- #include <linux/init.h>
! a) Y( J) h- q - #include <linux/errno.h>5 ^3 v4 R6 s% K
- #include <linux/types.h>( {; R( ~$ [, n- C2 X' y
- #include <linux/interrupt.h>
7 b R4 }$ t# o: T1 R6 r' l" N - #include <asm/io.h>3 u. P' N/ l3 q6 {: h5 v6 |; B
- #include <linux/moduleparam.h>
' x- F/ s8 H+ g/ h9 a- ]* L - #include <linux/sysctl.h>
: D% f1 h: ]! k, t' w P, h, i$ I/ S - #include <linux/mm.h># ~- b( O( [# n; O% |
- #include <linux/dma-mapping.h>
4 l; ^ B; H. ]
, j7 T7 R L1 v/ Q. h% x# F- #include <mach/memory.h># P! a2 _2 n$ m% H/ v
- #include <mach/hardware.h>
$ z. z0 `; x( e" n( K" Q - #include <mach/irqs.h>1 e0 V8 o9 u- l! ~; G
- #include <asm/hardware/edma.h>1 k- _7 t$ ?4 d3 j
9 g2 i8 ^5 |2 y+ _- #undef EDMA3_DEBUG
' {% x; ?$ m$ f - /*#define EDMA3_DEBUG*/* U3 E; \2 P% ?
" f1 p1 y- \- S- Z- #ifdef EDMA3_DEBUG
, a+ T; x, J+ L' k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% E! T m1 w- d0 Y/ A* @1 c, K/ d3 f. X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 B. }4 F" p- Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! k4 \& j& I4 k - #else
, B: N+ J+ o3 N" B- o3 B5 H - #define DMA_PRINTK( x... )0 m/ Z0 L! m. P ]
- #define DMA_FN_IN: V2 W4 G: W) ^( v5 V" h% Q
- #define DMA_FN_OUT. P/ L9 y3 n h* u# R# r3 J1 y! {
- #endif
4 c1 k1 u/ Y' D, D& w( g% t! u' q
( {% n3 Y& t0 {9 \: f8 l5 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% i0 i! P! k0 ?, J - #define STATIC_SHIFT 35 R: [+ n+ p3 H0 K& U+ D$ q
- #define TCINTEN_SHIFT 20
% p' N+ j/ Z& ^3 m5 u - #define ITCINTEN_SHIFT 219 T% ~( }/ f6 m) w z
- #define TCCHEN_SHIFT 22. k9 y$ j, k/ E& E# N [1 h
- #define ITCCHEN_SHIFT 23, A2 a/ O9 h7 ]. n/ [
. L+ W- c" N. E* Y# e7 n4 ]- static volatile int irqraised1 = 0;
8 m3 N z. ?3 e1 G- a' H* @& J" e* i - static volatile int irqraised2 = 0;
( t) q" S9 H- u6 T7 f
$ p* g$ t% O4 b n& `; W& C% Y9 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n1 n0 u; L: s$ v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); K" m* `6 ?! j$ M2 q4 `( N/ E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! q2 H6 S# U6 ^/ e: b! E7 X' l - 9 y) a; {5 Y2 `& W/ c h
- dma_addr_t dmaphyssrc1 = 0;# d7 V2 p4 ?' x9 @
- dma_addr_t dmaphyssrc2 = 0;' a# i2 E: A, s( D8 l* O
- dma_addr_t dmaphysdest1 = 0;
* {7 C: J2 M ?* L# q8 u, a0 O - dma_addr_t dmaphysdest2 = 0;
, o6 v( C& {: P$ [% l& F3 r - 2 j! R; c+ Z* `. ~
- char *dmabufsrc1 = NULL;
/ J% O+ P+ d, S7 O- _: O3 b - char *dmabufsrc2 = NULL;# R, t% [* a: h
- char *dmabufdest1 = NULL;: _1 B3 r" N6 I; F' R" f
- char *dmabufdest2 = NULL;" a7 @3 q, ]5 b: P. t7 @0 ?; S
- : Q/ c- D8 H! g$ v( a! Q0 E; k
- static int acnt = 512;; A Z) M6 Z1 @# B# P! D
- static int bcnt = 8;
8 z; L4 _" Z9 Z0 f1 w3 n - static int ccnt = 8;; F. u! i1 T( ^
% w/ a \: |5 |; f- module_param(acnt, int, S_IRUGO);! X) @: I& p0 m. U S; d
- module_param(bcnt, int, S_IRUGO);! K5 P# I/ U* ?; g6 [
- module_param(ccnt, int, S_IRUGO);
复制代码
6 Q- J6 y+ i- [ T+ Q5 J6 w: d/ q/ f
; V2 u3 Z/ X5 ^$ ~: Q4 r1 C+ V3 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! v" s* [1 ?/ B$ L/ W; Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 {# v/ Y c7 E2 V) W( C0 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 _2 A/ k2 I) }& @2 P0 V3 _" l
2 n% T( G1 E& ^9 C, {) }9 O1 X$ H) }( O- G) j$ M5 O
|
|