|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # K6 r5 y: T |+ Y$ w
- [code]EDMA sample test application
: ~1 P( t2 Q8 |: |8 U7 j/ ~, Q - /*
( O4 r. z3 Q! T - * edma_test.c
2 ]! t7 D6 m; x2 A- s7 `! t1 C - *
[6 B M) O7 F. \ - * brief EDMA3 Test Application
9 a8 W+ o7 o3 b9 Y - *
2 H! h1 l4 h e! m. y' \. q7 V - * This file contains EDMA3 Test code.8 s6 V$ O q( H z# U3 n
- *
9 F5 @0 j9 M5 R" @; D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! `! l# t' ^! P. J# E+ g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 Q2 l6 x. i# N7 P# ]5 h- I( ?# _ J - * TO CHANGE.& ]( P8 h" v" g
- *
3 d1 V5 W8 r: b [+ P( L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( P, F1 a; t+ D/ k1 \
- *2 k; Z# A9 V, o' @9 G
- * This program is free software; you can redistribute it and/or
% ^) F1 |$ _! S5 w. j1 A - * modify it under the terms of the GNU General Public License as4 ~/ c5 I' `5 v0 x
- * published by the Free Software Foundation version 2.
/ h u/ V/ w( q" j+ b, ] - *6 z* C; n% A3 c+ y n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: T. ?+ D) r: g D* O+ ^1 J
- * kind, whether express or implied; without even the implied warranty
) B/ S6 _0 C9 A7 @1 A% H, V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 v1 D1 C8 @; s% T* N; l8 z+ b - * GNU General Public License for more details.
2 S7 @: j3 _5 g' N0 K2 F# O - */4 p% C2 {. o2 i8 y
$ Q% A) k7 A. _; i. t- #include <linux/module.h>
, K& P: |) }& M, G* E - #include <linux/init.h>
G9 U$ y' P) i% D4 H - #include <linux/errno.h>/ |: O0 \4 u$ C( Q; T; s: _! j
- #include <linux/types.h>
2 @- G" S% G/ S+ L2 T - #include <linux/interrupt.h>* I7 W. Y* X9 m4 `3 E
- #include <asm/io.h>
1 g1 l& B" ]8 a% k% U - #include <linux/moduleparam.h>
; L. m3 V& U1 _! u# {( _' J, \ - #include <linux/sysctl.h>; `2 L, C- P U4 F5 G
- #include <linux/mm.h>
2 N; U; A7 p9 b& r - #include <linux/dma-mapping.h>6 j: H0 j) W9 }8 i7 |& Q4 X
1 m2 Q* x# k# f2 x) K( I1 j% x- #include <mach/memory.h>
* d8 r/ k' A- |9 s. O - #include <mach/hardware.h>
% U1 S# L* r. L* i( \ - #include <mach/irqs.h>: a% W. S5 u$ K/ }
- #include <asm/hardware/edma.h>: P, c4 o' S9 N# p' i' i% W
L) { V( y r& E- #undef EDMA3_DEBUG" t/ X* C }8 R2 F9 r; L
- /*#define EDMA3_DEBUG*/2 D$ x0 V1 P% Q6 G
: H8 M" q0 `8 l6 y6 V0 P- #ifdef EDMA3_DEBUG5 ~. y$ a+ H2 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 c7 Z q3 k; z4 C* j$ O/ D! p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 B: M6 T: O, r6 P3 ]' K1 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 ?) ?# v+ X% X( Z( L - #else1 ]4 A2 B5 L0 w* ^
- #define DMA_PRINTK( x... )5 H; K. q" x3 Y
- #define DMA_FN_IN+ i& [+ u" q( O. ~! L* m2 M% C
- #define DMA_FN_OUT. }- U: B# H% k5 G0 e$ r/ K! K
- #endif
& u/ f) x5 y1 b, x1 y - 3 T3 d; n1 P2 S+ u+ a$ J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ `6 o/ ?5 w9 Z" r - #define STATIC_SHIFT 3+ b0 s& z7 M6 p$ I
- #define TCINTEN_SHIFT 207 n/ }' _: ?5 |: X
- #define ITCINTEN_SHIFT 21
; A5 B0 Q: X" x5 k9 N' x, n0 ` - #define TCCHEN_SHIFT 22, q' E/ n) i1 A' _& ?) ^$ O9 N
- #define ITCCHEN_SHIFT 238 h, X4 {7 E$ d i1 P6 U, {
+ L0 f4 G0 A* Y/ m, e- static volatile int irqraised1 = 0; [0 }3 X$ O2 e0 e7 \
- static volatile int irqraised2 = 0;
& q7 g+ B n7 f( |, X. r - 4 D' o4 ~. s8 j% a1 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ L0 F0 \4 [+ y' ?. M* m- I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 F& w9 G! m5 }5 O9 G) Z# e) ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O$ s/ ~7 `2 m# c- z$ d
0 D- A- m A% a3 ?5 b" A2 v( X9 _/ ~- dma_addr_t dmaphyssrc1 = 0;! b2 l$ v- T& a; x2 Q) W
- dma_addr_t dmaphyssrc2 = 0;! O% g: ^. J3 X- |' v$ }+ z
- dma_addr_t dmaphysdest1 = 0;5 J1 O' U) _4 f; H
- dma_addr_t dmaphysdest2 = 0;
9 X& |! e. ]. x6 Q" e, D/ C - 9 m, s4 _# R k- c
- char *dmabufsrc1 = NULL;( {: A G) S/ S& f6 B s3 V R# L) G
- char *dmabufsrc2 = NULL;
1 n3 _( t/ S: D/ n - char *dmabufdest1 = NULL;2 {0 M% ^4 Z/ [# V+ Y) t
- char *dmabufdest2 = NULL;; _: [1 a' T5 [3 t1 @* t( R
5 {: r" k2 i$ H2 F2 [- static int acnt = 512; u D0 ^& v, w7 ]
- static int bcnt = 8;
5 h! _5 @$ \3 C$ D% o' @ - static int ccnt = 8;
5 ]/ a4 W, v% R: z6 | - : W/ O2 ~$ M4 @7 O! y; H) f. B
- module_param(acnt, int, S_IRUGO);9 ]% ^) L0 v; c6 }' o
- module_param(bcnt, int, S_IRUGO);
2 u2 f- S) w4 s. {# c2 Z - module_param(ccnt, int, S_IRUGO);
复制代码 % o; v0 N4 [, K
5 p& C3 B; N" W. H- v0 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 [9 @3 _! | g4 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. U" v L' J* S1 t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; q- S' Z6 T6 o' X6 m
- R2 g5 ~, @/ o4 s ^' ]" X
2 I7 A4 L1 L% D4 v [ |
|