|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 O* |' Y( t% b- [code]EDMA sample test application {3 y- b5 [! I9 M
- /*4 u( f1 e$ l; c6 G- o4 y# G+ _" R
- * edma_test.c
' f# m6 c! J) P. ^7 d1 Q - *
8 m& e7 o$ T; X% e$ H0 P3 u - * brief EDMA3 Test Application3 ]6 Z$ ~# N1 I1 t" G
- *4 P0 c1 I6 K! h+ E' `
- * This file contains EDMA3 Test code.
8 J: w8 `& |5 X% Z: E$ Y - *0 ^- F* Q+ x4 X& F& r* d! {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 r1 L2 F4 M1 G* C( a# Y1 a( T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! d* f' n! }' v# D5 j
- * TO CHANGE.
% ]0 F; j0 A& `# x3 o/ u - *
' e" M1 j, g; _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* B" P6 w2 d0 T5 C) P1 p
- *
& C F: Y! d- g4 ? - * This program is free software; you can redistribute it and/or+ M: _8 v8 i& u, {+ ~3 M/ ] l
- * modify it under the terms of the GNU General Public License as
$ e3 @3 V1 V5 N! w. e% B; ? - * published by the Free Software Foundation version 2.
' N& J' Z2 \( Z4 ~3 P - *
4 |) j6 Y G$ e/ e! L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ M) h2 R& \5 X0 J" r b, m
- * kind, whether express or implied; without even the implied warranty0 T# z% R0 t( s4 s% ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% x# k$ z% R: X9 ]0 p( k
- * GNU General Public License for more details./ y* ^/ ~0 B& W0 Y, E
- */( _; b0 z3 j/ i) h7 {0 s# M
- & C7 t- U, x: X$ N6 C
- #include <linux/module.h>1 x) E6 R$ q! E# L- z/ o
- #include <linux/init.h>
+ ^; V2 o* ?: E! }0 U - #include <linux/errno.h>1 c# q, j; Y8 e( \3 M
- #include <linux/types.h>& _: {- ]" G" G# H D& e
- #include <linux/interrupt.h>
* x. t4 o/ K! Z7 _ z - #include <asm/io.h>- |' n8 Q: I# d T( u/ K8 O
- #include <linux/moduleparam.h>
. ?+ b$ \: P' Z `* h1 t - #include <linux/sysctl.h>
7 T+ F0 x% m3 r$ f( P- Z - #include <linux/mm.h>. H& C# Q3 }7 ^2 G) w! A2 O
- #include <linux/dma-mapping.h>6 \8 [! @* z3 h5 J9 o4 m" s4 n! g
" e+ m7 x; {$ ^- p1 x- #include <mach/memory.h>
# n/ Q! ?- O& \; S - #include <mach/hardware.h>
+ n1 V. D) j; X P - #include <mach/irqs.h>' O2 r+ X! F$ d! g9 r
- #include <asm/hardware/edma.h>
; m) e% P' _; O% @7 |; j
) [, |' z# a& i2 I; R# I% w" H- #undef EDMA3_DEBUG
2 I) f1 z! U, N a - /*#define EDMA3_DEBUG*/
6 g i# P" X1 n4 i& t- L, q
3 N& T5 _; r& ?5 X# H2 M- #ifdef EDMA3_DEBUG/ t* o4 i5 M5 {" N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
t$ a6 l( `0 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 U& R3 P/ U) G* _1 r ^, F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* e5 Y+ Q, b. _7 D: b; z
- #else
/ N- Y" o# L/ Z( ]6 D t; h - #define DMA_PRINTK( x... ). ]) w6 h' w8 Y7 j" R" \- y2 @
- #define DMA_FN_IN
. W, q5 Z2 ]7 M: N3 E( _ - #define DMA_FN_OUT" O" |) M8 q' }! O5 \. W0 @
- #endif
0 S" M- ~8 V2 [$ G - 1 M3 C/ f1 |! q$ ]) P8 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 ]7 q9 s5 {8 `$ U* @ - #define STATIC_SHIFT 35 z/ E/ C. M1 a( B/ O
- #define TCINTEN_SHIFT 208 M! u) w4 `" n9 ^. W4 t# J6 N
- #define ITCINTEN_SHIFT 21' @" v( f1 M9 z4 f* `0 t
- #define TCCHEN_SHIFT 227 c, x8 \, |0 n+ a
- #define ITCCHEN_SHIFT 23
$ d5 B7 ~3 Q8 D5 P$ o4 E0 C& @
5 B& R, ?9 y' E- static volatile int irqraised1 = 0;6 T% q& {1 {/ ^8 u& B
- static volatile int irqraised2 = 0;
- e$ C( r' H: `+ B, S8 C" ? - G: f! d$ B1 d! D8 ]2 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |4 l3 j% v# o: h) [7 S8 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G6 w" @* Q \2 X+ y3 N y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 d+ E2 W. m/ Y3 |) C d
- % e5 z1 j( Q1 ^/ O
- dma_addr_t dmaphyssrc1 = 0;6 ?7 F$ X: O5 [" l
- dma_addr_t dmaphyssrc2 = 0;
6 {6 f: Y0 Y0 W - dma_addr_t dmaphysdest1 = 0;& P6 q# p' r+ O# a) Y5 @
- dma_addr_t dmaphysdest2 = 0;7 r5 s/ S W% `5 v9 W
- ' X! D2 S$ Q k- ], G
- char *dmabufsrc1 = NULL;6 a4 G0 i. P$ a( z( s6 ], R
- char *dmabufsrc2 = NULL;* F0 A4 f6 n4 M
- char *dmabufdest1 = NULL;$ E1 }/ r' n& v+ L1 X, N
- char *dmabufdest2 = NULL;0 n k Q+ ^0 T* H J; y3 c
& x1 ?0 K; q0 A0 k- static int acnt = 512;
) B. {( k5 w t, v, A - static int bcnt = 8;
4 v; M! J% o D; F6 D' G - static int ccnt = 8;
( ^7 @) H5 S5 d3 L: o2 L+ b - 2 Q+ P! s7 C4 B- R
- module_param(acnt, int, S_IRUGO);% V1 \# e( a1 _7 g8 l
- module_param(bcnt, int, S_IRUGO);+ Z! t: h" t# y8 c2 T* U0 f
- module_param(ccnt, int, S_IRUGO);
复制代码 / L( \# m/ R6 Y0 n
4 R+ N7 X6 F: J4 H, d( Q$ D5 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, S* N% q( b d/ J! Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! c" |" L0 B2 k4 T4 k( S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ u) h2 z, {( r3 ^- U) F4 w$ T# q: |
6 [) r5 b# n- f4 n+ n( h% G0 u
: m6 S$ S$ H& O! h |
|