|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : @: A+ w! A4 H/ g5 {, y% h
- [code]EDMA sample test application
; [) I6 C, d6 {8 x2 K& X1 Y - /*
' [# o2 z: d/ ? - * edma_test.c
6 T5 f- Y' v4 l - *
2 f! U3 t- M, C) t9 |. Z - * brief EDMA3 Test Application- B( `# A6 _1 t i# a' i. R
- *' e. ]8 ]& C' g' ?* a, Q- q4 Y
- * This file contains EDMA3 Test code.
9 B& ?/ v/ y+ H: N# Y( b - *
# x& g1 y& A3 b6 ]1 I7 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ c1 I8 ^! R3 Z1 k, l, X3 T3 P0 M0 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: G/ B: m5 `5 G: q" R
- * TO CHANGE.
* U2 h* b5 y- ~+ n: V; v - *
# n" d: X l; j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 r8 k2 _! V' o, D& U - *$ X+ ]$ } d& R% l
- * This program is free software; you can redistribute it and/or
, u& T8 ?5 S1 @9 M; @/ p0 }9 i* } - * modify it under the terms of the GNU General Public License as7 \# B0 x% [9 L0 i; S. u
- * published by the Free Software Foundation version 2.8 `1 \' R$ o& w% u5 `" c" T
- *
* F) w" k0 C% {6 w4 Q$ p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; u7 t" }: S3 U1 q8 _7 F- c - * kind, whether express or implied; without even the implied warranty
% f# S9 B$ K6 N& c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; W3 z. ]$ k! j! t7 C( _
- * GNU General Public License for more details.
2 z# s: d! _# ] - */* N9 I2 P& S# w5 [8 w2 @
- ! R/ E" T: H+ `7 T" k$ N
- #include <linux/module.h>
4 {1 z. }3 J: \ - #include <linux/init.h>1 Y) ~5 P* G4 B9 ]7 L
- #include <linux/errno.h>) C) W o( v& R" B) \/ m7 c; N8 Q. D7 V
- #include <linux/types.h>
8 }4 M5 \# l! d7 \ - #include <linux/interrupt.h>, \! [4 r+ O* k. V9 _$ [/ |+ n) O
- #include <asm/io.h>
' v" r, A* w3 R9 V9 p0 c - #include <linux/moduleparam.h>* I+ H; t G ^$ X: `% Z+ p: {
- #include <linux/sysctl.h>
# {( k# c& q( v - #include <linux/mm.h>
- s2 H* b R M - #include <linux/dma-mapping.h># |" G4 M# r; Z z; K
7 i: [: O4 D/ r0 ^, c- #include <mach/memory.h>4 ]- g/ I$ |* I3 M
- #include <mach/hardware.h> ~* a! z( ?; w$ P% Q) A, J
- #include <mach/irqs.h>
. o" G- I: n5 r, c* @. z6 _& [2 B- R - #include <asm/hardware/edma.h>
" `7 `: C4 \2 F$ H4 c - + z5 w' }. P; U+ X% }( G8 _
- #undef EDMA3_DEBUG
% Q+ F, P( g2 K9 b p7 S - /*#define EDMA3_DEBUG*/
3 I6 w# T# z& C; W- ~) e% ^- S, I; | - ; m" n7 n' b. Q0 B# g
- #ifdef EDMA3_DEBUG
: ]/ r+ p1 V! R: h% y) j- L) H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! J" T' n' W; [- e% ^- n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# z; `! U+ x8 D7 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ O1 S+ j' a. `. o9 H2 _/ r
- #else m! }. l J0 e" T
- #define DMA_PRINTK( x... )% c5 m. o: a4 u
- #define DMA_FN_IN5 u$ U6 @ N0 X, V T
- #define DMA_FN_OUT
+ a$ u& h8 j2 Y/ C+ ?) W1 u - #endif
, g" b! V$ I/ b3 @
5 \ C2 m2 T0 F' |0 j m* Y2 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768). A; y- A8 k2 b m- w
- #define STATIC_SHIFT 3
$ }6 o7 r! z7 }* u7 ?8 I - #define TCINTEN_SHIFT 20
! t; T) z6 `1 E0 P - #define ITCINTEN_SHIFT 21. a: ^9 i8 H/ {! m: h) ~6 [
- #define TCCHEN_SHIFT 22
! L! P% T, G1 Y. o+ T5 k3 |! t" V# l - #define ITCCHEN_SHIFT 233 H$ v& U/ T4 J% [) T( {
- 0 }% `( X8 U n1 [' q- [% L
- static volatile int irqraised1 = 0;: X, n) b# r# p- F# A1 M
- static volatile int irqraised2 = 0;! O8 i1 y9 s* u* C. `( d* s
6 \+ m' a4 N0 O% [+ x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 e$ O. I! e5 ^ Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W3 o0 c& M2 I: w/ O: o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ]5 r% U& v0 c i' I5 U
) N* A S( [2 h# ~4 w- dma_addr_t dmaphyssrc1 = 0;
, G6 c- H: P" u4 D8 m! l - dma_addr_t dmaphyssrc2 = 0;
' [* b& l d! U: S( ^4 J/ x/ p - dma_addr_t dmaphysdest1 = 0;
% Y' A( W$ _3 c( F5 b$ T - dma_addr_t dmaphysdest2 = 0;
3 U B" w0 I4 r; {% K - 3 P7 {! H7 s& f/ F
- char *dmabufsrc1 = NULL;/ e) y% k( ?% ]5 F# ~/ _) u6 j
- char *dmabufsrc2 = NULL;3 d) e4 M, q3 N( q
- char *dmabufdest1 = NULL;
+ J. W/ u4 a: u3 A- u+ E9 L - char *dmabufdest2 = NULL;
2 G H& |; }2 L1 \' g# S5 t - ' Q/ b! ~, E( a7 a( h) T- z9 A7 b+ v
- static int acnt = 512;
2 m" V9 O' J C2 n - static int bcnt = 8;
6 v% ~+ z7 X3 _. [6 K - static int ccnt = 8;
3 c8 Z! Q/ R* L* u
; q# S2 V/ p. r6 l' N- module_param(acnt, int, S_IRUGO);
4 X3 ? B8 a4 I - module_param(bcnt, int, S_IRUGO);( C! ]( |9 P) I0 b% D
- module_param(ccnt, int, S_IRUGO);
复制代码
* k) ^6 I1 \7 Q( N+ `! U D( e9 s% E9 r7 A( ?1 r) |9 w- w- U4 a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 X/ j3 ?! n5 P; J3 L5 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. m7 t5 }: _6 H& K8 `1 O6 t- g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 A' a9 W! J2 b# P2 L
2 G. H8 l5 @* v
# Y* Q2 k, m2 B$ F- \ |
|