|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - e$ {! `( }" v! @6 r6 I( w
- [code]EDMA sample test application+ x# I# n8 R4 R& L( E
- /*
J6 r, r- O& r, ~ - * edma_test.c4 @9 J; |! @; g" G7 ?+ H
- *
, x+ z3 V8 i3 Q* M7 Z - * brief EDMA3 Test Application
4 o8 N3 s _9 w0 T# Q+ a - *
1 @% f! A2 Q2 t' y, U - * This file contains EDMA3 Test code.+ f3 [$ @4 t& S6 j+ E
- *6 h4 l0 U% R ?- k$ V( J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- x6 s1 J! P) K# R& Y9 t* t( `# |. C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. ^$ Y; ]) H: c% ]9 }# g - * TO CHANGE.
: E- U9 V2 B1 w# L; @1 e - *
/ Z% N5 S# F, o" \! \, C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 _1 p* F5 R/ K2 g - *5 _9 L( z# m/ G) z
- * This program is free software; you can redistribute it and/or1 d* s5 B8 t: z
- * modify it under the terms of the GNU General Public License as" E: ~+ s; k& S; @* H8 A' H
- * published by the Free Software Foundation version 2. H7 X5 |, ^8 `& k
- *2 N% E- A, `8 o/ j, A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# x" w5 |4 Z# T
- * kind, whether express or implied; without even the implied warranty
% \' ^' f6 E* y, s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ i+ W! y B+ P. j; V8 R7 O - * GNU General Public License for more details.
2 k3 M0 n' `1 w8 f; A0 G. O0 B - */" V1 ^% s) m" Z5 ^
" {4 x' `/ f+ l, H+ r# j9 d- w- #include <linux/module.h>* F4 h( W4 `3 |
- #include <linux/init.h>
" c {* P% H1 R - #include <linux/errno.h>8 [9 ~& d# y8 A' w# {; L1 p! Z
- #include <linux/types.h>
' K6 E# Y: ?) |5 k) p3 m - #include <linux/interrupt.h>
z' S r8 ]$ c" b9 |3 m6 Z - #include <asm/io.h>
; c _8 k6 Z8 _ - #include <linux/moduleparam.h>0 E% v9 v, g# E& g! S
- #include <linux/sysctl.h>
- W& n& H- R6 C' a/ r - #include <linux/mm.h>
! s" f6 M2 p. g U - #include <linux/dma-mapping.h>
0 W- Q# B4 H1 h; h9 F' A - 6 d' [: p7 b0 J; n' Q' Z3 |
- #include <mach/memory.h>8 b; Z: y; B2 `6 N5 t. S7 [. [! f
- #include <mach/hardware.h>. G6 V. t$ k2 B4 J
- #include <mach/irqs.h>/ w7 [1 H' @- {$ W
- #include <asm/hardware/edma.h>
$ h' ~7 z9 t# p! v/ D8 v
; e* k* t# z+ ]# v- #undef EDMA3_DEBUG) ] i U2 G+ s, c+ C6 e8 `
- /*#define EDMA3_DEBUG*/
9 M) s% q) C1 o - 3 v/ w/ l% H" p0 p, |1 h
- #ifdef EDMA3_DEBUG& I/ R9 ?6 r* N9 n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A: A7 _ q" y' b, \2 G6 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ ]7 k& S6 U; v; O& V# M. a5 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 [/ p7 O2 `4 h$ n4 Y6 h - #else
) G: }# j5 J3 f- j5 \ - #define DMA_PRINTK( x... )- L' b% t- q |4 R
- #define DMA_FN_IN3 {. j% I; c$ v/ v9 A
- #define DMA_FN_OUT- y7 q3 L( q) |
- #endif
3 K: X# f' M3 B, }6 |- o( c
( u- z! g; c. L- k- #define MAX_DMA_TRANSFER_IN_BYTES (32768): H3 z8 W7 T+ ~, S
- #define STATIC_SHIFT 3
+ n$ y! T w7 k, r - #define TCINTEN_SHIFT 20( p8 Z$ |0 } l- t0 ?3 I
- #define ITCINTEN_SHIFT 21% n4 z+ O; ~$ L7 L
- #define TCCHEN_SHIFT 222 B2 x& d# T, D; T: ~& R3 x
- #define ITCCHEN_SHIFT 23( N5 V s3 o4 s& n7 w8 |" q9 Q
- C% y$ T! g" n' s" f% o+ u
- static volatile int irqraised1 = 0;" E7 e0 g# F$ y, F) @: F8 @
- static volatile int irqraised2 = 0;' J4 u; g# N' `# v; W* T
- 4 m" X$ T: K& ^- ]( W- c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ Y1 U( ]- F E! v/ w0 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 _% H. D# W0 X- n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {, Q9 G6 s& @/ A- k
- - F3 k$ a' @ J* p) _# V/ G" W
- dma_addr_t dmaphyssrc1 = 0;
5 Q" s* M5 e3 P" |4 q4 u: l4 u - dma_addr_t dmaphyssrc2 = 0;
" N+ x4 w& p; M; u* @9 P - dma_addr_t dmaphysdest1 = 0;
- A% ^# B% {- ?& n' `% J, f- E - dma_addr_t dmaphysdest2 = 0;+ C& s5 I9 Q( @5 o2 L
5 F* s3 b" I' ~) w. a# Y6 z! U- char *dmabufsrc1 = NULL;
' l3 ^; P" O3 b: P5 K% _+ {+ d: ` - char *dmabufsrc2 = NULL;
3 E/ C( g! l `$ D - char *dmabufdest1 = NULL;
3 p1 C0 a( s: i/ s8 p y - char *dmabufdest2 = NULL;! {* g2 d4 p- L9 t0 j2 ~- E$ c
- # o0 z4 v$ X- {7 }# o! r0 Y1 n, F
- static int acnt = 512;/ J9 s. d& Q4 T5 j
- static int bcnt = 8;
9 ]% w1 Z$ J2 i - static int ccnt = 8;+ x1 c3 x' v) i7 f+ ^& V
1 D$ }0 q' O, Y# v& C- module_param(acnt, int, S_IRUGO);- e# r# Z. Q+ Z' S# d' f! Z' ?( [( J
- module_param(bcnt, int, S_IRUGO);
% v9 c4 H7 t* j - module_param(ccnt, int, S_IRUGO);
复制代码
/ m, u; H* a: b! T" c6 v( n( K, k& ~ M6 {" y1 ~3 ? y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 h$ e: U0 s8 U- uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% u' f1 \& ?3 V- u% s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* S* i0 F( Q9 r' J8 |. [/ m+ T; ^8 n9 }- _( V) D: K
: m( V- a3 t# P+ I |
|