|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( G2 ^0 W( H5 N: z
- [code]EDMA sample test application
]3 ^; S+ I! v+ X7 T5 b - /*
4 k) v+ `1 W1 z a - * edma_test.c9 M: ^6 `. W8 n! f- \2 Y% E% @1 p
- *
( n9 j/ ~5 p0 ?: w: } - * brief EDMA3 Test Application" F8 w& r& T( W9 L9 X: d
- * u$ [: w% R1 f1 w! X4 c
- * This file contains EDMA3 Test code.
( `: }0 @) e% [# q+ u4 f5 b - *) c" J# D P% ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" C2 W5 j7 {% A9 P! i: k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O4 F2 C X* h% A8 w7 K* K
- * TO CHANGE.: Y9 W) |: R7 j" L
- *$ F/ V2 b) u! L! m& T, [, m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Z" O3 [7 h3 G9 I- e
- *; ^( w% i- A. D/ M' N4 I
- * This program is free software; you can redistribute it and/or
/ J( J4 I: g# _, `0 A. T1 A! C - * modify it under the terms of the GNU General Public License as) }' N* ^7 q1 b2 }$ w6 x+ |
- * published by the Free Software Foundation version 2.
7 a0 f4 Z8 p9 r M - *
5 B8 N3 x( k$ c$ \+ n* k2 D( Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) d, L8 d$ i5 S+ d
- * kind, whether express or implied; without even the implied warranty
9 d2 |1 ^% j/ _! m, [) q( M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 f8 m2 v3 h4 @! t& T
- * GNU General Public License for more details.
: J8 w* v* `( v - */) |+ L* o+ {2 K; N% t% H0 ~
/ o- d1 U) U0 N! {" t3 i. ]- #include <linux/module.h>: {) L7 @- D+ Z
- #include <linux/init.h>7 w# Y4 C+ j' c4 w3 }* i3 k/ K' Y2 Z' v
- #include <linux/errno.h> T" q n& a/ {: _, h+ ~
- #include <linux/types.h>( N& v7 e9 b& v/ {: B! n
- #include <linux/interrupt.h>+ m0 b6 S8 Z! l3 s8 B, W
- #include <asm/io.h>
; h3 L! U& e6 ^2 A" |# w6 E - #include <linux/moduleparam.h>
# }5 M& F5 ~0 m: f p - #include <linux/sysctl.h>
Z) B0 Z4 u* [ - #include <linux/mm.h>
; Y: b) k/ {) S - #include <linux/dma-mapping.h>, Q' \$ e/ ?* t- ?
- ; T9 s- v% j* e5 {( ^
- #include <mach/memory.h>: g8 t- N7 R+ R% ^$ L6 E
- #include <mach/hardware.h>8 N4 G- e: s- n8 B& T" s$ Z
- #include <mach/irqs.h>
; S+ r3 ~7 A3 y, r# z - #include <asm/hardware/edma.h>
- Q, d: r. X- m7 x - * j R6 Z6 x3 |, v% F D
- #undef EDMA3_DEBUG
: j* w8 L. ?( D6 W. { - /*#define EDMA3_DEBUG*/
4 t* ~( K- q) A6 A' K8 [ - ' N3 V8 M3 |$ g2 `! Y, z
- #ifdef EDMA3_DEBUG# `, e% k6 m1 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' n$ s0 V5 U" t( q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 @' c6 J! P9 M" F+ _# [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; d) U1 E3 k+ V+ d' l" u5 p - #else. t3 u5 S# [; B: u
- #define DMA_PRINTK( x... )
: |6 b$ |8 f: T9 P; J1 V - #define DMA_FN_IN7 W# s% \/ c, }2 Z
- #define DMA_FN_OUT1 ~# ^& d8 R9 n& M5 ?8 `
- #endif
" z' y4 u* r6 X4 f4 l7 l) G
* y. ^1 K( U0 Q. Z. z# M* c0 S- #define MAX_DMA_TRANSFER_IN_BYTES (32768): q( h+ ^* X# b! @
- #define STATIC_SHIFT 3
. |! Y4 z: n6 S. R& w - #define TCINTEN_SHIFT 20
8 G# z- ?5 a5 u0 e' g. P3 L, @ - #define ITCINTEN_SHIFT 21
2 @2 P5 Z; K5 N4 ^$ g T3 R - #define TCCHEN_SHIFT 225 u6 Z9 ~& o! Q4 M! h
- #define ITCCHEN_SHIFT 23* ]6 M* r* Y; | T
$ c4 F! s+ E& B) }4 R$ b, z- static volatile int irqraised1 = 0;( o; x H" }, _
- static volatile int irqraised2 = 0;% r% x8 T! e6 y# n: m( }* L
" L1 d% x4 f0 U) L9 q N, Q4 G: C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ G3 @: u/ X9 K( ?8 m/ j9 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ N" t$ } J. Q* |$ M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: h7 A1 [9 V5 x6 Q# f1 v7 H - " L( {4 ?1 u* k( U1 V0 A
- dma_addr_t dmaphyssrc1 = 0;
- Y$ g8 f. W' o2 p: P - dma_addr_t dmaphyssrc2 = 0;5 Y" x8 k1 L( H+ q" s- Y
- dma_addr_t dmaphysdest1 = 0;
4 i. w0 r2 l- m Z6 c3 P' G) `& j - dma_addr_t dmaphysdest2 = 0;. Y8 O* i; @9 [ E' Q7 I; u n
- ( i: M& R1 {) U# h' t% s' f
- char *dmabufsrc1 = NULL;
6 x& D/ J$ K% X0 i# B5 i+ N9 Q - char *dmabufsrc2 = NULL;( X4 @4 v0 v, {0 z
- char *dmabufdest1 = NULL;6 I6 i0 V# ~, {! M
- char *dmabufdest2 = NULL;! c) B o! V$ j6 @ T0 E
+ T3 u" U1 h( L- static int acnt = 512;
/ A7 K5 }4 w2 P* @& l - static int bcnt = 8;
' D3 O4 o+ \1 M+ u+ ? - static int ccnt = 8;
& F2 O% V; i9 ]" c! T
9 D c; O9 c0 K2 G6 F1 C% s- module_param(acnt, int, S_IRUGO);
5 l( `3 i1 E' @5 k4 R3 M# S - module_param(bcnt, int, S_IRUGO);/ W; B( h4 E4 S
- module_param(ccnt, int, S_IRUGO);
复制代码 # z# \8 ^, T* I' f, n
# R9 T) W! I% V6 [) w! s- N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 q' G3 X" K4 b5 f( e5 s/ _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 M2 i9 d9 q7 i) \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 i, C3 R% c9 b8 W: j5 `0 Y$ i( f B5 x q2 F) `( r
/ m/ r# f u: P
|
|