|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 O) O" W S2 F
- [code]EDMA sample test application
! e9 y5 f8 p+ q - /*
( n* b. x$ H' R5 C - * edma_test.c
" y" y J, x: u( f; | - *7 ?6 k% I& T- Y" l' Q/ D4 N
- * brief EDMA3 Test Application
- F3 d; S3 o& I7 e - *
# E g! R9 e% j# v. }0 E - * This file contains EDMA3 Test code.
/ |7 y# X& S$ H - *2 q/ D* ~4 A, P4 ?5 Y* e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ]8 ~ q4 Y; N7 l6 ~+ _; g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( G1 U0 h( P8 ]1 K* E+ M - * TO CHANGE.( p* K z q+ W* n$ d" l
- *
' @( v- ~' i7 N" M. i# T# @% w9 a5 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ K7 v/ Q6 T, U" i4 j+ F
- *
( H, E. d8 ^! I7 _5 r - * This program is free software; you can redistribute it and/or
1 ]7 }- x3 P2 p- n; K2 M' u - * modify it under the terms of the GNU General Public License as
8 ~% o3 Q. W! x/ x& ~2 k' { @ - * published by the Free Software Foundation version 2.
: f* @7 i+ o- j" R4 M) t+ }4 W' H - *
$ k% B8 J/ o+ o' Q% T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. O& s2 N6 a+ o" T% W$ b# n
- * kind, whether express or implied; without even the implied warranty
& Z D2 |( ~ W" k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
_+ F; }6 p2 u# v- H+ }6 Z - * GNU General Public License for more details.; }) c/ {: u* C! X
- */" T4 G% K* Y- q- r$ ~2 g I4 l
- + e O+ e x2 ^
- #include <linux/module.h>; ? ?# x3 g6 p( L, |" x/ y
- #include <linux/init.h>
% g$ R" q$ O) S3 Z - #include <linux/errno.h>! g6 b/ h) e2 R4 F3 b8 l
- #include <linux/types.h>4 L' J( z9 v# \
- #include <linux/interrupt.h>; X2 p. z4 A' f' e" j2 H
- #include <asm/io.h>
. O+ D/ B6 F6 X5 D' i% M - #include <linux/moduleparam.h>
$ y4 f) K1 T! ? - #include <linux/sysctl.h>
5 s9 G3 p9 s2 `: w - #include <linux/mm.h>
4 K3 b1 y5 ~; D1 H% u% S - #include <linux/dma-mapping.h>
8 D U2 `( v8 @ - . N! M: }0 e. R4 |0 J: _4 U `6 g9 @/ d
- #include <mach/memory.h>
( I6 C4 g \* O. T% E - #include <mach/hardware.h>
" e: [8 l, m: `; h- B - #include <mach/irqs.h>: q4 o- z6 G$ P% q1 N- q
- #include <asm/hardware/edma.h>% p5 w$ Q$ {) P
- / n$ [! ^3 i& t9 m- E: I' T
- #undef EDMA3_DEBUG
! H( v+ U9 |* p, R& j6 C2 J - /*#define EDMA3_DEBUG*/5 o3 J, ^! O7 L$ `# n
5 n4 u6 @! A8 Z o8 O! J- #ifdef EDMA3_DEBUG+ Q% D( F# @: j- w" Z. r, m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ ^5 g: k. U, M! Y. Y# S+ p7 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 p9 ]! _3 a9 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ^+ N; s/ |/ `& p9 {+ w - #else$ V# a1 Z; q$ j
- #define DMA_PRINTK( x... )5 A6 C, M; C8 M* \
- #define DMA_FN_IN! p! H) w$ F/ }. u9 X5 w3 V
- #define DMA_FN_OUT# V8 G# \9 `3 j4 I4 w+ i
- #endif
0 W1 }+ e- Q! f9 c2 Y. X - @( y. j, @0 Z$ Z8 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 ^+ y7 v( Y6 z- b+ s) _$ s
- #define STATIC_SHIFT 3
) @3 W' V7 Z8 ~3 q* |) y - #define TCINTEN_SHIFT 20+ g' S& y1 r5 V1 P7 x4 A) r
- #define ITCINTEN_SHIFT 21& u0 z4 {; `4 L( W3 G
- #define TCCHEN_SHIFT 225 U9 L/ h/ A% c Y
- #define ITCCHEN_SHIFT 233 }: M& ^! x( R/ R, M6 U
y$ O2 o6 `2 _2 |( Z3 d- static volatile int irqraised1 = 0;
% S1 Z5 A: f0 B - static volatile int irqraised2 = 0;
8 }- L9 j/ `/ X2 B
" @- B$ }# N: _$ q, \( Z1 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' I s4 B- O7 b0 }7 z' B! E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ u* z# m4 \" Q0 x, N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }6 Y: A/ f1 y# s
0 U. B, \1 E% S- w+ e- dma_addr_t dmaphyssrc1 = 0;
+ X, K: q' t5 x: h" K" j, T& [ - dma_addr_t dmaphyssrc2 = 0;+ D b) ?3 E* g2 k4 f0 g5 S: h; d
- dma_addr_t dmaphysdest1 = 0;, t0 {. T1 B8 T1 i9 |
- dma_addr_t dmaphysdest2 = 0; D: M, n2 W$ s# P7 e0 z9 ?
3 H# k* S/ s3 \: P- char *dmabufsrc1 = NULL;
^+ ^9 I% `2 u, @& h - char *dmabufsrc2 = NULL;
9 [1 J9 ?) S r' z, s - char *dmabufdest1 = NULL;
9 D9 r0 n. K# L* S' e" A - char *dmabufdest2 = NULL;
6 w) M' [: ~ @) ^# p7 d( ~ G
z! J& U6 z/ W. @ F' T4 h- static int acnt = 512;
2 z7 W9 B5 N- \5 Y/ S$ w - static int bcnt = 8;
# y* |0 C) _# V/ t$ ^, T# x" K - static int ccnt = 8;* O/ m, ], U1 f$ D, _
- U; M% M% @2 C5 n, M$ P- module_param(acnt, int, S_IRUGO);: m9 V* j# Q" A# ?. Y( W
- module_param(bcnt, int, S_IRUGO);" \8 L7 m1 k! D V4 G$ p( p3 X- p( y
- module_param(ccnt, int, S_IRUGO);
复制代码
4 I! g' `8 J1 i9 |: e, M" U
5 h' N% P! o$ h# a* J# T: h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
? w. O/ k) O, x Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- \. `# e1 L' Y& s- {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 O5 u r9 G. \( F$ G; `5 Y. P- R/ ?& ^& w$ ~0 G
% {1 K" s+ Q; G" x" {0 P
|
|