|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 F @. b5 w1 H0 e( E
- [code]EDMA sample test application
/ H" ?. q8 T0 F/ ? - /*8 ~" V$ E, A) q6 h
- * edma_test.c7 y) q; B+ R! Q: @1 P
- * n+ T! u" f1 C: w8 ~- C7 x4 c
- * brief EDMA3 Test Application/ [5 F1 P' W' C+ j9 |7 ~
- *0 Y4 B/ P- o2 ]) B; J, e+ T
- * This file contains EDMA3 Test code.
2 T% b4 D* }; { - *
* b% F* P1 e2 r1 e) D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ M4 ?4 N) k6 Y) z! t" f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 s4 u/ `* M4 ^4 S
- * TO CHANGE.+ K: U$ W1 R% l* n
- *
; v* `& G6 M2 }1 `) V' r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 C; j# I* |, S5 E* h9 }: T7 h
- *7 h, p2 A- { F) }4 Y& H
- * This program is free software; you can redistribute it and/or p- j3 O' ?" s
- * modify it under the terms of the GNU General Public License as
+ g3 x( k" m+ b" s/ }) v! i, j - * published by the Free Software Foundation version 2.
4 P& i* c- o" E' F6 }1 V0 u - ** j$ m0 `" Q0 \& f1 v! p! h4 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 |0 r' k6 {, {1 I/ K- G& @3 o
- * kind, whether express or implied; without even the implied warranty4 \, y6 Y% B, n7 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 Q6 U. F' T2 Z7 o% @' H/ _' A
- * GNU General Public License for more details.0 H6 R* U. M& I; O8 e, W) {
- */3 B# n \2 W/ ]! h
( ^- ?( @- B9 F- #include <linux/module.h>- G, j7 p$ S% }2 L. V; H; A8 a6 f+ r
- #include <linux/init.h>
0 X+ {8 J5 o; M. \ - #include <linux/errno.h>
+ o' }- G. P* U3 ]+ h3 n* m - #include <linux/types.h>; K: U4 d4 |. q/ @0 P: P% m2 l U) W
- #include <linux/interrupt.h>
% p8 W$ {/ a; E0 [ - #include <asm/io.h>" r' F- Q4 H- P4 o, m* S
- #include <linux/moduleparam.h>
9 i- E0 @) G* w - #include <linux/sysctl.h>
7 H- ^2 P, a" Q4 L9 u8 }& T1 F( i/ I - #include <linux/mm.h>
# m4 q) v" W/ ~# O+ u+ H - #include <linux/dma-mapping.h>
' D8 n/ K3 j- P! l* ~. X" E: \
* m: i% A- N! v5 a% r/ n- #include <mach/memory.h>8 @+ T7 \5 A. `0 T
- #include <mach/hardware.h>
/ p. ?" J) H- y1 W; \! U# E - #include <mach/irqs.h> I: W' k4 j7 b f# e' y. N
- #include <asm/hardware/edma.h>
) q4 U5 E9 U6 m; k* o: C& {
' b' |/ t9 O, B& z% Z T5 t- #undef EDMA3_DEBUG
. K: g9 o1 l5 [0 k& X0 K - /*#define EDMA3_DEBUG*/
* Y; m# v: ~1 U- W/ A: y - % Z# y$ h+ y+ O" E$ d( Z6 q* }
- #ifdef EDMA3_DEBUG
' g+ `% d9 ~; ~- C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# ?1 P0 L9 t# c4 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ?! B- a* V8 _$ e, R1 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- i( ~7 J, m, `* q) E - #else
; z1 Z; Y1 v( p% `0 g - #define DMA_PRINTK( x... )
% Y0 H$ }- v$ K. T8 k h - #define DMA_FN_IN
) @# D* W# q4 i+ I- c4 j - #define DMA_FN_OUT
6 F& H5 P4 z% ~% T8 H1 X3 K - #endif6 m3 R+ q& R" _
% u* a5 S1 \8 M8 e& m, r% Q4 e- m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* f( Z* z" N1 q Z
- #define STATIC_SHIFT 3
9 b5 L$ T: }( |! F! x, N* q/ K" Z - #define TCINTEN_SHIFT 20
" w5 k _ V8 L1 `% M S - #define ITCINTEN_SHIFT 21
/ H! n3 Y* E# Q. B" f - #define TCCHEN_SHIFT 22
n. C6 S5 S2 n0 j - #define ITCCHEN_SHIFT 235 A4 P% x6 P9 K2 t, Q
! S$ k8 _- n& ^, P/ v {- static volatile int irqraised1 = 0;
- y& O+ u4 G" `& C& m) V" s, ~ - static volatile int irqraised2 = 0;
$ I' w# F/ J$ \4 l
& Q3 ?4 E' ]9 M, e$ h5 B% } k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 p3 v l; h- m* T6 T2 i' U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ]) Q. a/ q/ z: ]' G& K) O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q9 ]% \" q! j+ t: \- [
9 ~! q6 s, l7 q" ~- dma_addr_t dmaphyssrc1 = 0;/ [$ T2 O# s2 q4 K! I: z
- dma_addr_t dmaphyssrc2 = 0;. |; o, S0 p1 J5 k' \! b
- dma_addr_t dmaphysdest1 = 0;8 _' z% s- |2 J: ^6 `! u( y
- dma_addr_t dmaphysdest2 = 0;
' R$ |: W: d; H/ M- |/ j5 w/ K - + u6 g2 T) B* [" V
- char *dmabufsrc1 = NULL;9 f3 l) l- F6 ]2 D O7 r4 { p h& E
- char *dmabufsrc2 = NULL;
5 a1 X. _# r& f0 r9 [" z - char *dmabufdest1 = NULL;
" T/ J8 Q! [( r - char *dmabufdest2 = NULL;% T$ }# S; d$ P
- ; K6 Z( ~( }; q/ N9 {( K3 i
- static int acnt = 512;2 Z! [1 \# _6 c1 Q6 E" i _: a4 R
- static int bcnt = 8;
' F) L8 M h9 v - static int ccnt = 8;7 Y, ]. Z- g' W' A
- 9 Y( r) ?- b, i& @9 `% x
- module_param(acnt, int, S_IRUGO);, \9 K; D3 ^% m( n4 b- O: r4 Z
- module_param(bcnt, int, S_IRUGO);# w/ f H( e! h' B
- module_param(ccnt, int, S_IRUGO);
复制代码 , F3 b7 A2 r( C% g# `
. A5 Z( ?$ Q6 L4 y$ T$ y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 j ]! C6 A. c1 h& H/ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 b5 M% h: r) B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* i$ }1 {2 F# t8 X) C/ A+ f
% a1 m- U" G) Q
- R* D9 E$ l& H' t
|
|