|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( {0 I/ \6 Z9 ?; z: R- [code]EDMA sample test application
2 N! w" ]$ ~# Q$ O6 e6 v - /*
& N. U2 f8 u: Y* v" C& ~' i - * edma_test.c
9 w$ F4 p4 z( u: [# J9 \! M8 p$ p - *$ A, a5 `, y; q# H% D: @0 {3 t! X
- * brief EDMA3 Test Application
. v9 {- W l" W1 w/ P5 m* f/ k L, m- h - *
' P4 |5 k6 }# H j0 e - * This file contains EDMA3 Test code.7 F. G) `/ Z2 ?- R# B: O& ~3 Y
- *
) t( P; ?8 |- ^& N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: i: j& d' w5 ]; S/ E r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, M+ | t3 W% z+ Z" l( ]
- * TO CHANGE.1 C" ~$ M! ]( f& k
- *: u& d$ d: l" o" X5 T3 _. q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ s$ P! q& |* p D' f" G8 o) W
- *
3 Q& r9 n3 G0 F' L - * This program is free software; you can redistribute it and/or
( x1 |9 `; d, E& O - * modify it under the terms of the GNU General Public License as
9 W: w# {5 j- S. v4 V" B - * published by the Free Software Foundation version 2.3 m U) E) H/ v G$ U: Z8 c
- *
5 o# [7 T! y1 W4 ]% | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
u, U' L* s. w9 j+ r. X3 Y - * kind, whether express or implied; without even the implied warranty
! }# o: ]' _8 I4 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 {. o* m2 F0 p7 S - * GNU General Public License for more details.
4 N2 Q$ S8 l& M0 G( ]) ^ - */
/ E# ]( W. N" [. ^
6 m6 ^- f% K) I* \- w0 I# a% Z: ?- #include <linux/module.h>% I0 Y3 ~* U0 }0 b' {; s
- #include <linux/init.h>6 X' c) e: }- ?' m' q/ }
- #include <linux/errno.h>9 L( E: J' Z; g* C4 B y! E. r J" _* Y
- #include <linux/types.h>; C O K7 @- T" x: z
- #include <linux/interrupt.h>; H+ }+ z$ t O M( d/ V
- #include <asm/io.h>
) R* Q6 @# s3 M# `% `) z! K3 l - #include <linux/moduleparam.h>
& _6 p% z: ?6 E) m - #include <linux/sysctl.h>
6 h' s! ?, v1 T. { - #include <linux/mm.h># c& J& r% I3 w0 `/ n( M7 |% A& C8 A
- #include <linux/dma-mapping.h>5 E: k- `" m+ C3 ^& h) e e
' \# B- Y/ }5 B4 [( z1 }- #include <mach/memory.h># ^- K: l- }( X& C& W! e! `/ v
- #include <mach/hardware.h>
( \, W6 M" s- z! Y - #include <mach/irqs.h>
; V- P0 q) E1 }$ e - #include <asm/hardware/edma.h>
" V/ M. J- M! J* \7 ?5 P+ h - ( L1 l( @; O. z! T) H
- #undef EDMA3_DEBUG
3 n d+ I# L$ f5 Z; x - /*#define EDMA3_DEBUG*/
( F* V, k! w1 U" R4 s/ t- f% ? - $ H) u# J) @$ n$ ~, x& l
- #ifdef EDMA3_DEBUG" R8 H( U: |& G. n. L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& D+ a r" `# s4 _* B- ~7 o% K* d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( [4 c/ D0 q* N+ R0 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 F! E' f# t& {$ v& j6 w! }5 Q
- #else
9 {7 p% |/ |" A0 Y2 Y) V - #define DMA_PRINTK( x... )
$ C) ?- x( Q- j3 F2 V+ k8 ?' I - #define DMA_FN_IN+ T/ T# a$ `' t1 M* I6 ]
- #define DMA_FN_OUT: f/ R% ^( _! Q! t
- #endif, I0 u u) H) Y. z, O
# G' k2 P& \/ a$ t- c- #define MAX_DMA_TRANSFER_IN_BYTES (32768) w; X+ [) ?) n9 X
- #define STATIC_SHIFT 3
$ O: }) f6 D5 d8 m0 G- H - #define TCINTEN_SHIFT 20! f. B6 G; _8 d' A0 q% Y
- #define ITCINTEN_SHIFT 21
: O9 I' y2 q* w3 ]" R8 F - #define TCCHEN_SHIFT 22
6 g; b) B6 ?. h, e - #define ITCCHEN_SHIFT 23
6 [/ G! N# q+ }" ]/ J0 b2 `2 x - 6 C: L$ b( {# v7 A7 M$ b) d
- static volatile int irqraised1 = 0;; g5 r3 l$ v( r6 x* j$ _
- static volatile int irqraised2 = 0;9 g, R$ V6 g0 ?. v& C
% z; _3 R8 s+ k$ H0 n' c& E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y/ o0 |8 K8 s9 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ o6 I6 S9 Z2 f0 | Y2 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T* q1 |9 W0 F
- ' e+ E" w7 F! b1 H% ~! N; o8 ?
- dma_addr_t dmaphyssrc1 = 0;
0 {5 A( V; x: ~: V) T - dma_addr_t dmaphyssrc2 = 0;
9 ^; ~: i* J+ h; _1 Q# J8 A- w, R - dma_addr_t dmaphysdest1 = 0;
: J8 s+ K: k# _8 K5 [$ R* i( q - dma_addr_t dmaphysdest2 = 0;' Q2 N1 \# D( x( O+ f! E
6 _: L2 s) T' F- char *dmabufsrc1 = NULL;+ G5 L" l0 U+ V B. v
- char *dmabufsrc2 = NULL;
: o: W' @) `2 Y. ?8 Q6 @! j/ e - char *dmabufdest1 = NULL;- P5 M$ u% y, ?7 ~5 E: _) F
- char *dmabufdest2 = NULL;! g' p! A% q- H* R1 L: o
- 0 N# h5 ~' V5 l
- static int acnt = 512;- e8 \/ c" C" M+ p1 n+ a$ h: V
- static int bcnt = 8;
: d6 [ V$ b3 g I4 n - static int ccnt = 8;
' K4 h, g1 W( S. P8 @ _ - 9 q: c5 ]# A% A9 h$ x7 h
- module_param(acnt, int, S_IRUGO);8 k; |' C* G! n
- module_param(bcnt, int, S_IRUGO);
4 C3 u3 ^+ f8 p - module_param(ccnt, int, S_IRUGO);
复制代码 ( F c0 i2 z1 s- h
2 y7 v, T/ l( O. K+ Q1 R' }% x( z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" m! d" _1 i' n0 k! rarm-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, B4 J4 h D1 r" C$ F: p5 N' r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% B* U6 X0 D- D! ~* h8 Q3 ]/ o+ W5 ]" R C3 U" f
& A4 S9 L a" _
|
|