|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , e& `3 O- d8 L) b: z
- [code]EDMA sample test application
3 p4 V, s- U6 T& R) e - /*0 K! Y ~7 X3 Q% n
- * edma_test.c) V1 F3 N+ l4 m- l" D9 Y
- *
% y9 e7 K2 O3 i) }5 B* N( ~' t - * brief EDMA3 Test Application
0 m# ]1 \# l. F @+ I i - *
) H. L: v, B; f( J - * This file contains EDMA3 Test code.: W4 s; h' g) R( j/ i
- *0 q5 @3 f+ i& _* d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% N2 @) ~3 m4 B6 B: o4 O8 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D3 I! g1 t$ R0 h
- * TO CHANGE.
1 h, o* I9 e7 j: K! v( v) x - *7 |/ D2 B2 ~9 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ `6 D: @3 e1 |9 W2 F4 E7 E - *
0 {# H# X8 x: ^' C \, V - * This program is free software; you can redistribute it and/or" Z; c# n6 m; r& o: w$ |
- * modify it under the terms of the GNU General Public License as. K7 W0 E$ d. e3 v, B$ ~
- * published by the Free Software Foundation version 2.
' C! V% H7 c, H - * r& k( T6 M' o9 P, }2 @+ X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ J3 [* t5 v- K1 L1 a7 K) G - * kind, whether express or implied; without even the implied warranty
. m9 S6 E) G: G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 V- E' B" q2 s8 `$ L3 O% e2 O
- * GNU General Public License for more details.' t% x4 o. [# d: C
- */
4 a4 H% D x8 a5 T - : J' \2 b! b$ r# Q% z' H( R
- #include <linux/module.h>& s6 _3 X8 C# Z. o. x
- #include <linux/init.h>
5 o) r+ [2 z2 W# @3 r, k+ | - #include <linux/errno.h>5 j* L+ E7 u1 w' w4 @
- #include <linux/types.h>. Q& F$ b. k, K$ k. |8 ?" l1 ?
- #include <linux/interrupt.h>9 d" R3 _6 A+ f! ?2 I
- #include <asm/io.h>9 R. E1 O) d6 S% z3 @& ?9 y
- #include <linux/moduleparam.h>
/ h3 {5 i1 _3 M2 B6 n+ S9 T1 P - #include <linux/sysctl.h>1 B4 v4 s4 @% H
- #include <linux/mm.h>2 Z; J) U- n5 O
- #include <linux/dma-mapping.h>
7 i0 }$ W F+ \; i0 e
. m/ U; e1 z% ]* z( N, T) n- #include <mach/memory.h>
+ ^4 U+ O; q+ L- g" ^( P - #include <mach/hardware.h>3 c* ]7 Q7 I) r- j- G' b4 Y. U
- #include <mach/irqs.h># N" n4 _% K. E2 E- p& c/ ^2 ?
- #include <asm/hardware/edma.h>
2 G: M9 S9 Q6 Z; C# n
6 T& c: C* ^4 H9 y- #undef EDMA3_DEBUG
8 r1 z0 N' i' C+ D% b - /*#define EDMA3_DEBUG*/
% Q) B# D$ y! E0 E5 z - 2 ~1 B8 _, W' n" r2 Y
- #ifdef EDMA3_DEBUG
5 S8 \2 u: D0 y X1 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( Q* S" O. ^' b$ e, i7 r( ~" `0 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, V, v6 ^' {* G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ Q. a* U" [; l9 I" F: g - #else
* E6 J. Q' d9 L* E4 |. e6 u. l - #define DMA_PRINTK( x... )9 u4 [- `1 p: s) s6 X# N
- #define DMA_FN_IN7 j i) F. o! w( f7 |' U
- #define DMA_FN_OUT
" a8 O; t% K8 Y: v. u) x - #endif6 Z$ l! W5 ^" T: F! q
- C' r- t2 Q' C! @5 @2 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ r: Q: c: R' Q. o0 b# x
- #define STATIC_SHIFT 3
6 d% e* ]6 e: e; F - #define TCINTEN_SHIFT 20- E: B/ g( _( e! U' Y
- #define ITCINTEN_SHIFT 21
: C" s6 v* d' k0 w - #define TCCHEN_SHIFT 22
( K# B+ c8 H# C9 c - #define ITCCHEN_SHIFT 23
+ W/ {: X$ f/ X2 z J. C
0 V8 K* n/ U6 e9 z6 C- static volatile int irqraised1 = 0;# G6 v- f& d w! a
- static volatile int irqraised2 = 0;& a9 }/ P% q: _' w5 W
( Z0 R! r! e' Q" b3 n' G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Y7 Q% @5 I/ L0 k# t1 m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" E$ v6 X3 [1 C( z% X: T# G6 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' j7 j) ?: b' c. c4 F% W - 0 @$ {, I- j6 ?, A2 r
- dma_addr_t dmaphyssrc1 = 0;
' ?' A- R8 ?( x4 k2 M D - dma_addr_t dmaphyssrc2 = 0;
, i: s" s' v" a! b* A- T) M - dma_addr_t dmaphysdest1 = 0;
+ K4 D) }% c2 u - dma_addr_t dmaphysdest2 = 0;
4 P3 q3 ~/ z4 U( K2 j- F - % F. g% G0 n# E: p4 J. t
- char *dmabufsrc1 = NULL;; Q% r9 d4 e: d* n3 G3 p7 R
- char *dmabufsrc2 = NULL;
z! K. d" s- I( |# o' S7 ] - char *dmabufdest1 = NULL;
+ O! i9 B) S5 T% Y$ U7 P - char *dmabufdest2 = NULL;
' Z" X3 |) N0 ]6 g `' I2 ^ - , c5 Y. f7 O# n
- static int acnt = 512;6 J/ j' N7 C( A" s
- static int bcnt = 8;
9 e1 i; J/ N% s5 A* t - static int ccnt = 8;* U" w% B5 y' i$ v7 X
- 5 ^ {' n2 r: o, w: ~
- module_param(acnt, int, S_IRUGO);
! A! w: m9 O. I ~5 f. C - module_param(bcnt, int, S_IRUGO);
* y, L a. U& W - module_param(ccnt, int, S_IRUGO);
复制代码
- Z& {% v" ^& y2 G) H7 _1 ?" k+ x, l0 m2 G8 v' T9 o# B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# }% I/ r" @4 D$ T$ D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! F q1 q, z! r# j; W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 k$ I7 p% P5 T- _
( L6 ?: H. }6 H% E& A$ a* R2 R- E0 g+ T; [6 s) S, L
|
|