|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; M' d: d' A. b" _0 a8 R1 |8 L) c6 U k
- [code]EDMA sample test application0 ?( U R+ {7 U' j$ ~$ j
- /*5 I% z+ ]# M) @: x0 E# U
- * edma_test.c% M# D2 ^3 ? T0 P3 ]7 w
- *% E1 g) c7 J' H% O( _; O
- * brief EDMA3 Test Application
+ w5 d/ |- o' J( R0 q+ a" w- G, z - *( I- |4 P8 j4 _0 U& t
- * This file contains EDMA3 Test code.
8 @/ c4 }2 q6 j - *
2 S! L; @8 t- e! h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- i9 ~- V' \- X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W0 v J8 S, P' f. f; ?/ g9 ?% ^
- * TO CHANGE.& n) F6 ?, W, Z
- *
7 V6 R5 ?* T# ]: p+ e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) u9 {& R( o: f- t* J K
- *. R; E( S/ l$ \+ C
- * This program is free software; you can redistribute it and/or" S3 y' ?1 ?, s$ F
- * modify it under the terms of the GNU General Public License as
% F4 y6 d! v$ R6 J2 T3 N1 ` - * published by the Free Software Foundation version 2.
5 k3 O6 f0 A2 a2 a' H) p - *) X/ \# a9 d+ B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: \- U8 ]. p7 t3 `, }8 Y. ?
- * kind, whether express or implied; without even the implied warranty
+ t1 ~/ S! }) N; ?9 b- S. f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 |) B* K4 m4 ?) L/ T
- * GNU General Public License for more details. \; x$ ?* ]' f) X f+ C( a
- */0 s" \$ ?9 v& u
5 L' y: y4 S/ U2 H/ d. o# n- #include <linux/module.h>
# J# V6 g+ X/ L* B' e - #include <linux/init.h>
0 Q( R* w/ c# y - #include <linux/errno.h>! l7 [( ]# E# x+ Y/ Q- @
- #include <linux/types.h>
3 u) h1 n: A/ y+ ?% ~ - #include <linux/interrupt.h>1 `2 C8 @8 c1 z% y/ V- ?% c
- #include <asm/io.h>! S, V; q' l. M5 k: j* M( u
- #include <linux/moduleparam.h>
" S" q6 r8 e2 p6 V q - #include <linux/sysctl.h>4 F/ J8 c5 G z- }6 z0 b" U
- #include <linux/mm.h>7 G0 R* Z# z- y+ w% h
- #include <linux/dma-mapping.h>
! i8 s6 x4 n+ v" D/ C9 ]
# q% ]) _! C: O6 h- #include <mach/memory.h>
& V7 ^) B* l* Z - #include <mach/hardware.h>
% f& o. r) s; A1 L - #include <mach/irqs.h>1 W: L; ]; i/ d# R% {
- #include <asm/hardware/edma.h>: u+ L* H! m/ l4 t2 n: q/ t
/ V' B8 P' x5 ?1 H2 l9 m2 o) ^2 e I- #undef EDMA3_DEBUG: n* F. { ?5 m/ F: k. L5 ?
- /*#define EDMA3_DEBUG*/3 b4 t+ T$ O6 D/ f5 @( x
- ) s3 ~9 k# Q8 i0 `9 o; b
- #ifdef EDMA3_DEBUG4 g6 {$ f* R: i( N9 H" N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 t% z! J! E5 w% w' W* ^0 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): c5 w9 z; T& |) G9 ]; G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) ~; w6 K U. r% \( ]. z; ~ - #else
+ W# c. q: f! p+ Z - #define DMA_PRINTK( x... )( t. l c" o: q- r4 x1 A+ j
- #define DMA_FN_IN
2 h2 s! k! C0 u- ? - #define DMA_FN_OUT$ f4 O0 D4 ]; } z ^1 W
- #endif
- N. d, W0 s4 E/ K4 W
$ o; }5 C( Y- ] F' d7 i* G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, P! c/ e* I$ X) X* x - #define STATIC_SHIFT 37 Q1 v& Q; N$ X. n: s/ U- T
- #define TCINTEN_SHIFT 20 d0 Z2 X6 I ^% g
- #define ITCINTEN_SHIFT 21' H* o9 m9 i6 ?1 q) J/ J0 J8 F1 `
- #define TCCHEN_SHIFT 22" D k2 f# ^/ Q9 A/ E$ X
- #define ITCCHEN_SHIFT 23
! q( u; ^ s; \4 z. m' p - 1 m/ ^( _$ r9 R( g2 C
- static volatile int irqraised1 = 0;5 J! d9 y$ }8 [" I0 ~' D" Y
- static volatile int irqraised2 = 0;
: Z; V# i6 W& x - ! c6 K3 q2 m4 |+ S% T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 B/ w: y3 S3 B4 g) M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 A. P( U4 ]" d( O9 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); u" `2 @/ {& N$ R: E
+ y, J& [, P8 |! l' v- dma_addr_t dmaphyssrc1 = 0;) Q, \# n# ~8 p/ g$ Q
- dma_addr_t dmaphyssrc2 = 0;4 ^( ^/ l+ N) [! g! j4 E2 |8 l
- dma_addr_t dmaphysdest1 = 0;4 G4 u! D+ e* I. b) ~! r- r5 [
- dma_addr_t dmaphysdest2 = 0;
$ Z3 B7 [/ t7 p( O
8 R+ j4 O; k3 }5 U! S- char *dmabufsrc1 = NULL;
( Q; D" U9 b; v: |1 G9 s - char *dmabufsrc2 = NULL;( B- P* A" {5 x* R) J8 n% |
- char *dmabufdest1 = NULL;, {5 c* m A8 t% w
- char *dmabufdest2 = NULL;
7 g5 o& e& T% r! v3 u4 f) j4 r( l
9 ~; R0 K1 Q- f0 n! y- static int acnt = 512; K: p& e" B9 N3 ~' e& T" ^+ l$ U0 {
- static int bcnt = 8;# {$ p* G. M) k% g5 J) s
- static int ccnt = 8;+ m) W' t/ W, E
- - m( k7 m. g+ z' L/ q
- module_param(acnt, int, S_IRUGO);% z/ q3 M7 C& T2 W
- module_param(bcnt, int, S_IRUGO);8 r3 y) {& d Q% {: O
- module_param(ccnt, int, S_IRUGO);
复制代码 % n( K2 B# T* G0 h& i
% Q2 v1 X. p" g# ]0 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* K" ?. b# o" I1 Darm-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 ]- f0 S" L9 M# w1 \8 e% J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( B0 q' }- A7 U: D: m, `
% a$ D- r% b; K, T
, L4 @2 t5 H. Q& ~ |
|