|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ W9 Y" N& a6 {# s3 B0 ~8 j- [code]EDMA sample test application% l6 R3 e) g* y
- /*" V3 a4 j# U8 h/ d" J: P0 i
- * edma_test.c
, \+ ~; u8 j7 u - *. B% l% P+ H/ z; z
- * brief EDMA3 Test Application8 _5 a `5 B+ a. h' f/ ~/ i) E3 E
- ** a& H5 l9 s% i9 b" J5 P
- * This file contains EDMA3 Test code.
9 |1 v6 I; v9 ` - *
* `' D6 o _4 H3 ~6 O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% M; c& I) S; y3 e! H" U( @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, E+ `6 v0 [6 T# l/ A& o$ J+ y
- * TO CHANGE.* V v, x4 {& W3 `7 ^
- *
0 D) y. z. @* O& b, }" i; W- b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- V, F/ k* g- O4 N V7 m% O
- *
" x. u0 D, O& T8 _! p - * This program is free software; you can redistribute it and/or/ D& q2 w9 V/ i: y4 v* P1 V
- * modify it under the terms of the GNU General Public License as
9 l& S$ ^! F) x; ` - * published by the Free Software Foundation version 2.
$ [; U( V5 H8 F! ]$ ` V; g0 b - *
/ ~# a; u- u* S% L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 r) x. ^% g6 |0 Y, c# I% t+ X - * kind, whether express or implied; without even the implied warranty
" {& P, G, n! } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 I7 N) p4 h- V% l
- * GNU General Public License for more details.. C+ a% `* S) v
- */# p5 k% i. \1 |
- ; _5 ]$ B' a I/ z& M
- #include <linux/module.h>- ~3 u5 a: D+ J m
- #include <linux/init.h>& }$ K" z' c% e
- #include <linux/errno.h>, z1 M& L6 y! D# J; H
- #include <linux/types.h>$ I5 U/ d/ [. q1 [' |- N W
- #include <linux/interrupt.h>4 x+ d d9 @ W1 z5 p, `
- #include <asm/io.h>6 p; N7 K% a1 f* P8 x* P5 `
- #include <linux/moduleparam.h>. E9 |* [% ^3 D! Y; B
- #include <linux/sysctl.h>8 U0 K$ N( Q* }4 \
- #include <linux/mm.h>
0 _' X, s8 A% H0 v, t - #include <linux/dma-mapping.h>; P1 D' j! l0 S4 I. B/ w g( L6 k
3 w- a" F3 {% ^- w3 B- #include <mach/memory.h>
( [" g/ d2 ~) e9 J* W( F - #include <mach/hardware.h>+ l8 \2 Y' l7 h @3 f/ M/ _/ p: }
- #include <mach/irqs.h>
9 d' p8 D) p# Y- F3 D h - #include <asm/hardware/edma.h>
$ O* B0 X6 ~* L2 N
* _) k% `; S1 s+ S- n; O1 r' m7 c- #undef EDMA3_DEBUG
8 A( n" U) u5 ~, T) ^, _* | - /*#define EDMA3_DEBUG*/
% d/ G4 r L# ]" ^
# O! [4 |; k! i0 k& g0 |% \- #ifdef EDMA3_DEBUG
. G" q; G& N; O& P" ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ y+ L/ O) W* d+ P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 Q, l) b: Z" \, t* o. Z6 y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* T7 h! Y F" g9 j
- #else* _: v2 f9 L0 V1 N* g- s
- #define DMA_PRINTK( x... )
& ~4 L, Q+ K5 g& B - #define DMA_FN_IN9 X2 |3 _$ L& {1 z) c& s; {: ~
- #define DMA_FN_OUT
. _. B! i% N( g `! X) M, G9 B - #endif
( X* r2 f4 b. G: h
" S2 d9 g% Y2 N$ o+ H; W! V" l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. ?' \; H; c% p! P - #define STATIC_SHIFT 3
, k7 W. q, m1 s1 X5 b6 o5 J - #define TCINTEN_SHIFT 20
0 A! O! N8 B n5 y! G: ~1 z4 D- C0 L - #define ITCINTEN_SHIFT 21, G; P4 E. u. v. A2 f
- #define TCCHEN_SHIFT 22
) W; q$ H5 S* b6 I- h$ I - #define ITCCHEN_SHIFT 23
0 e, Q2 G& Z2 p7 ?+ ]" z0 X - ( k' y& [$ V4 }4 V5 @
- static volatile int irqraised1 = 0;
* ^& R5 B' {' g+ T/ b3 E - static volatile int irqraised2 = 0;
! t6 |+ v! O+ _1 M B
* \0 X+ d! c- M0 [# c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. x2 `9 t4 E0 ?* k+ v3 o) V% w" P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) u, m, W8 L Y7 G1 B$ l, `# S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ l" Q* ]* v% Z( I6 q; C
, [0 K5 E( D6 e. v. o" {' X8 G! o4 {- dma_addr_t dmaphyssrc1 = 0;8 E V4 `+ G d* n
- dma_addr_t dmaphyssrc2 = 0;
8 d4 f9 \$ e0 W; y- i9 f - dma_addr_t dmaphysdest1 = 0;
5 J% ^3 n5 I, o1 K1 |( j - dma_addr_t dmaphysdest2 = 0;
" H e% ^( o. F- E- c
; y) `! U, M8 }. D- char *dmabufsrc1 = NULL;
4 z4 y2 ^" `( ]7 ~, t4 ?! I7 O3 M h' L - char *dmabufsrc2 = NULL;
) P; p d, G+ G, Y% h - char *dmabufdest1 = NULL;. E0 T6 d6 V& Z/ Y
- char *dmabufdest2 = NULL;
- N0 l. d8 c3 [) |3 K+ ~0 s! X* M - ' J% l8 {+ F; K+ X
- static int acnt = 512;
9 ^+ \$ d! t. B8 i7 I0 e: V; w - static int bcnt = 8;
& f7 i, a$ _( w9 f; I - static int ccnt = 8;
' ~! s% ]# ~; K
y$ G8 f+ ?, B7 j% t. W- module_param(acnt, int, S_IRUGO);7 O& w# K; P$ p6 m2 i
- module_param(bcnt, int, S_IRUGO);( q/ L% ~- r b, y
- module_param(ccnt, int, S_IRUGO);
复制代码 % i F8 A% _7 `' m) ?7 R+ ~
" I& E; ?7 o2 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P/ ]0 ?' w8 L- O+ Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 D, x: i N' g& B& P1 z6 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, i3 b, _4 a% j7 V4 ?2 H+ X, M" e3 ]# U" a) V
, }6 T6 G: d' t3 S8 u8 j- q
|
|