|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ x% r P+ l( h; n: ]- [code]EDMA sample test application
. K$ W* ]# S s1 `+ H, Y& X - /** v+ p: t- T! W, B! a( ?
- * edma_test.c& e& y6 V- y/ H9 ]
- *) P& @. o# w" a& N- E4 F+ i
- * brief EDMA3 Test Application6 N1 v" Z+ d! [0 y! G
- *
! C2 ~. w* x% t4 e6 q - * This file contains EDMA3 Test code.6 M& A7 m, h' E h
- *
5 G: Q! O2 \$ i, z# `! [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 u8 B, g$ j8 b* n- M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( y3 B. t% N. V+ \; [
- * TO CHANGE.5 W0 C: m4 X% a9 Z
- *
7 Y! ?8 {1 W( @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 c" o$ d( |. W2 Y) e, J4 _; w
- *
5 Z! _( P! J& |, E2 j) l - * This program is free software; you can redistribute it and/or
( N i7 j) M+ y; t/ ?1 S - * modify it under the terms of the GNU General Public License as
6 ~( m$ f6 D1 U+ x* \ - * published by the Free Software Foundation version 2.
+ z8 o0 c$ }0 U+ K4 b - *
) U7 f6 B) z! R1 u2 J; k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 y; u6 V) y5 s3 u9 T - * kind, whether express or implied; without even the implied warranty
|) ~; R/ f9 d7 H. H9 }# T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% t* r: R, Z0 c. P - * GNU General Public License for more details.
4 Y8 W, v. Y8 X6 t - */! x, U. q0 W X- h6 A
! ~1 Y, Z! y$ B' {6 p$ y- #include <linux/module.h>4 @7 d: u$ B O c$ _% E) p
- #include <linux/init.h>. o" }4 L' ]5 a6 x: C
- #include <linux/errno.h>8 g7 K" {+ s m; T4 R
- #include <linux/types.h>0 w0 }2 \1 j) J: \
- #include <linux/interrupt.h>
" M* X- L9 `) A - #include <asm/io.h>
6 F' u3 |2 P" N! k- B - #include <linux/moduleparam.h>
3 r, R! x% {( j- e - #include <linux/sysctl.h>( B3 P0 _( @0 O
- #include <linux/mm.h>
& W) C# q6 n3 ]- g0 h - #include <linux/dma-mapping.h>* E ^9 {. V0 o, {
* L% o: m2 u$ V/ c- q- #include <mach/memory.h>! `+ \6 n& `) H/ d. }4 V) ~
- #include <mach/hardware.h>
' E; s: U# w( q T' j - #include <mach/irqs.h>
/ z: `. v% W9 t- i. q; A1 G% n+ Y - #include <asm/hardware/edma.h>
$ `# r3 ^1 _- |7 [5 l7 D, t+ g
* ]8 x F! z8 z* D4 I8 M' o- #undef EDMA3_DEBUG
# n8 I; I1 |% A - /*#define EDMA3_DEBUG*/
4 c1 v5 Y: c# c& z5 \# V
1 s" u( g' z9 ?2 u$ s- #ifdef EDMA3_DEBUG
0 {% k5 e, x. D; f9 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# V- H7 d( Y& W N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; \4 p7 P- B' m/ k% d( K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 C E! u C( f3 A3 s; n8 J - #else0 c, ]( T8 X; {! D# V, I
- #define DMA_PRINTK( x... )
, _4 _( B; `# [& c/ }0 t ~3 p' F - #define DMA_FN_IN
1 c& Y1 R9 `$ I" W( m! a - #define DMA_FN_OUT! I+ m8 r4 {% D) D
- #endif
+ t5 o* X' Z* L! w2 [0 ?
* n( I) x. l1 U6 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; [8 _6 W# g4 r2 z& g - #define STATIC_SHIFT 3
- C( X# g7 Y! r - #define TCINTEN_SHIFT 202 m4 B$ \. E+ Q' }+ U% I* } G
- #define ITCINTEN_SHIFT 211 d: S$ b- J$ i/ j, [+ Y
- #define TCCHEN_SHIFT 22
- r& @* i7 X8 b. F9 t6 F) @ - #define ITCCHEN_SHIFT 233 t6 E0 s) f% b; g; l9 r6 b
- 6 n& q8 d2 G( ^9 G% Y! O7 A' i
- static volatile int irqraised1 = 0;
# g2 Y# s8 S& z9 n - static volatile int irqraised2 = 0;1 J' e$ \+ k/ r/ N+ {! F& d$ K) }
; d2 Q. O' L" V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ x) K; P$ r9 Z' |+ J$ d% W- ]* V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I! P5 X+ o! R/ O* M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* O9 E' Z& ?9 m2 a5 e
- P. ?9 X9 }7 `; b
- dma_addr_t dmaphyssrc1 = 0;
; k0 j. z3 ]) ?# N- h- P - dma_addr_t dmaphyssrc2 = 0;( p! v9 I' r7 d" s
- dma_addr_t dmaphysdest1 = 0;; y7 {( @$ g. B
- dma_addr_t dmaphysdest2 = 0;) z, ]+ | v* k4 Q |/ N. v
+ M1 \# A- ?$ k- char *dmabufsrc1 = NULL; V( W% \7 m: S5 Y
- char *dmabufsrc2 = NULL;
+ p, k0 e5 N* S - char *dmabufdest1 = NULL;
+ z- \9 v% K- I5 ` T- f% U3 f) }$ B1 | - char *dmabufdest2 = NULL;7 `% j4 E: X4 H- Y$ u
- $ W- m: k, ^& ?" y
- static int acnt = 512;/ S3 s! i$ M: j' W' r
- static int bcnt = 8;
! g5 g: T' x# ~. u$ y - static int ccnt = 8;
/ Q4 E B6 f! q& Z5 q. l+ Q D: [ - " n0 _- Q1 Z* b* Z4 A& y
- module_param(acnt, int, S_IRUGO);
$ T; g' H f; P - module_param(bcnt, int, S_IRUGO);# x+ J0 b0 X( {5 U0 P+ U6 C) p
- module_param(ccnt, int, S_IRUGO);
复制代码
7 ]0 w& d! f8 |, {) V0 V
5 H" u1 E4 f0 g+ X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 D4 J; F' c0 V3 z+ P2 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 x1 l# K9 @2 R c9 A0 [$ f6 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- j- ^$ I9 q7 Z' @6 n7 G, N* f# G! t2 Y
* F7 Y8 [3 M# J
|
|