|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
J6 y9 R/ _& l h- [code]EDMA sample test application4 d/ G/ S' O! N8 s( _3 H
- /*
! f. k8 K' P& v; Y% D - * edma_test.c
, d0 h% O; u! o, ~1 a# m1 ~ - *
2 q( \5 B" ?$ \( z& b$ l1 C - * brief EDMA3 Test Application. s: t% L+ }) p* O
- *
$ S9 W5 {' o* l! ^* s& R; E - * This file contains EDMA3 Test code.
8 A5 l5 w7 Z) q7 \7 v6 g6 s - *
$ d) V4 \* a# Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. g3 \8 T& n7 k: ]7 j5 Y- K! n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Z7 @3 ~9 H* Y4 K: f
- * TO CHANGE.
# i7 O, J5 u) ^6 e; \7 o1 r4 V: |, [ - *5 Q4 w" W0 M7 @4 U: e' ]+ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ S4 h. [6 o5 s' O5 W! S
- *
+ h$ ^/ W2 i A/ l7 s4 E# O - * This program is free software; you can redistribute it and/or
: a% G. S1 y s) q# O - * modify it under the terms of the GNU General Public License as$ R/ {6 z5 ]7 H7 D9 j* c) S
- * published by the Free Software Foundation version 2.
( S* }) G7 w1 {1 O* l - *# s ^( H6 | B, Y$ {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ v/ q: X. r! X3 w3 g& G" _! p
- * kind, whether express or implied; without even the implied warranty
% v( K% q0 Q" S% n0 e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, i0 `. f3 |! F
- * GNU General Public License for more details. L+ R" w& p, W5 F
- */5 F- A5 s, z, u9 f7 X4 @
" y! q% |9 d& n& }4 g1 z' `4 v9 H- #include <linux/module.h>
7 k" e( U: S m% G0 b; q! Q - #include <linux/init.h>! {( _; T- g- \
- #include <linux/errno.h>
: O7 P! d- |5 k4 i/ u/ T+ M - #include <linux/types.h>
& w- Z, h4 a- Z( h7 k% V. c - #include <linux/interrupt.h>
) ^7 {% }0 p+ c6 R - #include <asm/io.h>
! s' v4 p7 Y6 Q3 C4 l - #include <linux/moduleparam.h>, B; X; O; n" W# Y
- #include <linux/sysctl.h>2 H8 d6 |% J7 h/ V' N w; Z
- #include <linux/mm.h>4 J3 t3 v8 J1 a. s- E. U
- #include <linux/dma-mapping.h>
$ }; ^2 n X8 v" ~& {- T3 K
2 s; _7 c5 {5 H F- #include <mach/memory.h>% y N/ o3 G! ^/ b: j
- #include <mach/hardware.h>0 W* _; \* [. G/ e/ i d
- #include <mach/irqs.h> v5 K+ j6 E6 b6 L+ c
- #include <asm/hardware/edma.h>/ _* q- W8 g. @4 m
- % `8 h# U- Y' l" z @/ b. B( Q
- #undef EDMA3_DEBUG7 t& x2 n- H' V& b- W
- /*#define EDMA3_DEBUG*/
) Q( ^" w1 ]% g' F C. t, A: E
8 M" ^2 l' q I" P, e& J( D- #ifdef EDMA3_DEBUG3 ~ c$ }# a O& w* {" D! e0 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) R) E+ [/ j4 D( w V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 J4 m5 \6 v H7 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 x# G: e4 f: R' z" a& V
- #else
! a: `( p% t+ f* {- a4 g- d - #define DMA_PRINTK( x... )! Y* X5 p/ W: L' H
- #define DMA_FN_IN
- s/ C7 p p, `5 R7 P - #define DMA_FN_OUT
6 E. M9 s$ r" l( h - #endif5 e# A s) G2 [
- ' B" P( z% Z, n1 A" ]$ o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 R3 n0 V) d% J- @1 n. T - #define STATIC_SHIFT 3
* F2 p8 c1 S6 `8 e- |9 u - #define TCINTEN_SHIFT 20
% `3 B! p# a+ v7 d6 q) d! ~3 `' i! H - #define ITCINTEN_SHIFT 21
: D) c& a% @) B9 _ - #define TCCHEN_SHIFT 22
. G c$ ?9 g, X, b5 |$ @1 N7 J - #define ITCCHEN_SHIFT 23# F! K, f" L6 ?6 F& u2 X, i4 ]8 ], h8 z
4 c4 |# J: m }, p' M) B+ p8 M4 E- static volatile int irqraised1 = 0;- M: O/ j! m* Y( y7 n( |$ o& z
- static volatile int irqraised2 = 0;
6 d( V- _; @+ n9 M' N; H7 y" G& L' X
4 z% j* w' c( T' V; m! O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G4 t! }' B m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q) H4 F' s8 }2 J' O: ?/ ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 o: A9 g2 T# @ T% X4 w
+ L; c" D" s* Q" U' r- dma_addr_t dmaphyssrc1 = 0;
1 l7 ?. E+ O" r/ @8 E - dma_addr_t dmaphyssrc2 = 0;
" o7 m; q- u$ S! {9 o" c, v( U - dma_addr_t dmaphysdest1 = 0;
3 v+ O2 S1 F' r+ r; A- O - dma_addr_t dmaphysdest2 = 0;
3 k# q5 I, I7 N7 Y5 [
1 y, }) e0 P2 L! o: U6 b' l$ j/ A" g1 }- char *dmabufsrc1 = NULL;% t8 Z$ u; Z' c! c, z$ N7 v, y
- char *dmabufsrc2 = NULL;
Z3 d* |' w5 J, V - char *dmabufdest1 = NULL;8 T- O. Q3 c& N# s
- char *dmabufdest2 = NULL;
, x$ T) S2 H) W4 h, X( X+ U - 8 S& a+ Q# Z# _+ m
- static int acnt = 512;
7 I$ v, f! b+ x7 s( H9 [& I9 y( m( L% y - static int bcnt = 8;
) n4 o G _8 F1 |0 @8 Z - static int ccnt = 8;" o9 t a9 W5 ^. ^" t
8 D: l3 w8 V+ J1 |' I1 r- module_param(acnt, int, S_IRUGO);
9 c1 X" ]# v5 f9 U4 `6 z& s& v0 e( X* v - module_param(bcnt, int, S_IRUGO);/ N- b+ A) E- c! i# U! t% F8 W9 m
- module_param(ccnt, int, S_IRUGO);
复制代码
' T3 ~. z6 o5 p' t* s" z, D1 r
0 M3 D9 c8 }; u7 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* X2 O: k& L9 t$ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 J9 k6 k, Q6 t8 r& x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- F7 \4 P! b$ B& ]' [- I. G
2 T6 T8 i5 M( ?, q6 h4 c; t9 c- {5 y( ^ x) R
|
|