|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ^: Z$ F- A# f0 A3 `
- [code]EDMA sample test application
6 p" A' |3 a% _ _1 [ - /*! t$ ?/ f& C" N7 ~1 U7 g$ }1 @) |% W
- * edma_test.c
7 C6 U, l, R- r0 W& i( j6 { - *5 S3 _: W9 @! {8 ~* ?; l
- * brief EDMA3 Test Application1 }( X# ]/ _( a9 k7 ~5 a( w
- *) }2 D' r7 K9 S! k5 b( }8 U, Y
- * This file contains EDMA3 Test code.
( j# T8 y' ]- w5 X7 ` - *6 Z% G; t! f9 t/ f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( P$ @, G Q( W w+ }2 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 f/ ?. P, v9 n/ s2 \) m. z - * TO CHANGE.' x1 X, ]9 y8 r w
- *( B5 ?5 ]. e# Y1 [6 ?( {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 `/ ?+ U i( D: f3 }: `7 _ - *- {" n3 n* B+ H6 |2 S, j
- * This program is free software; you can redistribute it and/or( r! N7 S4 C; ?2 w
- * modify it under the terms of the GNU General Public License as# z0 Y. z2 ~9 }1 Z9 a- G- ?& k" T
- * published by the Free Software Foundation version 2.+ [- A, ~" o- k$ u& ^0 K
- *
7 C( f" y" e5 g, k3 U# S( I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: F0 {$ V& R6 V' d4 ^$ R - * kind, whether express or implied; without even the implied warranty, o. P% k/ ], ?- j$ w8 Y7 r& Z5 P# R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& K. U9 m! f- r9 o! ~ - * GNU General Public License for more details.
# H" F2 Q4 g0 F6 _( Z - */5 i* V5 j. }& o# x
- 9 h' D& {& N9 K, p; J
- #include <linux/module.h>
0 h) Q5 s) M X) E t2 T - #include <linux/init.h>
) _- U& `( N5 r/ b3 [6 S$ y5 x+ ^ - #include <linux/errno.h>
g9 l0 s: q* q9 t9 R - #include <linux/types.h> P( z' u- t1 A9 u( ~4 i
- #include <linux/interrupt.h>
' a0 M4 R6 w" ^) E' w - #include <asm/io.h>
2 N$ l: H9 {+ I3 f - #include <linux/moduleparam.h>% m9 V' S3 s* u1 ~2 \! s
- #include <linux/sysctl.h>5 N0 y# e z; X) {
- #include <linux/mm.h>4 |: ~) {4 N' G
- #include <linux/dma-mapping.h>$ Z( _. L3 R# {2 N1 h
, I4 {; k/ ~, T: \ x- #include <mach/memory.h>
/ |5 f6 N6 J3 S - #include <mach/hardware.h>
6 `; ~& Q9 C6 n% s& f - #include <mach/irqs.h>
6 `+ E8 V6 W! D0 d. c5 K7 S/ a6 @' c' t - #include <asm/hardware/edma.h>
" ]! d1 f% R6 r7 s" M3 L - 8 ~1 a% t Y, p2 m2 Z; h
- #undef EDMA3_DEBUG
! g4 s L4 Z" S' T8 i - /*#define EDMA3_DEBUG*/8 O; c; ]& ~. i
, }$ e' S# x( n* `1 a' Q" Z- #ifdef EDMA3_DEBUG I9 W) d' p; D) i6 V9 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 N% E3 T6 O1 z5 L; s0 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 O4 q+ h5 ^& n1 u0 }* S' y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V3 {4 o M4 L3 f7 e- H
- #else
% T1 |; k6 a4 {" d: ~$ n Q1 K0 ` - #define DMA_PRINTK( x... )+ Q1 U( V9 Z( ^5 E: w
- #define DMA_FN_IN, Z1 \9 \, m* X' X$ } ?" m
- #define DMA_FN_OUT
8 j& q7 A1 e- L9 P" B: G - #endif& f2 S0 a) a6 ]" S, [
- . ?( g" ~& p8 d% f U' J/ m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" a# @2 B3 w# b- N7 J9 z3 z - #define STATIC_SHIFT 3
: I* E5 C! x$ U9 e0 U4 E - #define TCINTEN_SHIFT 20: ~3 p _8 U+ V% a+ V# I- C
- #define ITCINTEN_SHIFT 21) F% d( E0 J( z$ n
- #define TCCHEN_SHIFT 22
: L6 v% i* Y, t' ?4 ^ - #define ITCCHEN_SHIFT 23
$ p/ ~$ I/ C Y( ]$ Z# ?
' y. b! Y0 B( S* x' [- static volatile int irqraised1 = 0;
! Y! w* s/ k: w. e - static volatile int irqraised2 = 0;
# b: U2 j. ~* W) y1 p& Q8 C - 0 Q6 f* F+ N% C& }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @' x6 J* K! i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N; B" G3 q7 M0 t# ^6 q7 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 \2 `0 A9 X7 f$ f5 z: ^ - 0 \" Q* ~6 F5 M& a" o
- dma_addr_t dmaphyssrc1 = 0;' m- H2 n5 g1 `( _9 u
- dma_addr_t dmaphyssrc2 = 0;9 b. @# m9 n6 Q% X+ U) V
- dma_addr_t dmaphysdest1 = 0;/ D1 D( _9 t+ x! j6 M
- dma_addr_t dmaphysdest2 = 0;" R9 \* H4 J8 ]5 ]
- 9 s% I2 M* J5 n6 u1 p
- char *dmabufsrc1 = NULL;, P" X @# O/ [
- char *dmabufsrc2 = NULL; `* b& H4 \* g- K& p4 e2 K5 K# O
- char *dmabufdest1 = NULL;% m& n8 Q: W" d" P) I Q7 R$ t
- char *dmabufdest2 = NULL;! ^1 Z) ]2 i* p' W' l [
. `4 Z1 p" X0 }, x6 n- static int acnt = 512;
' t' C' U- t* D# {$ j - static int bcnt = 8;) I1 b: v" i8 j- S2 `
- static int ccnt = 8;$ v% K$ i) ? L; i% p
5 h7 b1 E1 g9 e% @- module_param(acnt, int, S_IRUGO);
' N$ A2 b1 Q; R - module_param(bcnt, int, S_IRUGO);
) O- a2 h; z3 H8 K - module_param(ccnt, int, S_IRUGO);
复制代码 / f1 p' d: Z! ^7 R$ P' g
9 v6 K" ^" p# V+ U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ g9 w. c4 [, X, m2 d \0 `$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 w; N) r$ K, R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& o7 V" l0 k% p: G
0 R9 Z; M0 A+ X$ K, K1 A$ ^ h( D
0 @7 l8 C; {( X. O" E |
|