|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) J) v* L7 r0 j- m& w9 s
- [code]EDMA sample test application" f$ a6 _: ~2 ?) w% M3 `
- /*6 d6 {# J3 Z7 e5 ~: H' e
- * edma_test.c
- s5 a/ i. r5 T3 B" M" R7 g - *; b, M$ z0 d9 J. A8 v
- * brief EDMA3 Test Application0 ~0 n7 {, M0 B* ~0 ?! ?( r
- *
2 C5 W7 M2 y! Y% D3 k - * This file contains EDMA3 Test code.
; f+ [" C5 A% z% b. z$ B - *
- T' W) s; U2 l; v1 M. D$ T2 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! J% K1 G/ i. z8 `2 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, l" c" M* v1 L' H# e
- * TO CHANGE.7 i8 [8 d* x& n# [, x& Q
- *
$ f) O. B; [3 k; ~3 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% y$ S& R$ U6 r0 Q% X3 Z* x
- */ @1 h. _# m/ q
- * This program is free software; you can redistribute it and/or
0 W+ N- P: S& w2 z4 N t: H# P - * modify it under the terms of the GNU General Public License as
5 D, r; Z7 M) O$ @/ ?3 t3 {/ r - * published by the Free Software Foundation version 2.* A, {. F8 G* \, `, V
- *% I; W) t) S: i# B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! {' y3 I" z7 J! A( L; F* {! Y
- * kind, whether express or implied; without even the implied warranty
# ?8 Q! D0 Y* }2 s9 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 G( j: z2 n4 T$ s; j4 p
- * GNU General Public License for more details.- u, W4 O0 l6 w7 z* F- z! ?7 Z0 w7 w9 [$ j
- */
: [5 N/ N; \9 A4 C - % T' V! c/ x* T, D& e+ g6 U7 a" u
- #include <linux/module.h> ?/ X9 @/ v! C" @$ H
- #include <linux/init.h>
* ~6 ~% V7 k+ Q6 i1 K5 M; `( P$ a& } - #include <linux/errno.h>, _* s1 o3 L$ a! `8 Y! }+ h
- #include <linux/types.h>$ [& e, z* `$ ]
- #include <linux/interrupt.h>
# ^3 y0 R, O7 ]+ X2 } - #include <asm/io.h>. F: o- k, R/ `( m
- #include <linux/moduleparam.h>
5 P6 @! s; [9 j* H* ~ - #include <linux/sysctl.h>% \7 d1 V: j& ^
- #include <linux/mm.h>4 ?- K A1 \) Z5 M0 Y" Z
- #include <linux/dma-mapping.h>
1 `7 l; H' c* u: F* ]9 \. _
* g6 P& J |, B' G- m- #include <mach/memory.h>2 J" A& L. m: X n* B6 H7 g- n
- #include <mach/hardware.h>
2 i. C( N4 I- r E - #include <mach/irqs.h>/ t+ x1 m0 U$ c R3 E/ L6 P. ? x
- #include <asm/hardware/edma.h>, }' ]8 k, R* L6 P
- " W/ V; P) p+ m# z7 [
- #undef EDMA3_DEBUG8 f* P" S8 n# c1 H0 y
- /*#define EDMA3_DEBUG*/ _% J8 s2 d+ x9 m' G4 u
- 1 J2 V/ }3 ~1 n; a* D4 [8 A
- #ifdef EDMA3_DEBUG
% e6 [% i0 B; A# ~/ u5 M4 ?0 K0 D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; g7 z" M$ p! t; r! T ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( M( Y0 s' `1 F# B% a6 ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* a- M9 G4 l% O/ F1 s- v - #else
8 l* W* S, L! X3 E - #define DMA_PRINTK( x... )- G8 A1 Z9 D" ]9 r
- #define DMA_FN_IN
- K! L- k$ B1 H+ R' d) ~; o - #define DMA_FN_OUT
$ V/ A! Y8 }7 h$ Y3 I - #endif
* E6 p+ J$ V) |2 {: A
5 ^+ |0 k3 u: O6 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768); V- A& z( @: X5 T
- #define STATIC_SHIFT 3
5 M5 A, L! ~# Z6 S* k - #define TCINTEN_SHIFT 20
+ L9 r% e" V- k+ l) K: q# V! ]' F1 _ - #define ITCINTEN_SHIFT 217 j) Z4 g% a3 U3 ~" y
- #define TCCHEN_SHIFT 22, j6 g- Z" b- J: _( P2 f+ V; s
- #define ITCCHEN_SHIFT 23- E3 C$ K/ V2 l ?
- . [2 f- J' k" |! p' Z) N% k
- static volatile int irqraised1 = 0;2 C) q0 u9 l4 F' t; m
- static volatile int irqraised2 = 0;8 I& g! J, h' h8 i5 O s
- 5 X+ c( ]0 ~5 G+ m7 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. F, ` o6 _7 Z- J1 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 q4 b: o+ ~1 J! J. t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Q% d/ ]+ ~9 `- K" t' q
- ; k* H0 Z' {, y" k2 b
- dma_addr_t dmaphyssrc1 = 0;
* n- s& x* W/ s Y - dma_addr_t dmaphyssrc2 = 0;+ }4 {# z' ~: l0 g* [5 t+ {$ L
- dma_addr_t dmaphysdest1 = 0;1 j1 p7 ^( x8 [7 Z. l
- dma_addr_t dmaphysdest2 = 0;; q4 N" p: g+ [; S3 T( f+ m+ L
- $ M1 R7 Y8 w, U; r# r
- char *dmabufsrc1 = NULL;
( p8 k8 E& \0 y6 t A - char *dmabufsrc2 = NULL;
: j) V/ }9 I; h+ u3 V - char *dmabufdest1 = NULL;
, n; s: w9 @9 L0 O6 O - char *dmabufdest2 = NULL;' y+ K+ @9 a+ Z w* P" H% g5 S
4 C: P$ G* \/ y- e- static int acnt = 512;
8 @! j- Q; Q/ d4 H0 V - static int bcnt = 8;' Y3 k5 @' _* e# _
- static int ccnt = 8;7 @) w9 Z w! k+ ^* |3 i: i
; p& H$ ^6 M& ]5 q' V- module_param(acnt, int, S_IRUGO);; J0 R, l3 N9 o+ x2 u/ k
- module_param(bcnt, int, S_IRUGO);- `3 E% r8 m- i
- module_param(ccnt, int, S_IRUGO);
复制代码 6 Z" h) ]: d9 Z7 k2 L7 p- Q' {
& u3 c8 K* N4 T; j8 H6 s# {* P* c$ i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) h6 [# b- K3 p Z T: f3 j6 @- V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, M" m i, @2 f+ z/ {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {1 E5 |5 E3 V9 C) k
4 [0 e) Z& T }" D( }9 T
. `- g! O; `+ y |
|