|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . K$ G9 ]* N& a$ H( {" n: C
- [code]EDMA sample test application& \8 i" s2 Z; n
- /*
! F/ p5 T0 i* d# _7 i - * edma_test.c9 Z8 o6 H# ^; L* a2 X
- *
$ r2 M7 W: {3 G: l9 Y - * brief EDMA3 Test Application
6 a; P7 A+ q9 p7 a" T2 c - *
! c/ Y5 r! B; X2 Q( z' j) R: Y - * This file contains EDMA3 Test code.
* r$ c- c; B. r8 ?" _, {: p - *
5 A% X9 e6 T2 ~% T a u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ B2 Q3 F( `9 h: q. a* ^3 m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Y8 V/ g( V& z, J6 |
- * TO CHANGE.
1 {1 r9 n3 s) k7 f4 b - *
9 p& }) | ~) D2 ~/ H2 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 |: Y: B' b. L- t& E - *$ t7 N- Q* x8 B
- * This program is free software; you can redistribute it and/or
( H+ p" e7 \; n. d) ` - * modify it under the terms of the GNU General Public License as: F3 s( D& F9 B! V' K2 H& J6 ], |
- * published by the Free Software Foundation version 2.
- T- d3 C$ n. D6 e - *$ G/ ?% H3 Y9 Q' q4 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 `8 g F! e9 O8 a) | - * kind, whether express or implied; without even the implied warranty/ z* O" ^/ \3 @' L1 D- }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 L' B0 f0 N* v - * GNU General Public License for more details. u6 L' o o' \8 K. ~
- */
n/ m& P9 X" h s4 ^ - $ n1 }% W, Y' A
- #include <linux/module.h>
9 |, T$ N9 e5 p' n! C2 u - #include <linux/init.h>
, F, J0 L* t8 t4 h& X - #include <linux/errno.h>
' h) d! Z8 y S: J - #include <linux/types.h>: p4 e! i$ K2 }2 Y3 E
- #include <linux/interrupt.h>
% Y7 L( S& I5 X ` J - #include <asm/io.h>- j) n: X G, H* d- v( U
- #include <linux/moduleparam.h>7 {: T8 Q; I6 r% J
- #include <linux/sysctl.h>
/ {0 Y- c7 Z2 s - #include <linux/mm.h>/ S* t# g$ q8 K6 o, K
- #include <linux/dma-mapping.h>, N: k: E5 D( Q2 m+ a" w% m8 Q
4 O/ F; ^1 y5 t1 d8 w8 P- #include <mach/memory.h>
% A0 s( ? A+ E: O& ~; Z - #include <mach/hardware.h>
* N+ R' \) p* D2 ?2 w9 L - #include <mach/irqs.h>, f q5 |8 B( n+ ^! p- Z, `$ E) C
- #include <asm/hardware/edma.h>
! C8 l. x0 L7 O* l0 q P - - g4 E: \: F0 f+ z
- #undef EDMA3_DEBUG
/ f* G; ]' _5 z. F( V - /*#define EDMA3_DEBUG*/! d4 t7 I. J7 x1 L$ W& {" P
2 ^! V) K. _+ K6 L, [3 p- #ifdef EDMA3_DEBUG- t% f7 K2 k( w+ y2 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 p( l5 d; t ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ x' F; T" @0 u: [: d% z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 W. b: \( l9 ^5 H - #else$ C; f. y5 m! `2 X' w! a7 I4 W4 ?
- #define DMA_PRINTK( x... )# b0 Z' F, V- n
- #define DMA_FN_IN
' F; I A4 F& r5 M - #define DMA_FN_OUT- T$ J. U$ M/ S3 R) t
- #endif* { n. M& P X& A
- ' R) ?2 P& q: c! W: j# e1 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; H5 K) v+ X2 G O2 S/ _ - #define STATIC_SHIFT 3
0 j+ I1 ^) ~$ I - #define TCINTEN_SHIFT 20) s+ `; H6 S( }/ Y; N: x
- #define ITCINTEN_SHIFT 21
2 L2 I4 ?; p- a( q6 f" o! n - #define TCCHEN_SHIFT 22
$ D2 D4 Q, {% y0 S% M u - #define ITCCHEN_SHIFT 23
! a, u0 T0 n' K% {/ Z, L
* a& H0 a! m. X- v' D: V( l- static volatile int irqraised1 = 0;& }- F/ X7 t) F/ {, ]: s
- static volatile int irqraised2 = 0;
* N# y0 [: b, f9 C1 f8 e! z) k! p0 V' k
" g' a a& `5 A' g# A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* C C) A* o) M4 e. V+ A: j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ V# i# Q1 L7 e7 O; N) p( y% ?3 r/ q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ I" A& g. X3 n4 d4 C3 [9 e
2 R7 l6 G' T! O* ~- dma_addr_t dmaphyssrc1 = 0;4 r3 b' I9 ? n
- dma_addr_t dmaphyssrc2 = 0;
. O7 a0 c/ }6 T' R# E e6 q5 t - dma_addr_t dmaphysdest1 = 0;+ d9 E! O1 F9 y
- dma_addr_t dmaphysdest2 = 0;
( `5 s6 p3 l2 B [" B3 S" [! \/ U - " f" t" {9 z: f+ m# v
- char *dmabufsrc1 = NULL;
. {( E* L+ {; ~/ ` - char *dmabufsrc2 = NULL;. h1 k/ a& E7 _2 ^' l% z, n, |
- char *dmabufdest1 = NULL;
' w5 }; _) |+ _! v) u, |- k - char *dmabufdest2 = NULL;! W9 q" B6 k. Z8 c( N6 ]+ u
! N0 b* _3 R; L- static int acnt = 512;. }' g* g1 L& k+ p2 i3 A7 t1 T
- static int bcnt = 8;
7 ^7 @0 t: e$ C, D* y+ G - static int ccnt = 8;* L6 [* d. r" K
6 D# j, ^3 N: m& ~- module_param(acnt, int, S_IRUGO);2 b& b2 k' q5 V* r! y: M
- module_param(bcnt, int, S_IRUGO);
: y, ~0 g) o2 j( i* s+ M! ]; J - module_param(ccnt, int, S_IRUGO);
复制代码 4 N4 L" Q M6 _! y2 D" ?- d' F
* W4 O- L* ^# V o3 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& |2 q* g/ f" H! u1 S% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Y; a7 l8 S y0 X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 [# v4 T2 r5 L3 Q* ~
. [( d3 _* u+ U. ?5 x6 P- v- `8 }8 Y6 r* X* D' a) M h: l! Q
|
|