|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# m# d% c. C4 I* A% r( K& ]6 T7 v0 P! R- [code]EDMA sample test application
; n* y' z. N5 N - /*
: w/ W3 V( H( N, K5 f6 |9 u1 f. B - * edma_test.c" N. r: I, e6 h6 y2 R" P9 D2 K
- *$ @1 G: P U) \" v# D
- * brief EDMA3 Test Application4 ]; V5 q/ N( X2 G( x
- *1 y& Z' x5 r$ g1 j0 A Z$ C! a0 X
- * This file contains EDMA3 Test code.
& b) Y7 g3 M4 ^8 w1 c - *
( k4 f/ |5 d( R8 x" s C' g0 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: M9 [$ K1 j4 P+ m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- s3 I4 _" B3 o1 S# O3 c0 d! h% I - * TO CHANGE.2 A" V( h l% D" l
- *
: q! c& |6 l0 @/ D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; ~: ^" n6 R% P - *8 Z, U' f" N* l- R+ ^6 `5 z7 ^- y
- * This program is free software; you can redistribute it and/or2 h, L- q' G' ]5 J
- * modify it under the terms of the GNU General Public License as5 x0 M" T g; K
- * published by the Free Software Foundation version 2.
' ?" {8 z& q' T! N! E5 | - *0 @" Z5 Z9 Y5 j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ |8 A- q& k9 V2 f( G5 |) {: D" M
- * kind, whether express or implied; without even the implied warranty0 a8 y8 P! K* @, X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a3 q% i$ z" ]* ~# F - * GNU General Public License for more details.# G# k8 W. F. A" e* z
- */; ]5 n1 E9 b L. j3 @; p
' [' `9 Z8 {/ s1 T8 @- #include <linux/module.h>
/ _3 {! k' Z3 [5 e. P) j% x) b - #include <linux/init.h>) x, G6 w& J. s; w( X" d: D
- #include <linux/errno.h>
4 }. r: }% J+ D/ g - #include <linux/types.h>) Y- n& Z& Q9 p8 E
- #include <linux/interrupt.h>* p+ Y- W* o) a0 @5 l" k5 f
- #include <asm/io.h> E; T6 y; \( m3 k" ^ ]
- #include <linux/moduleparam.h>0 F3 N$ k. {% U
- #include <linux/sysctl.h>. ]( G! G2 U. J5 W3 r
- #include <linux/mm.h>9 S$ m2 n8 m1 R/ _7 Z# c$ d
- #include <linux/dma-mapping.h>
/ y, @ i F: k$ t6 N8 f
4 w9 U' C% Y* ?* q: X" w& M% R- #include <mach/memory.h>
" q- `# ]* V, q7 G! ^% n - #include <mach/hardware.h>
8 b% m% @5 x0 t - #include <mach/irqs.h>5 K; W$ ?% W" u2 U0 J: P {1 L) Y
- #include <asm/hardware/edma.h>
k7 J! z! H. J4 U& P - 8 n- l; x' M, ]2 B5 y5 g
- #undef EDMA3_DEBUG9 E1 H- U9 [% [- _' S# P
- /*#define EDMA3_DEBUG*/
( M" \% |% U- R) d. ~- |
2 c; q. b' P1 C; F1 S R- #ifdef EDMA3_DEBUG8 M/ @' q( {+ u" m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 t" h4 c# E8 E7 c5 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ n, p: p! q9 Q' O$ H" K1 R8 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' Z$ w4 F- Y- j$ V# V
- #else3 ^" Z% D4 {2 b. F9 l j1 I6 u
- #define DMA_PRINTK( x... ). M, L' G# V- ^4 G5 e4 y: r, D7 {
- #define DMA_FN_IN5 T) P" S0 ]4 z5 ~8 ]6 {
- #define DMA_FN_OUT
9 w9 v( N: W% R' [ - #endif4 J. h; w) n7 I9 Q; H- ]
- % x9 L2 z( h% |1 r- \ x7 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 B0 t% j0 n8 M) D' }( ` - #define STATIC_SHIFT 3
& b8 o, v# S3 o. k - #define TCINTEN_SHIFT 20) S$ l5 G# X9 }! o ?5 L
- #define ITCINTEN_SHIFT 21
0 ]2 B* a$ {' a" ~9 c - #define TCCHEN_SHIFT 22. ]2 r8 z7 j+ P
- #define ITCCHEN_SHIFT 237 _! H( \8 k" J6 `
* @ S4 A8 s Y$ d \1 ?4 R- static volatile int irqraised1 = 0;1 `( l* s8 U M$ ^- H1 E
- static volatile int irqraised2 = 0; P$ u2 {# \* h" \8 N/ w% f3 K* @
- 0 H$ B4 i G. a. O4 k' n, ^" s( B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [4 S# t; V1 o0 d# T- l/ e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [! V8 f' h$ S2 c0 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y8 Y- g! K2 h+ R2 [ - _! r$ ?( t/ J* ?7 d* H+ z. {
- dma_addr_t dmaphyssrc1 = 0;$ @7 ~; F5 f; f N/ C/ e" B: {6 }
- dma_addr_t dmaphyssrc2 = 0;7 ?# l$ H) w) K, o/ q/ m h1 I* f
- dma_addr_t dmaphysdest1 = 0;2 c$ \. _ G: P+ R6 a
- dma_addr_t dmaphysdest2 = 0;
+ \4 k$ r8 X g3 ]7 L
/ v n: V: T# R: N+ l' s# i' P/ ?- char *dmabufsrc1 = NULL;
& @! Z; a/ O# A- I) ~+ n - char *dmabufsrc2 = NULL;
J( c4 N8 }7 g: ?6 ^/ V- S% y; q - char *dmabufdest1 = NULL;: S5 h P& q; y9 R/ l8 F
- char *dmabufdest2 = NULL;0 p2 Q2 U! @0 |4 j! I
: z4 \. }4 f. v( J1 v0 S- static int acnt = 512;
( ]5 O* u& f( N+ @) H" P' h - static int bcnt = 8;) _: F/ b, J% I# ?
- static int ccnt = 8;# F( g& F: _0 j' _
- ) \5 g! G" ?& @4 L* l, P1 N
- module_param(acnt, int, S_IRUGO);
+ \& U% o+ w& X+ ~ - module_param(bcnt, int, S_IRUGO);- a3 T$ C; |3 _, s' M
- module_param(ccnt, int, S_IRUGO);
复制代码 ; u8 R0 o* a# Y8 ?/ ]1 e: X1 K5 a
% W c6 M2 n4 a0 B. M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ K! U1 L3 H5 R3 d% j* n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 n+ c7 X7 V# T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, \: O2 l8 y7 C- L
$ l X3 x# _4 G! p
K. b; ~( \! s/ {& _$ r; X
|
|