|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 I% K1 r. ^2 f& _' l0 Z
- [code]EDMA sample test application! D7 b; f f" p6 E
- /*& g" `7 X3 {" R+ V* K
- * edma_test.c1 @( j- \( v5 E$ ]- p/ ?8 j; K
- *. h" N0 E/ A" w2 D# e: F: s
- * brief EDMA3 Test Application
! p6 C& w7 U6 ^: w - *
8 q& ? k- t( x - * This file contains EDMA3 Test code.
1 \8 ]( K/ T2 C! L - *7 m1 T( H7 w" D& \: D+ K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- M7 ]. Q( w5 t- H& s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: z* A8 b! R w4 s4 a( C% G2 Z: h - * TO CHANGE.. |6 c8 U, s1 ^3 b& O
- *& T) s% F# `4 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% `( C6 B- E' t
- *& w/ r- T# B8 \8 j9 C# S
- * This program is free software; you can redistribute it and/or
6 k" b2 H/ W, I - * modify it under the terms of the GNU General Public License as
( S! y6 J5 l- ?4 \9 f; M - * published by the Free Software Foundation version 2." D5 W% \, T: q
- *% B8 W& |+ I/ o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 R5 ?& t C3 t3 g' l
- * kind, whether express or implied; without even the implied warranty
# p! m$ J k! W8 i) w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ D8 W1 u& [, o9 t
- * GNU General Public License for more details." t8 z" @8 ?) @7 e/ c1 O
- */8 k- R6 g+ B, Z3 C
- / h# U6 ?) h0 G/ z/ {! @
- #include <linux/module.h>) ?, u5 R7 {, y. R, B. J T
- #include <linux/init.h>1 n5 R3 Y3 [; Y8 Q3 O. f/ v
- #include <linux/errno.h>
4 ]6 ]! s1 b; a" c" R! N, A6 j0 C - #include <linux/types.h>
! M1 r5 h& A }8 n& u! N+ {( W - #include <linux/interrupt.h># L: q7 R: q1 l6 X+ D$ D
- #include <asm/io.h>
0 c9 M9 K' V( }: }4 ? - #include <linux/moduleparam.h>
! c* y1 Y' O- ]% c, Q - #include <linux/sysctl.h>: R, z% `" |( i3 C- n/ s
- #include <linux/mm.h>! f# `0 H% C" ]; C( q
- #include <linux/dma-mapping.h>
0 q* q I7 z, _6 Q, U# D7 | - " X6 z Q" \, u
- #include <mach/memory.h>
; X( M- Z w, j% T - #include <mach/hardware.h>5 c Z/ y( h. E, Q% f0 `3 G
- #include <mach/irqs.h>3 d; v& d. |6 }# M+ G; Y0 X
- #include <asm/hardware/edma.h>, ?! O/ N) I2 @- B" Q3 |
- $ {( z. @0 V* K. q0 Q, {, f
- #undef EDMA3_DEBUG ]3 ^: i/ J, _/ G `( Z
- /*#define EDMA3_DEBUG*/
) l& ?) d1 b B! y* u+ G - ' o" E N; C7 D6 ]% V& Y
- #ifdef EDMA3_DEBUG
1 w/ J- m2 A; \" ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 `$ \) d4 e: Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* k0 ?, h9 j1 V5 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" E6 ]2 k$ x x8 T - #else( D2 x& D- S1 y9 o9 B: ]
- #define DMA_PRINTK( x... )
% H$ f5 R( b5 h! z8 @7 } - #define DMA_FN_IN# M7 C" X x9 H+ C0 T
- #define DMA_FN_OUT: o- X0 i5 E* A Y3 A6 Y0 ^% l( j- P A, n
- #endif$ v" U D( l2 w9 T- Y+ G: {
- 1 {! S- I! _5 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* T) F( \) l- j8 V
- #define STATIC_SHIFT 3
+ S! J! I! n; J* E' L, | - #define TCINTEN_SHIFT 20
$ A; Q* t8 w: o - #define ITCINTEN_SHIFT 212 x. V- r& N! {" l
- #define TCCHEN_SHIFT 225 b, h4 I2 y3 d; t; f1 \: t
- #define ITCCHEN_SHIFT 23; ]: b, U7 U1 Y' b# a) ?, O/ p
- , i: {- j0 M( R' b
- static volatile int irqraised1 = 0;
2 A! |0 S( w# v6 d# x - static volatile int irqraised2 = 0;2 T# y* Y* P6 m8 [) k
8 y) U. N' O* T% z5 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ~" [2 R5 R2 E& ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 y9 p2 T- _' K3 V- W+ S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 K; }/ z J3 e& ^; j% d - & u8 V' G! E! Q `/ w0 A
- dma_addr_t dmaphyssrc1 = 0;1 @$ k8 m1 Y$ t2 w% I* E( h7 z
- dma_addr_t dmaphyssrc2 = 0;
. i- @; v) P- ?( r$ Y7 O0 c. D3 _ - dma_addr_t dmaphysdest1 = 0;5 s) j( M( ?7 \- k
- dma_addr_t dmaphysdest2 = 0;
8 L! `; D6 t% n' o# b9 j% Q - $ f$ {# }' J# ]1 s. s8 e4 B% _
- char *dmabufsrc1 = NULL;5 g5 L, Q) ^* c1 F* Q
- char *dmabufsrc2 = NULL;
+ o1 U- B% F9 F; N- d+ [8 ] r - char *dmabufdest1 = NULL;& H6 _! @- p/ _/ q) D8 r9 e/ n
- char *dmabufdest2 = NULL;1 J# W A1 }& |; c
- " o5 ]% r8 k$ F& f( n) [8 F
- static int acnt = 512;
5 m5 g" g9 T! z/ R - static int bcnt = 8;
6 `6 A" i! u4 U, { - static int ccnt = 8;
3 T" t7 |* m; m6 G - & Q9 E. a2 d$ m. v# {& N: Y1 l7 s
- module_param(acnt, int, S_IRUGO);
8 n2 `' G% J8 z* w$ b - module_param(bcnt, int, S_IRUGO);4 W# a3 X' a; R/ }! x) u8 ]
- module_param(ccnt, int, S_IRUGO);
复制代码 - v4 i9 i2 `7 U' Z7 B4 m8 ?2 V
" M) ^" b4 E# l. c! @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 R* M' y- ~+ Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, w7 e6 S8 o8 k$ F, [. {3 D, m0 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. |6 k+ t W1 J+ m( Q
7 r* y; l5 m* V* H; S) @. s. I( g$ y+ L& g, ^4 \8 e" V0 h
|
|