|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 _- y; Q) t) U ^% y! \; S# C. V
- [code]EDMA sample test application- _# Z! Z) ?, W
- /*9 N" U' X' B$ x+ d( V" s
- * edma_test.c' A& y, V8 U1 `$ u% D. N* l0 a
- ** U6 \, h! i' F6 H, J
- * brief EDMA3 Test Application, ]6 Q& l9 R- g5 c
- *
/ l3 z, U0 V' x/ G8 C& `5 F- q0 b - * This file contains EDMA3 Test code.+ Z9 u+ `& \4 c0 }$ w
- *& c: H# O" A( p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 j# C7 j. Z+ k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' _2 {: L# _, C* N! A - * TO CHANGE." b1 I( h" R( W1 H: |9 z
- *
/ S( j* B% e% H. D' @; N7 x, _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// U# D4 M5 E9 f; k+ d8 g
- ** S7 ^( N4 P* M
- * This program is free software; you can redistribute it and/or N R8 P+ c7 m7 p$ u
- * modify it under the terms of the GNU General Public License as5 | `2 s8 I, [$ {
- * published by the Free Software Foundation version 2.
# J# [" P8 Q: U" t' F2 W9 y - *2 M$ t- H6 r, L& L6 H$ H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) B% @5 `' Z5 N4 G8 S* H
- * kind, whether express or implied; without even the implied warranty
; t! @% O# o1 \" O! g C' Y! d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ^4 E, v) I* N. ?
- * GNU General Public License for more details.
o6 r3 D% Y. B6 S/ `% _+ W5 H - */5 f, o2 J5 g: W' @& E }
- % H5 Q S& _3 R/ {4 H* s: s* r
- #include <linux/module.h>0 g D. l* o/ _8 c3 Z
- #include <linux/init.h>
( W5 S ~6 i' Z7 t8 V+ J& h9 L! j B1 Y - #include <linux/errno.h>
" m7 P, h6 A: Q5 I - #include <linux/types.h>2 }1 J" g8 A Z- H
- #include <linux/interrupt.h>
# i! V) g: A+ t" Q, x - #include <asm/io.h>$ H' j8 c0 m1 g1 l ? T( x
- #include <linux/moduleparam.h>
& d8 F9 J+ D- s" ^. k5 a4 q* m% d2 H/ J - #include <linux/sysctl.h>
4 ]( w' G! A" D7 x - #include <linux/mm.h>
# _- \: U$ A8 f: I7 Q - #include <linux/dma-mapping.h>1 ]9 H$ w2 `% N) ]
8 o- _& x2 f$ {, Z- #include <mach/memory.h>
8 |* m0 m9 `( w, B - #include <mach/hardware.h>
; Y# d) N. D' n% A# [- i9 a - #include <mach/irqs.h>, e S. @, b0 [* ~' C( n( ?8 P
- #include <asm/hardware/edma.h>* @9 Y) D3 `; L# }3 C* V* e5 G- N
D! A' s h# f7 k* C4 d. t- #undef EDMA3_DEBUG
5 E9 W3 [( |. D& @9 s - /*#define EDMA3_DEBUG*/! n- ~5 _. U, {8 h
4 X$ E. F, d8 Y+ s- ^# l+ M- #ifdef EDMA3_DEBUG
6 D; R* W8 a6 F1 l4 n% X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) L2 P% K$ `5 ?% V, ~6 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u- @& u- d I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# q( ^7 o8 \2 i; g: b - #else2 K/ \3 ~) J: |% s) ]/ y
- #define DMA_PRINTK( x... )) M) `9 Q3 f D5 ^+ N( i
- #define DMA_FN_IN
. s# e2 w- }6 Z% \% e - #define DMA_FN_OUT
9 F# g) X1 u/ V4 p7 A - #endif6 m5 G( S- D0 P6 v% p! H
4 H2 R6 o) J$ i- I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 ~ z4 U* v0 J6 Q - #define STATIC_SHIFT 3
# H* m* g/ s& p - #define TCINTEN_SHIFT 20
5 |, N3 K' s: |: ~- P% w - #define ITCINTEN_SHIFT 21" l; \) y# [- a# q# | W
- #define TCCHEN_SHIFT 22
3 p3 v0 j$ v" D1 X4 B. Q - #define ITCCHEN_SHIFT 23
2 ]4 E7 _7 o, i0 C
/ ?! U" V6 ?7 k( j1 L% H8 R- static volatile int irqraised1 = 0;, s A d! j6 C' _2 @- K$ n* u
- static volatile int irqraised2 = 0;
# b7 u4 r" r0 f/ y9 }+ H
* w0 @% N; v0 p# j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% b5 W8 l+ J* s, N' y! V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 T" Z. p5 W7 ]7 Q/ ] V- B, B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); s8 K2 p9 k6 E
- # Q0 G3 P; t6 w( j
- dma_addr_t dmaphyssrc1 = 0;3 [2 U# G4 [- g- o; l9 T
- dma_addr_t dmaphyssrc2 = 0;; j" O3 \* M6 j# e9 `3 L2 v2 ^: m
- dma_addr_t dmaphysdest1 = 0;
. v ^# ]: _& t5 y - dma_addr_t dmaphysdest2 = 0;, l! h: \* |9 g) r1 e! w" I
* h& V5 i& Q1 W6 p- char *dmabufsrc1 = NULL;
1 v- l+ i3 H. @+ s- B4 m - char *dmabufsrc2 = NULL;
m! |) \- |# K0 Q& f4 n" x - char *dmabufdest1 = NULL;
5 Y7 n, _: y$ N# W - char *dmabufdest2 = NULL;* \& H3 _$ P0 }8 g. }% p
8 `9 |9 N: \7 k, w- static int acnt = 512;+ L% H, X. ]8 E& S* b b/ [: t
- static int bcnt = 8;+ o0 M* `9 ~$ V
- static int ccnt = 8;, X5 i% d: I6 K6 J
- M8 e h" Q% N/ s- module_param(acnt, int, S_IRUGO);. y' t0 y7 q- }4 Y) I, k3 y' e
- module_param(bcnt, int, S_IRUGO);+ ]0 `5 a7 @( Z& {+ T/ w4 J
- module_param(ccnt, int, S_IRUGO);
复制代码
2 I: V) V& d! ?4 z5 E8 X2 I, h$ o: A
& u! W3 l* j# K4 X, ^% e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ]; k' w( T; ]5 v, M( U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# K0 i/ @$ E* m* R) S5 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 N. S$ C2 l; ^1 c% V7 r: I/ Q: C, s7 N4 n
: Q# D: w* ` x/ ?$ f0 {0 O |
|