|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 N! L6 y& R" B; i+ T
- [code]EDMA sample test application
6 i" L8 @ ?1 s9 w. v- U i - /*
! e5 k9 U, f c0 L7 b4 } - * edma_test.c2 s1 y$ R! |- u
- *
! }( U+ d9 z7 @7 V* O! x - * brief EDMA3 Test Application/ e2 b8 E8 u( f# q) P7 J( t, C
- *
6 F+ w) h0 A# B' A, x% E& w8 E - * This file contains EDMA3 Test code.
4 ]9 m! i v5 b4 i - *# F& x% p V7 m# h4 a5 W+ C: [) b7 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* A( |7 s! t! q! \1 t' x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; p5 S' ]8 p/ K" f! J& s - * TO CHANGE. r+ } ^. d4 l) f( W
- *
$ G0 Y: l _5 M1 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ [# w5 v8 N' t! {+ i. u
- *
& f) a0 O1 J V - * This program is free software; you can redistribute it and/or6 Y& J) E8 B- E$ U* m
- * modify it under the terms of the GNU General Public License as
+ [. a- B& ?$ h! [; R! s - * published by the Free Software Foundation version 2.
1 l0 A( l Y( Q5 B2 h6 i+ @% B - *3 E, j' T9 @0 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: r, _4 t% M# h - * kind, whether express or implied; without even the implied warranty% @" e# R0 S6 o/ O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. N. z+ ~! j& |0 H8 i5 z - * GNU General Public License for more details.
8 \" x" w% j( s+ G% o6 P - */
. \$ r9 B; a, Q/ x' A - ( x0 z6 V9 P& g
- #include <linux/module.h>
1 ~6 c/ [9 p2 ]" Q/ O - #include <linux/init.h>5 d7 s% S5 W! o% [
- #include <linux/errno.h>% I2 ?6 f. E# u8 h$ {) o3 v
- #include <linux/types.h>
; f; S v" Z3 y% F/ _ - #include <linux/interrupt.h>, b0 @5 n9 `( {- E
- #include <asm/io.h>
, D B3 H8 E. @) y& p, s - #include <linux/moduleparam.h>
' W) Y" I; E- F2 \0 g- @% r - #include <linux/sysctl.h>$ x1 |0 Z8 l$ a: |! O
- #include <linux/mm.h>+ Y/ ~# z* i/ ^; J6 r8 s
- #include <linux/dma-mapping.h>6 J2 U; C @2 v5 V; X W
; V4 _# F V& b9 O- #include <mach/memory.h>
, J2 u& k/ y) }0 ^* u. e - #include <mach/hardware.h>* ^# B6 U1 r8 d5 a* @
- #include <mach/irqs.h>1 R0 G6 o. R4 B" i, S" m/ f
- #include <asm/hardware/edma.h>; R- `& ~3 c# m4 |+ v, e
* u: b9 p4 D" x) J+ b- #undef EDMA3_DEBUG
9 m) Y% ^7 C- G9 r3 u6 S - /*#define EDMA3_DEBUG*/
& d% _* E$ U% g- w2 Z" m" B6 {
( U2 ?% F" I# A0 s- #ifdef EDMA3_DEBUG! @- g( a- q# C6 }$ ^* ?) n& A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ~' l# X9 L4 m/ d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 `4 j' {( ]7 d, s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, T0 W& o( k+ h, I3 @- c9 y F0 g - #else0 V' B t0 r1 x0 ~3 o- E
- #define DMA_PRINTK( x... )# t0 j1 d! P9 X$ a% L2 O( J$ W, F; U
- #define DMA_FN_IN3 R4 A8 q. E; Y) O
- #define DMA_FN_OUT
' G. e% j% t5 Q) @; P3 a r - #endif9 I% h6 [0 ^ g- d: T
- * F/ A' i5 `" {0 l9 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): e4 S; }$ z. h' N2 P3 h
- #define STATIC_SHIFT 34 |+ _. U; Q- a
- #define TCINTEN_SHIFT 20) @; N* B- k# D" M) K% J; L
- #define ITCINTEN_SHIFT 21
4 g' C1 d8 K, F! B8 B - #define TCCHEN_SHIFT 229 g# ^$ z" Y, P. ?$ Y4 K
- #define ITCCHEN_SHIFT 235 P2 d S# r- ]. }. P' s2 D' {' }
- + ^/ d4 _, ^' w- \3 t. W% ^! o( E
- static volatile int irqraised1 = 0;; Z7 [* r" S. F% J
- static volatile int irqraised2 = 0;
1 f$ h) O$ Z( Q# W& z - * H4 M# ?! N8 L5 C; s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ N( N8 D* @" p+ b# B# ~: ^. w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 N4 z/ {$ @9 Z' Z6 y/ b* X" s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, r/ y9 ?2 b, K* k
- : J; a: `7 X- }$ L) R- c
- dma_addr_t dmaphyssrc1 = 0;8 Y/ e2 Z1 e* c/ V% C
- dma_addr_t dmaphyssrc2 = 0;
$ z7 A% S% n+ s - dma_addr_t dmaphysdest1 = 0;
- y2 X- A0 Y( R% z - dma_addr_t dmaphysdest2 = 0;
4 S7 q; _/ n' ?* |( O6 N - ) R( B# }" G- a/ n ?5 E
- char *dmabufsrc1 = NULL;* J4 @. Y+ I& k2 X! M" t1 c2 K* Z
- char *dmabufsrc2 = NULL;/ G4 o* n% o d/ x0 c
- char *dmabufdest1 = NULL;" l: p# N; R' B5 n* H/ c8 L0 V
- char *dmabufdest2 = NULL;( P- i# a# P. I i' T. X9 \
1 O. P1 s2 ?8 I* g- static int acnt = 512;
2 f! Y, F6 a( Z - static int bcnt = 8;
+ W5 y" b. [3 r - static int ccnt = 8;+ E* u+ \, h' x5 X/ T
- 1 H( A1 n9 W& U$ S
- module_param(acnt, int, S_IRUGO);
& ?9 I& S. _+ l4 f1 _' g- T9 V - module_param(bcnt, int, S_IRUGO);
& ^# n' y2 ]7 w" k5 F6 \ - module_param(ccnt, int, S_IRUGO);
复制代码 4 Q) Y# _7 U1 r4 ~& w& { f0 n$ v
4 ]4 u' B% h: s7 H( H H- P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 l$ ]' V# u" O9 Z2 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 }0 e0 t1 L5 d# Q1 Z7 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. F( t+ r, B: ~9 ^+ X0 [
+ A9 }9 q: V; l1 y
& I' B" D% f3 c/ z/ `0 L
|
|