|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + p8 C2 N& ^# R) F
- [code]EDMA sample test application* B1 ^/ b- R1 P# M. h, z
- /*, T3 E: O# A/ @4 g# ~- v% T, G0 ~
- * edma_test.c
* |2 u; A' u6 B - *% |( f) W: |& @( K/ t% ]) k
- * brief EDMA3 Test Application
- f6 d2 F! d/ i, T$ r: F - *9 \4 L2 H1 v. ^! J* S
- * This file contains EDMA3 Test code.
. R# v( V- v- d1 _0 z - *0 t' U: l/ `% i" m+ o; Q, c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 `. |( S2 q% B' Q8 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ R" e1 P" e0 [& u" V* D - * TO CHANGE.
. _$ \9 y; e! S1 u: `& { - *
+ m! D( v, ~; o4 W8 A Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ a! m# C: c$ e7 M& B7 G! P) ~# `
- *
: ^3 H7 ^+ X7 t2 A8 k - * This program is free software; you can redistribute it and/or {' w8 }" i* K7 b" G; x
- * modify it under the terms of the GNU General Public License as
9 ? L M& Z9 W( Z) x0 ]+ \ - * published by the Free Software Foundation version 2.
. m4 r1 i; g) [: z5 M' ]" Z - *
$ j' R& H' |* M C/ Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' x( D U7 o6 l
- * kind, whether express or implied; without even the implied warranty
0 K; u3 ~9 f' t" W/ T8 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' r" M2 H- M5 E: m& i3 o
- * GNU General Public License for more details.
: B1 J; S. U) s+ o - */1 `3 Y5 i* o; W* e9 B! v6 V
: e }! r2 K ~( A9 Y0 ^1 q* X- #include <linux/module.h>
$ m! m+ t5 K% `3 a2 b# j: p4 o - #include <linux/init.h>5 k3 B2 }- e1 G! p$ {9 k
- #include <linux/errno.h>: ]. S# y8 g6 S0 r6 K: K/ ?
- #include <linux/types.h>
1 }0 m/ ]0 }- @- M# W8 ] - #include <linux/interrupt.h>
- S# W- z! ~3 {0 \ - #include <asm/io.h>
# C9 O2 C& s' {! O" Q+ p3 @; i - #include <linux/moduleparam.h>
2 V9 M5 i7 a. }- h/ x - #include <linux/sysctl.h> x! Q* R3 J" \& J5 j9 U4 Y# _
- #include <linux/mm.h>" E4 O- T Z% T; V7 H
- #include <linux/dma-mapping.h>
/ }& Z) o% Z" I. ` - : q9 P5 q, e& P8 z- {& _
- #include <mach/memory.h>2 Z! ]! U& |2 Z1 c/ h- @
- #include <mach/hardware.h> w- d$ g4 h* ?9 K
- #include <mach/irqs.h>
& t9 Q' ]. z2 q& j% j$ t; Q8 Q - #include <asm/hardware/edma.h>; O6 _* i9 {3 X. T4 A
- 6 g5 F" n; r" k! @
- #undef EDMA3_DEBUG
" ?1 p9 q; A6 \( P. c - /*#define EDMA3_DEBUG*/6 y0 h+ F; e" y! O( Z9 A" p9 i
9 z# `% `( V8 ?. i8 K A: h% ~0 P1 o- #ifdef EDMA3_DEBUG; t: \* g+ y! j `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# r) E+ R2 G- ~ A# G& s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. g5 Z9 E0 @6 q" F/ `9 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" N' l4 P# ?+ R- h8 h7 j- j
- #else$ W) Q4 v# u9 o
- #define DMA_PRINTK( x... )
$ `, w! C% H( j( v0 t - #define DMA_FN_IN
: I. ?1 j" I/ O. i& a - #define DMA_FN_OUT
* [( P4 m7 M8 i9 ^) N6 i& G/ ` - #endif- C4 @% Y2 _3 Y1 R6 |
4 _6 F! l8 i4 b/ e1 _6 F1 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ?8 W2 {! L2 W T7 j# l- c
- #define STATIC_SHIFT 3
{) ]1 i1 D/ a h5 G' F# r0 } - #define TCINTEN_SHIFT 20
" |7 h( s. m- H S - #define ITCINTEN_SHIFT 21 B2 f% G7 T) m9 ]/ o2 h
- #define TCCHEN_SHIFT 22
- Q3 ]* K* C* ?( @, ^ ]: C - #define ITCCHEN_SHIFT 23+ e$ ^" o) n/ U7 F, e
- 3 M0 }* G0 T& h7 s- y7 u
- static volatile int irqraised1 = 0;% Y: u/ F! V0 y+ p
- static volatile int irqraised2 = 0; ~' q+ `8 e$ X
- 1 L* L m; c7 t& H9 P9 f1 e* p$ f5 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ @0 W, Z& v! ^8 D! Y6 g f* t* m: q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D; V3 ~0 \. Y* F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I8 w1 l8 c" j: n1 s# H! p$ M8 o
3 D7 i4 H, r% A* ~. ]- dma_addr_t dmaphyssrc1 = 0;
4 t( O: X# _; }" E - dma_addr_t dmaphyssrc2 = 0;
6 n- ~; n5 s4 i3 G9 G& [0 X - dma_addr_t dmaphysdest1 = 0;- I( W3 [, Z: `( I% _# H
- dma_addr_t dmaphysdest2 = 0;
& o& c" v* n" J* x: ^( x1 e, Q
! R' J a; f1 k- p- char *dmabufsrc1 = NULL;! I2 B7 n. I9 T! S
- char *dmabufsrc2 = NULL;
- `& Z% v0 O( D - char *dmabufdest1 = NULL;
- Z8 F" y6 j$ R6 f - char *dmabufdest2 = NULL;. n& z( ]& w& y4 K9 I
! \# X6 q1 u8 r" A0 ?6 G: @$ o% O8 H& Z1 n- static int acnt = 512;" C: D5 W! U. m. s+ O( |0 T! X
- static int bcnt = 8;
* ?- C( b& i" b b) L( I9 w - static int ccnt = 8;
! F9 c& b# q2 B2 n V6 n
1 y) C& C2 }) }& \! [9 F- module_param(acnt, int, S_IRUGO);7 g' N, Z/ M! X3 S
- module_param(bcnt, int, S_IRUGO);
) h( A6 p! r5 b! y - module_param(ccnt, int, S_IRUGO);
复制代码
4 P5 g) F3 ~9 [$ V- Y y% H0 Q+ |1 x) O! e* d5 W" Z1 q6 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* Q% `+ [8 u [- Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: a* f4 L( E9 p+ s- A( T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- ~9 ]# D5 {. ^ ]
7 y% A# y; r& n
' X* W } ~ r: [ |
|