|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * F( m! t8 @& T1 a2 I" ~! n: G, A# S
- [code]EDMA sample test application- L. y8 R' j' _* E' v, I
- /*% `; @* @% F) n' J5 A$ g
- * edma_test.c
& Y! [- n. ^) l: f; S( [ - */ ~' w: D8 z# c5 h# |! m9 k
- * brief EDMA3 Test Application+ k3 M8 f3 b& P, B# G( K
- *
& U" v3 D0 o& p$ E+ K1 K7 P8 N5 A - * This file contains EDMA3 Test code.6 A' @2 C, y: n; ~8 L$ t, J0 h
- *
- t8 x/ u& V) T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ j; V8 m& b( t% z/ ~! \' M( J* F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ e7 z$ l- t; C4 K2 l8 ? - * TO CHANGE.; f$ n4 P {' v4 t( c. M
- *
% O: E R @* I0 Y4 q- x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ J1 R ^! f. D/ Y4 ?$ \ - *( f- l3 J9 g! n1 e& b# d
- * This program is free software; you can redistribute it and/or
4 o7 e, W$ z; l" \3 v - * modify it under the terms of the GNU General Public License as p/ F- t/ o# c2 o/ c& ~; I, X
- * published by the Free Software Foundation version 2.
" X2 d$ v1 \& C7 \ - *% t5 C% a0 J5 X5 b9 ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 L$ Q- I, s( V' `
- * kind, whether express or implied; without even the implied warranty8 R, M G1 o- G4 g* T9 x t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 m8 f$ L7 ^8 h( g - * GNU General Public License for more details.- i0 [$ E+ S; d9 h
- */: O' T% E$ E. Y
! Y; V' a% S" P D* |- #include <linux/module.h>" T" Q- U: `( f) M( V: i r" {/ C
- #include <linux/init.h>, B% G, Y! r R% T) z
- #include <linux/errno.h>. q" `# k0 T" A' ~4 k- c# P! n
- #include <linux/types.h>0 F: k/ B0 i0 N; }0 e: \% y& _
- #include <linux/interrupt.h>" U P" s. F2 S: S* I- b
- #include <asm/io.h>
& [% N* [% v" ~ - #include <linux/moduleparam.h>+ X, S5 Z f9 e8 Z! [+ U7 G
- #include <linux/sysctl.h>- e. ]9 i* h/ I: Y1 N
- #include <linux/mm.h>
: k' I3 O' }" Z4 B4 Z# L7 S& q - #include <linux/dma-mapping.h>
{% A% I, q3 e- B/ R
) e* R b5 C5 ]7 M! }! y- #include <mach/memory.h>7 R0 U5 H" l0 a6 g
- #include <mach/hardware.h>; S3 x$ F+ |0 H: _
- #include <mach/irqs.h>& X; Z6 _3 W/ l; d. |9 s8 K
- #include <asm/hardware/edma.h>! o' K8 r+ ^$ |: `+ V- k; K4 x, I
- 5 ~* B' p# j2 n' d" N
- #undef EDMA3_DEBUG. S4 K" i# u, p! m" m& }3 i$ |) I4 W5 C
- /*#define EDMA3_DEBUG*/
$ @" v/ x8 c2 j5 V
9 j# [" W( R3 P5 {- #ifdef EDMA3_DEBUG
: X) s S( N1 V6 z0 K7 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); e- G0 [ I. I5 A8 @1 A$ W. J4 {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 s+ q: ]4 M* C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; Y3 m- \+ | R1 U8 g) s - #else
4 z* l2 ~. p% D0 w - #define DMA_PRINTK( x... )
' e% x- X! W' u: q# V y - #define DMA_FN_IN! w5 b' [' d( f, Z8 R1 U
- #define DMA_FN_OUT' d" d+ z3 a4 a; d6 A) z% K
- #endif2 ^+ g2 E' g* V
- " s8 }8 `9 F' J' k, y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
q( h0 E0 x, x$ q8 z# w- n, u - #define STATIC_SHIFT 3) t) c8 @* G. _" g
- #define TCINTEN_SHIFT 20
9 ~ ]1 G- C0 L - #define ITCINTEN_SHIFT 21. V7 w. O8 e3 g6 [) i6 r4 O7 D4 {' _
- #define TCCHEN_SHIFT 221 u1 L" h% B r8 w6 q5 J0 G8 Y
- #define ITCCHEN_SHIFT 23, y$ \9 \4 I7 K7 o9 v* d8 g2 \
- ! l" G U: c O* k t4 ?* J
- static volatile int irqraised1 = 0;
( P+ |6 _. [- Z& H$ y2 }; I - static volatile int irqraised2 = 0;7 ?% M9 v3 N! `/ S1 l- y
- % z6 @( y* r3 n- U7 ?! J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d) f' _8 R4 J! i0 d. e$ p8 l% d3 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. g7 n: v* {0 s9 R1 ~6 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 l/ {* v- }! U. r$ n9 F7 { - % O- f+ m! R2 e) U. P/ a. T+ ]
- dma_addr_t dmaphyssrc1 = 0;2 Y6 y, C& a9 n) A- ~
- dma_addr_t dmaphyssrc2 = 0;: Q. p- e }% X/ i# @
- dma_addr_t dmaphysdest1 = 0;. j9 o! V& z/ M/ l# i+ ?+ k+ \" |7 L8 r
- dma_addr_t dmaphysdest2 = 0;# X$ ^2 p8 ` L, o7 R; @
. l3 w& j4 F8 q7 _/ i* w- char *dmabufsrc1 = NULL;! T( [! j u/ k( ?. Q
- char *dmabufsrc2 = NULL;
3 m: k- k1 t1 _& Z* Q2 n - char *dmabufdest1 = NULL;
1 ?: |0 @4 }) K2 L4 | - char *dmabufdest2 = NULL;9 N& d- c+ g' g# B2 @1 G
- 8 V7 h7 z2 e0 z; Y# g
- static int acnt = 512;& w5 r9 q! E" r8 x, j) q2 Y' E
- static int bcnt = 8;
: B& M2 I5 \2 f( I7 O( Y - static int ccnt = 8;
5 g# {: `4 }" A
8 R5 x# g! Q2 h% n1 Y- module_param(acnt, int, S_IRUGO);1 @1 [& `! ^. O& u
- module_param(bcnt, int, S_IRUGO);
1 G- `! j7 M8 [5 l - module_param(ccnt, int, S_IRUGO);
复制代码 / q j% O* j7 |, M
2 F$ X* L. r. `' F$ V4 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; b6 I/ N2 A0 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! C9 w) g/ H% p5 W3 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 H+ N9 l: ?, c) ] l5 x2 B/ n- y( R. K
: W2 { {; L; A9 T+ k, D2 } |
|