|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / M8 q: \& ?7 \0 j6 h ~; a& O
- [code]EDMA sample test application
; |0 T8 M$ P% p1 X8 t - /*1 a8 m) T& G8 n% t4 T) O
- * edma_test.c- ]/ Z* V8 U" I5 A+ k4 `
- *1 H, j( Z/ X! u% h
- * brief EDMA3 Test Application
2 y. e, f$ A a/ [6 z - *
( _. w+ `5 \$ o - * This file contains EDMA3 Test code.* J* O: s5 ]2 |: A; N
- *- Q0 V/ w& a4 \3 n9 y6 s1 z! p5 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' y: \2 |6 \9 q8 c4 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, l; Y8 T4 o8 |; z( H+ s - * TO CHANGE.& r$ A* `: u' `3 a' c
- *
2 [% d# ~* P* I- K" H) ?' \* @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% g$ u, v. H4 F- h9 h& t
- *
% A/ Q. @+ X$ v' X; N! l - * This program is free software; you can redistribute it and/or1 q' A" R, G5 z! M; `
- * modify it under the terms of the GNU General Public License as9 v. R L7 U7 m" L3 L" f
- * published by the Free Software Foundation version 2.
9 z0 [; r! R U5 g: N4 @* P - *8 Z! v( M3 @' k; q* h1 T4 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( }1 X5 Z- a- K
- * kind, whether express or implied; without even the implied warranty; \0 i3 K/ A( V. [ p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ {5 z* o3 c. Q
- * GNU General Public License for more details.
: w: D9 p$ t! |$ T- d0 k - */( ]) k0 B# c. I. D# T
- q% f) h+ a' i5 s: q `
- #include <linux/module.h>
# W: H% }; q0 ?% b) P# a - #include <linux/init.h>
; b' Y5 t0 N4 \ - #include <linux/errno.h>: B' h) f9 j4 `5 A
- #include <linux/types.h>
% e7 o( p$ c3 B - #include <linux/interrupt.h>
& o: ?5 L' B& T4 @: Z9 ~3 m - #include <asm/io.h>
1 c" E1 K4 T) P3 n - #include <linux/moduleparam.h># y8 T; K5 F2 u' ~- \
- #include <linux/sysctl.h>
/ \: r, u* G* W) s; H6 l3 v - #include <linux/mm.h>4 y4 @( H6 l: e: P$ u; V
- #include <linux/dma-mapping.h>
# p; X! A* ?. ]+ r9 p/ u
+ \. M" X$ {. |3 o- #include <mach/memory.h>! W, R0 M2 \! R% f1 y0 _" ?
- #include <mach/hardware.h>8 B1 {! {. \- A# d# z+ Q3 I
- #include <mach/irqs.h>+ V: y/ Q( ~& G$ G: S4 E: N
- #include <asm/hardware/edma.h>
7 I2 ]" l1 B. _, c0 \, h - 0 z. D& S" W% e: |: I7 U |6 @
- #undef EDMA3_DEBUG
! j" }) F( A# Q7 x& ? - /*#define EDMA3_DEBUG*/ {9 X; Q# N7 i
+ T* V2 S2 t. d; n) F7 O- #ifdef EDMA3_DEBUG' B& \' H5 y7 w, Y$ [! K- i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) H0 G, }- i- X& L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 v% s- N) r- S x2 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). S" `3 [7 z' v' }8 n* j; ]
- #else
B( P' p9 H+ O4 | - #define DMA_PRINTK( x... )8 d7 h0 K& S4 f1 `+ Y7 T6 j y
- #define DMA_FN_IN. c/ F/ A" h0 W; J3 F; H% n
- #define DMA_FN_OUT* ?& J0 {! t. H: _1 W5 M" P
- #endif
4 M. A f; d9 i( @0 A% P: a6 r4 A - ( A7 `% Q4 Q# m/ P& O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ] j/ T" g) R6 l+ [$ `
- #define STATIC_SHIFT 3
# o* E% k1 a/ |: ^ - #define TCINTEN_SHIFT 20' o& e+ V: e @4 K9 S( p: i
- #define ITCINTEN_SHIFT 21
6 U5 A6 |, s1 j L! k: a0 Y - #define TCCHEN_SHIFT 22* V) P1 |4 ~3 c: I! o3 I) {: `
- #define ITCCHEN_SHIFT 23
$ H+ U @2 ^( h: o4 }" M0 w8 P
% {6 o$ H1 b0 ^# b" E" j4 }- static volatile int irqraised1 = 0;
* s/ N- I% p' a$ D' S& P, {1 W4 ` - static volatile int irqraised2 = 0;( j# ]9 b, Q$ F
# v5 L" }- ]$ | Z2 r( ?1 M, G; n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" X# J; ^( A/ R) Z% X: Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a- \8 r) q8 Z2 h+ y0 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A4 ~5 @7 Y# q2 n
- 5 R' O: h8 Y% t* t x
- dma_addr_t dmaphyssrc1 = 0;! c/ E9 Y% q g0 @+ S, ]
- dma_addr_t dmaphyssrc2 = 0;
1 S+ a" w1 F) E: r! I5 h - dma_addr_t dmaphysdest1 = 0;& B x' j2 N$ j" |4 }$ w. X
- dma_addr_t dmaphysdest2 = 0;4 o4 w L, O: Z. s# |
- 0 f a8 K$ q) Q a& [9 W' B/ p( V
- char *dmabufsrc1 = NULL; L9 u' F) b, t ^# O
- char *dmabufsrc2 = NULL;5 k6 c6 p/ w# _4 K
- char *dmabufdest1 = NULL;. i1 R& L6 M2 s2 _8 E9 d
- char *dmabufdest2 = NULL;- `& v$ h( a, O; p
" v- O) B, [* f* F' I5 Y- static int acnt = 512;# I7 P( h9 T W+ v% ^/ c7 E
- static int bcnt = 8;6 B: Y4 m- L) n! ?3 E4 h6 p
- static int ccnt = 8;
. @: G% b6 z; b# S# I - J% Q5 d/ D, w$ s
- module_param(acnt, int, S_IRUGO);7 ~0 @, r# A2 T0 t
- module_param(bcnt, int, S_IRUGO);
3 A1 X- a0 F' s* o( M# U - module_param(ccnt, int, S_IRUGO);
复制代码
3 b9 J& P% ]# R6 v; G
9 M/ D- i c8 c- y/ V4 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 \4 U% x1 Z9 `9 m; z! V. o9 `" w
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ^( Y& Q1 l5 S/ K. n7 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* I: V6 H$ [' _' {3 h( N
( k# j6 j+ s+ J- r3 }: A
4 O* X4 t& P2 t- I |
|