|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 s q/ h. s! b# b/ Y; {- [code]EDMA sample test application O7 D5 t) p: i& I C6 w
- /*
: l& I1 ^2 {7 x% @ - * edma_test.c
" {7 b* n9 h6 M2 v) t, M# G - *
# X5 C# }! ^$ G2 J - * brief EDMA3 Test Application
/ @ [+ T/ Z# Y0 P+ [' F - *
1 O s- H+ h; I: X7 g - * This file contains EDMA3 Test code.# S2 }" \( s& N( O2 S0 g
- *: D9 H5 F7 k) ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 h7 d- A0 D: b4 K/ ^. v$ b2 T, ^! E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( s& V' T% S/ Q* F - * TO CHANGE.
' o7 h6 d) T# M4 ^ - ** O ~1 n5 l+ G- Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 C; s& m2 f& E1 M& I
- *' ]6 X3 |! i9 f( U8 U# m4 W# `
- * This program is free software; you can redistribute it and/or
* {6 R" k- }" v - * modify it under the terms of the GNU General Public License as4 C! L( @: u8 a
- * published by the Free Software Foundation version 2.7 a8 Z- g% Z3 J* l* {( \7 P
- *1 T7 |" Q& O$ F+ b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: n; E2 I7 H) O3 y) \ x+ P
- * kind, whether express or implied; without even the implied warranty
( |2 A$ T2 z, u; f: V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ q7 @( `/ i8 s
- * GNU General Public License for more details. w5 v' {5 X3 f: s* {6 ]; b
- */. a% @# k1 D n# Z+ D
- 8 {) Y2 K$ n1 ]+ R5 y. U
- #include <linux/module.h>$ o/ T2 f7 {$ q) v7 t+ H
- #include <linux/init.h>7 P/ h/ J/ g# ], I+ R
- #include <linux/errno.h>
/ v! p8 N% `7 O7 C - #include <linux/types.h>
4 D* t6 r. o. t - #include <linux/interrupt.h>
( G5 ?4 W8 [1 x* p; v9 M - #include <asm/io.h>
! y. n; M! s7 ?7 j0 s- D/ d2 L& S - #include <linux/moduleparam.h>) M, E( z+ D" ~2 }0 m6 P( M+ m8 |
- #include <linux/sysctl.h>
5 g% d3 |0 |- J8 ?, B% J4 ` - #include <linux/mm.h>
; v: X8 f- f4 q: k - #include <linux/dma-mapping.h>' ?' z# t2 x, F# @) g# J4 P
- 2 m/ Q! r3 n! x) i# d
- #include <mach/memory.h>; a) k) [- l+ L; X& g; R7 m1 V8 T5 e
- #include <mach/hardware.h>$ S& u" W; g2 ?# b- f7 ?% n2 T
- #include <mach/irqs.h>) A$ k# \) ?1 X2 ]
- #include <asm/hardware/edma.h>: S- Q! @" W, ^/ x, h* A, ]2 Q
- ! f. b! F$ V7 ~% A8 n. C: `
- #undef EDMA3_DEBUG* b; V& J s# i" S# w D8 q
- /*#define EDMA3_DEBUG*/
1 t' o. j$ N8 X0 u0 W - q, S7 F( d" E% Q
- #ifdef EDMA3_DEBUG
( g7 _0 K" a6 I7 a4 S5 w( f+ T D) \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ~: x7 l+ j0 E2 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): G& b* B+ ^/ v1 y/ H6 K. q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; j3 R; B+ \. b. [ - #else! N3 b' v5 J2 W& ]2 L
- #define DMA_PRINTK( x... )3 J/ k8 H, Q4 A9 r& R. B0 H: f
- #define DMA_FN_IN. X; m: B. U; N2 F7 `, p
- #define DMA_FN_OUT5 I8 P& i( ~: @9 M* o' \
- #endif4 a2 r. J. Y" u2 J* r) S+ q
- 2 [4 c5 m, c: o. w! t* C+ z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) G: e1 Q0 T- h
- #define STATIC_SHIFT 3% t9 ?- C" q9 z- {( |9 y
- #define TCINTEN_SHIFT 20) H# d+ e R2 I2 u4 j
- #define ITCINTEN_SHIFT 21
! f# D1 t8 s* k# E! n - #define TCCHEN_SHIFT 22
9 ]! p% N/ Y" c% g! g- k, T - #define ITCCHEN_SHIFT 23
9 U- e7 c+ `; I" k2 V2 [5 n
, a) j( }5 \+ U' ?' X2 A' j) J- static volatile int irqraised1 = 0;
. z5 k* {$ ~( h- ~. ^8 ]0 e - static volatile int irqraised2 = 0;1 z! I0 A( Y. p5 o K; ~! l
9 W9 S6 }! k( ?5 r" z$ G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' `# Q) s' l) |. y# b* E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |' e. _0 d8 i2 R4 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# g( Y5 ^/ \/ q/ f2 q+ Y
X, G9 W4 Z: j7 F; |0 q- dma_addr_t dmaphyssrc1 = 0;
& o4 D* I! Z% d* @. I - dma_addr_t dmaphyssrc2 = 0;; Q8 ~4 B% ^; r5 ?# c
- dma_addr_t dmaphysdest1 = 0;
1 N: {' C( j- \- h6 u - dma_addr_t dmaphysdest2 = 0;6 d/ _6 X& S: }- x# g, D. m% N) v
1 r5 A9 }* o, g( G, k# Y2 I- B7 Y) M- char *dmabufsrc1 = NULL;
6 u9 j. |* X. g- O# ~3 w - char *dmabufsrc2 = NULL;
' F1 o$ R& _. |& I - char *dmabufdest1 = NULL; C7 I8 s7 X L
- char *dmabufdest2 = NULL;
( W) L! v2 e$ T8 L# q, x9 ?2 K4 r9 Z
8 r( h/ P' }3 j" \: | E. |+ _! D- static int acnt = 512;7 u9 o0 G" V, D
- static int bcnt = 8;
6 p# X# S4 \8 z' S - static int ccnt = 8;
' w3 I M+ _- Y8 Q3 J+ _' c# Z
# G. S, h" y$ x' A2 v$ L0 p- module_param(acnt, int, S_IRUGO);
7 [) T3 G( {6 ]2 R/ g* y - module_param(bcnt, int, S_IRUGO);
, W* L- X( f' k; I - module_param(ccnt, int, S_IRUGO);
复制代码
" e _/ F! I1 U8 A4 H" T
! G' c8 g& G3 w9 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 {1 ~ V; o( ~8 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 s7 u6 `8 ~- e8 }& C- G7 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' Q N% g2 m- ]; i$ ~, B6 e$ v
* p% y A7 o M8 ]- k
! a( }3 G0 i |. v8 \0 k
|
|