|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& s# ^7 i2 S# n- J y) u4 {- [code]EDMA sample test application- l& q5 G5 ~, g: r+ S% x) [" p% z
- /*
& g( b8 _0 i8 U% f1 \ - * edma_test.c
' B* `8 q. @+ {. w- Y# b - *
. b& O4 U& K' b2 x - * brief EDMA3 Test Application/ i3 s0 T6 G4 u; T
- *3 U! [ w; _% T/ r6 Y5 W
- * This file contains EDMA3 Test code.2 b( {% ]! @+ ]4 h" U
- *4 o: l: u' L" R; B0 ]3 Y! g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 d: j/ ^5 D- G% g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& [. {" y9 |3 i, `& [9 p! t' s6 K' f - * TO CHANGE.
# K* m& ^ X0 m2 D+ {) V7 ^6 f - *) y4 A7 E- Y$ h7 n" |* c* ^! m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
G( B! k$ H( T - ** c4 G( G" }3 Z7 E- n
- * This program is free software; you can redistribute it and/or
! I$ c" {2 p+ V- b* A: \3 M - * modify it under the terms of the GNU General Public License as
0 O$ E9 c0 O, p1 n5 U3 X3 Y' O% l - * published by the Free Software Foundation version 2.
" d0 j% N* w- r - *
8 N: G3 Q" y5 V N" b# x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
x5 g$ l+ S; H - * kind, whether express or implied; without even the implied warranty
; ]# H; p! \ p/ E' d _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, @& j* l1 N. G8 t$ A9 ?9 ] - * GNU General Public License for more details.7 F$ O; k4 ?& z* E$ A
- */) ^$ `# n6 N( |
: U' ?# L9 n: s8 |. S- #include <linux/module.h>
# K. d& `2 ?, H. z7 C - #include <linux/init.h>
$ I8 L b4 K5 [* S0 n8 \2 q - #include <linux/errno.h>
. S( B: u+ F' }& u% ^' ?5 l+ j - #include <linux/types.h>+ W4 f/ ^9 a: ^7 Z9 g3 S
- #include <linux/interrupt.h>1 G# O4 o2 ]9 q" B2 |
- #include <asm/io.h>' b# D8 r; M6 ? j
- #include <linux/moduleparam.h>
4 R9 ?7 n0 \1 a. O2 {* L. D& n - #include <linux/sysctl.h>4 S. s0 A- B/ U9 q$ a0 q
- #include <linux/mm.h>
2 z/ k: [! _# G, t7 ` - #include <linux/dma-mapping.h>6 h* m# D3 F- `$ }$ P# Y1 L5 C2 H( R
- 8 y& i$ E* t4 H/ z! _) u) R
- #include <mach/memory.h>
( T' @; `! g# @1 k1 T; K - #include <mach/hardware.h>2 k. _8 E8 x, t; Q
- #include <mach/irqs.h>: e* ?( c+ p4 m, k- `
- #include <asm/hardware/edma.h>1 A5 k& V% R% u# l! j% Q7 d/ g( p7 ~
4 b4 S: [0 v- V4 p8 F8 u6 t. S- #undef EDMA3_DEBUG
* ~7 ?5 H( S! @7 t6 h - /*#define EDMA3_DEBUG*/; H$ |# z, K& x. X
' X; G. e/ F; L- #ifdef EDMA3_DEBUG
! m4 U0 j" c- n/ n0 T T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
R& ^0 j: |" M( S% h m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ^; U1 N( x/ o* B: C: I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* c! q! H5 G. a - #else/ g$ u+ f0 w, ~
- #define DMA_PRINTK( x... )
+ y+ \; M1 M( a/ t - #define DMA_FN_IN: r, F! _, Q) [4 |
- #define DMA_FN_OUT/ b/ g$ X, ^8 z$ s
- #endif" v" V- h8 V3 E2 ?9 j: I' L
- 2 y( y4 X5 K; F+ Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 j. V! }& N% P: H- L1 U
- #define STATIC_SHIFT 3
2 v( S4 y' {+ s) M - #define TCINTEN_SHIFT 20* N& \# J" _# x( m
- #define ITCINTEN_SHIFT 21
! @! m7 i- a5 ^ - #define TCCHEN_SHIFT 22% t7 T( ~9 q D' ?
- #define ITCCHEN_SHIFT 23
( f6 r& e: z' o$ M+ X; J- o: |
- q: w" E, T; h0 `& ^; n- static volatile int irqraised1 = 0;
3 ?) i% r C6 B+ O2 ?1 v! A - static volatile int irqraised2 = 0;3 v; \6 S& ^! m- Q
- ' S- S: y1 E& o1 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; y% }3 N! w+ d; ?+ C+ q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y U2 p0 r; z: E/ j+ t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. K( ^6 t1 j) O- {7 W; G6 X( }- g! R
4 z, l, ?( p" ] R" R- T- dma_addr_t dmaphyssrc1 = 0;
, Y9 F5 S9 j o/ Q - dma_addr_t dmaphyssrc2 = 0;. C$ ^( H. Y, x2 Y$ {
- dma_addr_t dmaphysdest1 = 0;
: ^! K! t1 ~ m - dma_addr_t dmaphysdest2 = 0;. _5 C1 D3 t7 s) K
- 0 c$ A" p3 m8 u/ b+ j
- char *dmabufsrc1 = NULL;
* C4 L3 W) F$ ?7 \7 N7 _' Q - char *dmabufsrc2 = NULL;, C4 I& |: R( I5 ]. a5 _
- char *dmabufdest1 = NULL;
- c- ?4 [' z$ s4 U - char *dmabufdest2 = NULL;
. B B8 `1 j4 q) |9 D! T q
$ U8 Y, e4 `7 B$ B- static int acnt = 512;
. u+ B; W! y" t9 z! u6 u8 q2 t - static int bcnt = 8;
& N5 O# E2 Q' H; ^2 V$ U4 j - static int ccnt = 8;
/ E2 }7 u/ N6 o; P0 o, z - 9 Z5 v* h5 d- ]* v5 j1 u
- module_param(acnt, int, S_IRUGO);: w- ]7 t5 R# I# ~! w( J
- module_param(bcnt, int, S_IRUGO);- S6 [6 J& }$ W1 y
- module_param(ccnt, int, S_IRUGO);
复制代码
6 o7 K% ~5 Z0 t2 V- E7 b' A' d7 {% z2 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P# p2 @" B5 t5 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& h" F# g5 M& H p$ ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% N8 k# f4 X# G- T4 [) ~
3 v: f1 h* P" ^* o9 z4 J; S# `: d4 H: z h0 q3 J
|
|