|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " O5 V K3 |+ X3 T' n* ~9 y
- [code]EDMA sample test application
% I' G( @8 `8 ~- v( x2 B* ` - /*
2 j! F! Y d3 \" ?) U- ~1 M - * edma_test.c% ]) P; W2 D, D4 t: Y( M6 @. Y
- *. ^ [ o$ i7 [2 w2 w. y
- * brief EDMA3 Test Application3 p, u0 S% S6 f
- *# O/ z+ v# M; J- ?) f6 |
- * This file contains EDMA3 Test code.: P; h# S! m8 u
- *- H& |& n" X. ~1 w9 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 q( T4 n. ^ A; M# f0 K2 c; r3 B( G5 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" @2 H: @+ }8 f+ F& M9 r, t
- * TO CHANGE.
; e2 V, t: [; e2 @8 X3 e - *
4 @" d. q/ P b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! l/ N# H; ^& \* G* t! d2 Q. _
- *8 ` d" H% p0 b5 m
- * This program is free software; you can redistribute it and/or
+ P; c$ V7 T7 e. R" G9 v( c+ P9 | - * modify it under the terms of the GNU General Public License as/ e5 v" @ j* e7 D
- * published by the Free Software Foundation version 2.& P' _* F$ ^$ q- y* e2 ?
- *
2 G4 F' q+ T% K# D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" _6 f5 r: T g0 Y8 n1 g I( {% m - * kind, whether express or implied; without even the implied warranty
! W& S2 _5 g" c, G. W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& k! V7 r) Z3 q% D( E% g - * GNU General Public License for more details.
2 H% V% d9 A& c& ] }2 B3 H. j! h - */
4 a! i1 U" S. Z) n% W - & O/ e8 u6 `$ u
- #include <linux/module.h>
5 b, K- p5 t. l' ?! g V/ e. j - #include <linux/init.h>5 Q/ N9 g( a; ^* y$ k) _) h+ h
- #include <linux/errno.h>
- ~5 M! O; W9 x* }8 \" @ - #include <linux/types.h>
% u7 K6 D: P1 t% M: E1 `' H - #include <linux/interrupt.h>
( i( c, O7 E6 Z$ D1 K - #include <asm/io.h>
% y5 J* s1 N8 d2 p& p/ ] - #include <linux/moduleparam.h>5 L% w+ \' [6 u5 t6 |! F: g$ P
- #include <linux/sysctl.h>
0 {; x' m A! @ w% r - #include <linux/mm.h>1 O5 h, V+ G7 D, g n
- #include <linux/dma-mapping.h>
# c4 n1 r9 I7 t8 e T# K - 8 t" t- k* R3 K* R+ k r) i
- #include <mach/memory.h>* K+ R7 _- i3 D" |) T- w8 [
- #include <mach/hardware.h>$ B6 d" p2 K' k, }
- #include <mach/irqs.h>, q5 M& l' [; y9 m) W. h9 I% U9 e- T# l
- #include <asm/hardware/edma.h>/ b/ ?0 }( F# u _/ o
5 C( ~, d; `5 Z& t. T1 ], F- #undef EDMA3_DEBUG
' f- W: ?5 G* I! D1 S- d( z - /*#define EDMA3_DEBUG*/& W( R9 r) T9 Z; c( |8 g- ]
- ) r/ Q* p0 @2 A. c
- #ifdef EDMA3_DEBUG5 B B/ r$ o. O' A* l0 N6 G% k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ w$ |/ I7 R' X& n% D4 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; g6 C+ R, m# b3 E4 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), q" G v' [* Z$ A5 F* X
- #else$ \7 }5 z* Y( A0 J: m; ?8 d9 i9 ?4 Z
- #define DMA_PRINTK( x... )
7 s$ ]/ B3 L3 }) r: v" n - #define DMA_FN_IN
9 B% V+ D# A) a2 R - #define DMA_FN_OUT( i0 I g7 R% b W( F M
- #endif
2 Q, X) m* q, w# K
) J. {# G+ e+ @6 Y8 K8 z1 X' Y7 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768); `. L1 @4 H" Z1 \% z: h! ^4 Y
- #define STATIC_SHIFT 3
# N" s: U- H4 S' m+ m - #define TCINTEN_SHIFT 20+ n& B+ L2 H1 J' E
- #define ITCINTEN_SHIFT 21: I( }: ]: T6 ]* a w5 V8 |
- #define TCCHEN_SHIFT 225 |1 R# E. p2 U! G0 a/ u! L
- #define ITCCHEN_SHIFT 23- N" i4 G5 @% G* R) O0 l* v" J
- : ?& V8 p. e% R" D/ o! c8 Q
- static volatile int irqraised1 = 0;
, W! N$ _7 _2 N2 t. U - static volatile int irqraised2 = 0;
: g* ~2 y, [* |7 M4 k5 p/ `$ N) C
0 @# b2 ?% W. i8 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 h# D8 p! @3 Z5 k- H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Y( A+ N- F8 Z; }( d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 O8 C4 [* ^' h7 O- {* m - 8 _) V: w* m. ^8 @
- dma_addr_t dmaphyssrc1 = 0;
: W0 l( a9 c2 h$ v; w, @% N0 Y: V! X - dma_addr_t dmaphyssrc2 = 0;1 ]* y( Y% n- v0 B" P! `
- dma_addr_t dmaphysdest1 = 0;5 p' Z, O# a6 v) M9 _
- dma_addr_t dmaphysdest2 = 0;; A6 V* m8 h! L4 S: W
- ; C2 T; x) ?) |7 f4 x4 t
- char *dmabufsrc1 = NULL;
' x& U& D( I5 r, z# J8 y - char *dmabufsrc2 = NULL;
. t, W) a( v* m6 O* p3 S - char *dmabufdest1 = NULL;6 {$ ?7 n f. h6 B6 ]# ~
- char *dmabufdest2 = NULL; N* P/ _/ s# n4 D0 |( c
n+ r% m% \2 M5 A' P! l- static int acnt = 512;9 D A5 u: K* w% J7 K
- static int bcnt = 8;
6 g: J- ?, O* t2 D, ?1 H! }/ \ - static int ccnt = 8;
. g \2 Q9 \0 h% o. A6 O
* R5 j. @9 u( G$ Z, x- module_param(acnt, int, S_IRUGO);
- w4 R/ y1 a4 u4 q7 n# X+ | - module_param(bcnt, int, S_IRUGO);% x% L8 m$ w% o+ g. ~) h8 v
- module_param(ccnt, int, S_IRUGO);
复制代码
5 ?% E' k( e3 D5 y3 n' Y3 ?5 P
: {2 y+ G1 m4 w; I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) H+ }+ v2 D# X0 z! K4 A6 _( O# b" L( [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 e# I% ?, V$ q3 |4 s& x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ n/ l& M& r) C' q* t- `' E
- @/ l! w) y; P! F: a" y) g8 Y9 ]- G1 \% z
|
|