|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; y% n: R/ H* z8 p
- [code]EDMA sample test application
- k+ G# f/ k7 O9 Y7 T$ N% l - /*8 X1 J8 w" a' B$ ~$ Z1 q
- * edma_test.c
! {5 ^. s+ D+ @! S9 e; d; d - */ J& Y& j+ g0 l/ h3 }3 u
- * brief EDMA3 Test Application
; u+ Y3 m7 E1 p - *
: Y1 L3 I' _9 K. t+ W3 ?) A - * This file contains EDMA3 Test code.( e: J4 \7 g5 j8 c. G% z( u
- *
/ \$ s( h& ^0 s! Z8 L6 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; v7 r3 }7 F# s' z) D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G" x) P4 y* F9 e- C6 e- P
- * TO CHANGE.
0 x' c6 n- B7 n2 W& G - *
$ n# ^# x3 u7 d* ?! c/ D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% ~& h" E1 l9 y5 {8 N - *" I! y& w/ ]7 G6 ?- @" X: ~) S8 K
- * This program is free software; you can redistribute it and/or' U& F& T |& `& [0 T) I
- * modify it under the terms of the GNU General Public License as8 W" ]. I5 i, G& L8 w8 u8 U
- * published by the Free Software Foundation version 2.
# q( F' q3 O0 y- [ - *# R# K/ k% e4 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 o$ w7 p4 a: y j( H - * kind, whether express or implied; without even the implied warranty7 w' n2 L A+ ~8 C+ k9 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 M0 r: o j* _" F B
- * GNU General Public License for more details.( r/ u' ~: D) ^) f" V* k+ H
- */
* f$ @, a' ]& n2 g' \3 T# i" E - 2 J! P% N, |, t3 Y- N6 r
- #include <linux/module.h>
, o* z' l0 m" b3 i1 x" x* R - #include <linux/init.h>
7 a+ B A( d2 J7 D# m- i! l; D - #include <linux/errno.h>
! s4 V; X4 a1 Y* v' }: F4 Z- U/ u: d - #include <linux/types.h>
. V8 t" d- m+ d: i! n - #include <linux/interrupt.h># V5 I: f5 b+ b! R, y
- #include <asm/io.h>
3 C+ R0 S% Y( Y! w! m6 T& P, f9 `9 V - #include <linux/moduleparam.h>
# \- _5 t3 z% y* v9 T" t3 n' J - #include <linux/sysctl.h>- J7 S3 ~) Q/ }
- #include <linux/mm.h>
8 @2 A2 W3 z+ O% Y. S6 p/ A/ P( d8 C - #include <linux/dma-mapping.h>
" m. u8 d/ ]; g1 C4 \$ B - ( n+ v; {$ O) {* k" `1 [% H
- #include <mach/memory.h>
. l+ r+ l$ ? w - #include <mach/hardware.h>% s. [( B+ | B8 ~8 B+ s5 h
- #include <mach/irqs.h>: d: D% }) ?" K% {
- #include <asm/hardware/edma.h>6 O. t5 H; D: p* u; u& f
- ' |0 d. h9 ^9 r8 i' H" M
- #undef EDMA3_DEBUG" K, S5 Y$ M1 `( V' R7 i1 L
- /*#define EDMA3_DEBUG*/
% w3 ]- V6 F# \. i4 `% ? - , o4 ^: \0 u8 Q; T
- #ifdef EDMA3_DEBUG
0 g& n; i }" Q5 `4 ^9 D" A( l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! I! f% ^: \, `# \: s+ {3 ?; L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a# X1 }! S2 ^" v* x% T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' a/ }4 T; Y9 D; a$ Z! L - #else9 i$ h1 R! k$ F# k' B
- #define DMA_PRINTK( x... )4 n" Q/ y; `' A) H2 N
- #define DMA_FN_IN: f9 k5 w1 D% R: t' n- [! K
- #define DMA_FN_OUT3 g, K% A& F) w6 ]+ e; v6 }
- #endif7 ^' e5 b* n$ O
6 _: t; n1 G3 K" T: D1 \) e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( o1 A! X# G5 D5 ]) E" x0 T
- #define STATIC_SHIFT 3$ C+ Z0 ]# L z$ g# O: j B. y: `
- #define TCINTEN_SHIFT 20
! }2 ~' u! J- z. [7 K# Q - #define ITCINTEN_SHIFT 21" M4 I3 g+ U- j- n# p8 {, K0 l) u
- #define TCCHEN_SHIFT 22
: l; Z: C& O! l/ ~+ s3 \) d - #define ITCCHEN_SHIFT 23
9 m/ i; Y% W9 z1 F _2 `. E - ! O9 M+ m! T# I' x* m1 I3 i
- static volatile int irqraised1 = 0;
9 V0 ^! P- z4 A. n0 q9 e: W' u - static volatile int irqraised2 = 0;' J7 Z2 {) D; I, g
# G4 l8 ~- R1 e8 \/ s+ |) l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" `- o- G1 K/ k1 V# U: u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O0 ?3 G* ^+ X$ ?# o4 z- ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( n# k# B2 E4 P1 Z* Q: Z
- 5 S. h( f, g. s5 M/ r" }
- dma_addr_t dmaphyssrc1 = 0;
6 t) x7 b$ g) s* W# d# I - dma_addr_t dmaphyssrc2 = 0;( H$ y0 j- R* K& v5 ~ U' k
- dma_addr_t dmaphysdest1 = 0;
7 ?: e6 G7 K8 C% v' I - dma_addr_t dmaphysdest2 = 0;" T) e# c3 ~ w4 ^$ z
+ Q- y) U4 r3 S* f- char *dmabufsrc1 = NULL;! q) d: X3 O! [0 V
- char *dmabufsrc2 = NULL;; }$ H* ^# \, v @5 M B
- char *dmabufdest1 = NULL;
+ _0 C, n6 o# S7 M) | - char *dmabufdest2 = NULL;
! Z* j$ Z/ @. v/ { - & l, A4 S! E( b6 i, u; R
- static int acnt = 512;: w& V' A& a% G3 {5 F* Q0 W$ O8 \6 ]- E
- static int bcnt = 8;
. J; \. K3 D+ c0 o( J& o* ^ - static int ccnt = 8;4 z2 c* | }! q$ \3 p# n
/ r$ j/ c2 D' N: p+ Q- module_param(acnt, int, S_IRUGO);5 `% z, @4 ?+ q# K5 \1 a* f6 j8 q
- module_param(bcnt, int, S_IRUGO);+ h8 G! `8 J* M0 @7 \4 q
- module_param(ccnt, int, S_IRUGO);
复制代码
1 j, i& W4 @/ L& ~; |- L4 O8 [
6 F6 G( w/ ^4 [6 B, |% Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 a# [. v: F& {) F# U- k' Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ?9 P7 E; L' F' ^! A; T3 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' @* e) J2 B# E" g9 l U
Y% b4 E) B. o5 h
1 ?- c& ~+ A: g: c: F |
|