|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ~ ~# a- n. |. F9 G$ m
- [code]EDMA sample test application% s1 [1 Y. L0 `* @' @; z
- /*
9 I+ U0 ^; n; r6 o* O' P - * edma_test.c) @* f. z, S J0 r7 O8 e* ?9 m4 r
- *
' K; Q, j' a5 J; H: U6 _ - * brief EDMA3 Test Application
; r7 }! C8 H9 z( I* e/ I - *
" W; B) e b, o; S - * This file contains EDMA3 Test code.6 X% ?0 g- f+ W( I
- *! ]6 ^3 M+ Y$ a# H- @" U1 V5 N* S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- J+ x1 U$ `! D5 x7 o$ j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; ~7 e( p! F) H7 c& [ - * TO CHANGE.
$ ]# r F* U G* i: V8 g - *
4 j- T9 K( U( }. C7 w, l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 j$ |+ Q0 {) C0 Q# S - *
, q0 e( b% V1 S! i - * This program is free software; you can redistribute it and/or8 p" u/ g0 w1 B
- * modify it under the terms of the GNU General Public License as
0 l% f0 k: m, U1 |. f7 L: s* v, p2 M - * published by the Free Software Foundation version 2.; c0 i2 u l/ v
- */ L; N7 J2 ?1 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( M1 N5 i7 q0 Y- w( H) |3 j/ w
- * kind, whether express or implied; without even the implied warranty
" W& R# I% t+ } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' \; n0 H9 F4 ~% { - * GNU General Public License for more details.( N/ o% {" A+ K# A4 L( \/ n9 `3 g( {& X, \% j
- */9 X# }; i& L4 s9 e @7 j/ ~7 v
. _/ K, C: Z! M& T6 o' _4 p2 [- #include <linux/module.h># [" C( Z+ p: \' S0 F& n( c6 a
- #include <linux/init.h>
' G, }3 {/ I1 u% R- y+ `& a R - #include <linux/errno.h># J! S% k ?7 A
- #include <linux/types.h>; q5 y7 R9 @- [0 @
- #include <linux/interrupt.h>% Y! I9 `/ m# ?" U& R1 h
- #include <asm/io.h>
8 l/ f+ \3 Q9 ? - #include <linux/moduleparam.h>
/ L* ? h- N- H* O4 z: m7 u6 e - #include <linux/sysctl.h>( w7 ~* h- J) [8 Y* w6 g
- #include <linux/mm.h>
: L9 ^' s8 q% V* X9 Z - #include <linux/dma-mapping.h>
& a* w9 {9 l% F$ y+ t" M
6 t' K' e, v M+ w, P- u- #include <mach/memory.h>8 ]) g$ C8 u, U1 h: v
- #include <mach/hardware.h>4 T8 a5 f' b* r. ^6 L
- #include <mach/irqs.h>9 H+ X+ E5 q, x$ C: _7 I2 u
- #include <asm/hardware/edma.h>6 I1 T0 a: d/ T8 C, L. Z1 ~
: \# ^) @4 q' ]$ J- #undef EDMA3_DEBUG
* p% S) R" _4 x3 f. @ - /*#define EDMA3_DEBUG*/& m7 s1 P6 F+ u0 u \; x( D: Q" T
- " Y7 h" J. S7 }0 o/ L( r
- #ifdef EDMA3_DEBUG
- E: M9 c& q2 z: G2 @! x' Z& z/ M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& }, _$ _2 Y0 s o" F1 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 o. `, Y0 y& X. x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ b; j0 S7 X: i - #else$ m: j( K( Z3 Y0 }* P
- #define DMA_PRINTK( x... )
/ O0 j1 V8 z+ f1 ~ - #define DMA_FN_IN
4 J* A; G/ y# f6 j - #define DMA_FN_OUT
" e3 d q0 ?% X: I9 `# h1 i - #endif/ Q1 w$ W8 k9 W0 v! X" X' l1 W( T1 A9 T; U
& l" c2 Y; i9 z2 Y5 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Q* D4 ]3 h' i# h' |/ l% U( B - #define STATIC_SHIFT 3
+ ?2 D) P2 R' w. f - #define TCINTEN_SHIFT 20
d, C0 A+ w8 E - #define ITCINTEN_SHIFT 21" L$ {( }$ A B9 [# r6 }% B3 T' X
- #define TCCHEN_SHIFT 224 V! h) L" M3 l# F1 l K5 j
- #define ITCCHEN_SHIFT 23
1 Z' A' Z) X, j3 J
, @* c/ y" g U3 @' L* I- static volatile int irqraised1 = 0;
" K) ]7 f7 y# n: [! K$ u, k" h4 k - static volatile int irqraised2 = 0;( D- N9 P9 {, a- E$ y8 e
! w- W6 t a! e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~# H, i* ^) f+ ]0 T! h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 T$ i8 F3 O9 G# V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G* T2 T# U2 Q" K+ P, O
8 Z j7 a. w- Q7 |- dma_addr_t dmaphyssrc1 = 0;- e& Q3 w0 J1 r: ]
- dma_addr_t dmaphyssrc2 = 0;/ l5 V; n0 B4 t, F7 p: s
- dma_addr_t dmaphysdest1 = 0;
" R; _3 W) B0 l& p* r, K: P w - dma_addr_t dmaphysdest2 = 0;. E5 o5 [" w0 ]- M) _" y
4 y/ [( u/ T' R" B* o; b6 q- char *dmabufsrc1 = NULL;
/ {) T2 Z6 `5 |9 P1 m; n( l9 d - char *dmabufsrc2 = NULL;
" R; B$ Y# Z' ? - char *dmabufdest1 = NULL;
" A h( }! b' V, r, |$ j7 S - char *dmabufdest2 = NULL;8 W2 k5 k) f- S
# b, x+ ?" l5 n. n' |5 U- static int acnt = 512;
, L2 F$ }+ b5 J) i, N$ z% I t - static int bcnt = 8;
# [2 {5 @- p! U' T$ c" d4 x - static int ccnt = 8;: N* X7 n: f* r! N% g
- ( o/ l, c* l6 a# \$ `. D$ ?& l
- module_param(acnt, int, S_IRUGO);, `* Z2 y% @( R, C; y6 p
- module_param(bcnt, int, S_IRUGO);
4 U9 Z& r- E6 ?4 ~8 q# e7 X - module_param(ccnt, int, S_IRUGO);
复制代码 4 O7 D @0 H6 Q7 j
% q% |* N2 r4 \; H, P0 K6 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 B. Q9 S) `4 p+ q2 w, o! _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 w2 `. I; d) M. H2 _0 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& c7 M6 w1 L, n; \
- u/ R9 J4 C0 g9 l6 F2 @% s, m6 ^; q. ?
|
|