|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 u* ?( s5 i, }. n, u. N9 l9 P* X- [code]EDMA sample test application! S1 b4 w8 k4 I/ N
- /*
; _* B7 x, i% ?) E - * edma_test.c" N; w# q3 H. a8 u
- *0 T& n& F6 s7 d G
- * brief EDMA3 Test Application
' N7 _3 W. ^ T& v - *& S H/ a1 V2 m( ?8 x2 }- {. v" N; ?
- * This file contains EDMA3 Test code.! ]# v/ c. M) |" |
- *5 a; k* ~9 T% q7 [* v# d, g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( |6 ~9 w2 ^ Y9 ^% D' P1 C; Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: S+ k2 a; ~( w. S' G3 L! v
- * TO CHANGE.
6 u5 i% l" E+ T - *% b C$ V4 \; h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: n! r; t8 D# U8 h! d3 A
- *
- p v, ]! v# N! T+ |& Y - * This program is free software; you can redistribute it and/or( y6 D, L" L) T( l
- * modify it under the terms of the GNU General Public License as) x5 R# o4 x6 R) X+ F
- * published by the Free Software Foundation version 2.
) P4 D) D/ G% w5 G$ [' ~ - *; f4 F$ r. F/ K, i& w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 \# k$ z/ {% Z, O1 w5 J4 h- a# _6 u - * kind, whether express or implied; without even the implied warranty
) O' t4 ]& }2 L$ `3 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 O& I/ s0 }7 y8 p! x) ` I - * GNU General Public License for more details." J5 c: G' U8 f2 ]; }4 Q
- */
h4 o4 P2 [% F$ R( u# ^; J0 w u - & @6 F2 i, I0 h" q* P
- #include <linux/module.h>3 u: I; J1 U$ d5 g
- #include <linux/init.h>" S. P) j6 [2 h* } M a) F1 ? u, ?
- #include <linux/errno.h>
& a& w6 Q& f, x! ]+ W! T7 W& _0 l - #include <linux/types.h>2 _2 t3 ?4 J0 J G
- #include <linux/interrupt.h>
! m9 r( s9 o Z% `" c& l - #include <asm/io.h>% T5 x' w& q) S1 F/ d" m
- #include <linux/moduleparam.h>0 f! C' S" v0 z& ?& a6 E) h. W7 {
- #include <linux/sysctl.h>
. j2 X, `: }5 i - #include <linux/mm.h>
! N0 t. B, v& i( a - #include <linux/dma-mapping.h>
7 N$ @. A4 W) |, t
5 u L n, f% g- #include <mach/memory.h>" Q7 Y) z7 r" U5 u3 u
- #include <mach/hardware.h>
1 H' n9 r7 Z/ U2 ~ - #include <mach/irqs.h>% S" n) `6 K/ S/ u
- #include <asm/hardware/edma.h>
0 O# \5 T0 f% z4 F( Q
' ]) g% Y. U& x- #undef EDMA3_DEBUG' O8 h6 m9 n$ ]/ P! C% S3 {
- /*#define EDMA3_DEBUG*/4 M" z# s, n# B
- 3 G/ {& }" Z @
- #ifdef EDMA3_DEBUG
6 X1 }% ^5 I/ k1 Y+ K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( T6 G% @8 U2 I) X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 f- N/ V5 n1 }' |8 O$ Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 g- k3 |& F" ]0 S% f, b A) t
- #else2 C( N1 Q' C. u) V6 N( i) K
- #define DMA_PRINTK( x... )
8 e3 a, i$ P* D- }/ l - #define DMA_FN_IN$ z- u+ @ M' H% Z0 }
- #define DMA_FN_OUT
, G0 r; b, o R4 g9 ^4 M/ y! H - #endif! E6 _3 n Q, D+ L- I/ \. R
2 m6 S0 i# ~ r C2 u% F" ]* R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! v; x0 y; H6 u `7 m4 [
- #define STATIC_SHIFT 34 v0 T" ^3 n: h/ ~. ?
- #define TCINTEN_SHIFT 20. T# v6 k2 N1 d( I A
- #define ITCINTEN_SHIFT 21
- n+ D+ z* s. J5 F$ x7 V - #define TCCHEN_SHIFT 22
! c( Z' ^* k3 C - #define ITCCHEN_SHIFT 23
: [: S! `2 E8 j" t" C - 5 y* ]; q# K3 p) N; c6 |/ p3 Z
- static volatile int irqraised1 = 0;2 U8 v6 {3 V1 Z" C! v( I
- static volatile int irqraised2 = 0;8 ~# F! C8 _, H& T6 f, y
* c" Z" ]; f& \, |- ]8 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ r1 D6 g, |4 \! B) M/ \$ u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z3 n% U( f' L9 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P2 c8 y- Y. ^5 ^, L5 t- |
! ~8 z- J; i3 X; @ ]& A- dma_addr_t dmaphyssrc1 = 0;
! p+ n' K3 a+ V8 G% `- o - dma_addr_t dmaphyssrc2 = 0;" R- ?) h1 b9 E" m0 k e: F3 g
- dma_addr_t dmaphysdest1 = 0;4 D3 j/ w5 B4 F6 }2 o& D' C
- dma_addr_t dmaphysdest2 = 0;" K/ |! \( k" a3 m
2 G* V/ [& p) S& G: m- char *dmabufsrc1 = NULL;. k+ b4 [0 f( H) o. Z4 f
- char *dmabufsrc2 = NULL;
4 E. z6 D, A6 Q) Y - char *dmabufdest1 = NULL;
8 C/ ?/ ]- d$ V/ G - char *dmabufdest2 = NULL;1 n) l8 y$ v8 X* z
- 4 b9 g; }! ?$ |
- static int acnt = 512;4 u9 {* G4 f( K6 H- N1 `& n0 Y; b" j
- static int bcnt = 8;1 K+ m" A& o( }; o
- static int ccnt = 8;
* v7 t4 ]* ]3 u f+ r7 L - 1 r6 {9 D" _+ Y) m" c# p
- module_param(acnt, int, S_IRUGO);+ v* p7 o4 l! L( k$ o
- module_param(bcnt, int, S_IRUGO);" G! K( [: a% F5 n" w N! a
- module_param(ccnt, int, S_IRUGO);
复制代码
c; ]. [6 m' \' ~7 R
$ \9 @+ r0 e* I+ Z2 m6 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ g; z) o' ?( h0 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ B+ `) x0 D: U+ I: ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Q' z$ ~! b5 O, z/ ^
{3 I/ e+ c8 |4 S* e9 ?1 b: r# g8 F0 M7 c' }
|
|