|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
A5 K# {; L$ ~) {4 m- [code]EDMA sample test application) ?% U8 v% Y2 p2 z+ p6 ~ w
- /*& Z+ M1 |" ?) Y0 C0 s
- * edma_test.c2 w& ^ b2 h; K4 F8 u, @3 e! v
- *
7 w. k, g; R7 `0 y& W - * brief EDMA3 Test Application0 L/ a2 _4 K( a* \
- * Y1 `5 ~# S+ }
- * This file contains EDMA3 Test code.
) c) h4 t1 L: |1 ^ - *7 `1 X; u4 ]. L9 H# H& T# r7 n+ {* _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 q8 s: |4 P$ a/ j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ x% D, g# |2 R2 ^# g - * TO CHANGE., {! a6 O. s+ c/ A$ s
- *+ ?, u$ B6 K4 m/ a, i d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, p( H# P/ O: T/ Y
- *
, a4 `: [) G0 ^+ C - * This program is free software; you can redistribute it and/or' ?5 `1 u- l. _
- * modify it under the terms of the GNU General Public License as
# x4 x$ S& t2 i' G: I+ c - * published by the Free Software Foundation version 2.
: ^2 K1 s1 y) v# B. d8 C, N( L - *, \( `5 g4 ~% b6 s; ?6 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- I' z/ ~0 q0 w, e, o - * kind, whether express or implied; without even the implied warranty6 b, w/ J4 J4 N) T' ]+ G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! |! N) `3 O3 }" d# R - * GNU General Public License for more details.
5 y( P% v/ U2 W2 D - */
7 x3 m2 F+ ^) Z' x+ J8 } - ; t' }, c, n% U
- #include <linux/module.h>' o7 P1 l6 W/ Y: a' v2 v5 E- c" z2 t
- #include <linux/init.h>
/ Z8 L) I8 o( u. w" d9 H - #include <linux/errno.h>
: t4 k% F" ~- V- Z- b5 S% |* I( k - #include <linux/types.h>
. H8 S A& D7 D6 W - #include <linux/interrupt.h>1 ~$ V. F& a' c6 _" B
- #include <asm/io.h>% @! G8 l' f7 v2 n' s6 N; C
- #include <linux/moduleparam.h>
$ y/ x) N* J3 T% }* u - #include <linux/sysctl.h>$ L1 x7 `7 C, U% V/ W" A; p; h
- #include <linux/mm.h>
* S' }5 V9 _. J. _/ U" F - #include <linux/dma-mapping.h>
/ G- p! s( x. M6 t" i - 9 R' T$ \1 D! D; C5 M0 O. ~
- #include <mach/memory.h>
; T0 C) P' N5 g$ B - #include <mach/hardware.h>
8 f Z G% N) f. Y2 t - #include <mach/irqs.h>
* N. ]7 b$ r$ r - #include <asm/hardware/edma.h>0 o% }! l* G8 ^
& V' r8 y | `- #undef EDMA3_DEBUG
0 R3 v: | [) ]5 j0 u4 m - /*#define EDMA3_DEBUG*/
9 l- r: A% _! _, f; }
$ e& ?. G& k. u# I- #ifdef EDMA3_DEBUG1 O2 ^. ~; D: t% k$ i8 v0 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ N% T N5 @6 P: q" R8 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" { t. s' c8 d: V" ?; Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, D( i0 ?: R S$ A - #else
; b" R) e4 N" M) D6 F - #define DMA_PRINTK( x... )
" M+ l2 v& f" h$ n, j - #define DMA_FN_IN1 l) p( _: ^& z- Z- M4 b" _' G
- #define DMA_FN_OUT
8 z# h5 |+ b G# I, `3 W$ X - #endif4 m) }" t! Y: W2 K1 ~
- 5 |3 a# q L y T" E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! ^( M3 d- F) i$ n7 G
- #define STATIC_SHIFT 3
- F1 l# [! c: k1 z4 F. I3 C" c4 {1 D - #define TCINTEN_SHIFT 20. |) ^" Y; C) g6 h! J' E
- #define ITCINTEN_SHIFT 21" c' r* q% k0 n. o) ~; l2 i2 S4 ~! ~
- #define TCCHEN_SHIFT 221 g: K6 [: h: }' I6 [; j
- #define ITCCHEN_SHIFT 23
1 F T) d4 s# _( z9 G - ; l1 z% e3 M( O0 M5 E
- static volatile int irqraised1 = 0;
+ Z; r6 U* R! J6 |5 s7 y3 i - static volatile int irqraised2 = 0;
7 P+ w2 q, ^5 j# l& P - 8 Z4 ?% B! K5 c+ v- q* z4 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E- z! l' y: K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s# Z# Z8 h& S3 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# a" v9 F0 ^: M o
- ! v& x; [7 E) t2 [7 Z
- dma_addr_t dmaphyssrc1 = 0;
4 a: V2 u4 i0 e( }2 E3 K - dma_addr_t dmaphyssrc2 = 0;% v9 N( K, F; }1 g$ |
- dma_addr_t dmaphysdest1 = 0;8 Z$ J2 W( i. D9 L* B/ i1 }1 t
- dma_addr_t dmaphysdest2 = 0;" X* \/ ]- V3 I5 V# }
' ?( Z# c9 w1 V; J4 ?8 D8 ]- char *dmabufsrc1 = NULL;
$ C- h7 T& q L - char *dmabufsrc2 = NULL;
6 t. G( \$ X& [ k - char *dmabufdest1 = NULL;
( K: V9 u1 _* s; P- D - char *dmabufdest2 = NULL;' d8 L9 G5 z% ^- X1 r' U8 J
- 4 t' f3 [, [7 L0 _1 X- b0 a
- static int acnt = 512;
- s6 x7 h3 C5 B, V% j - static int bcnt = 8; ?' j3 ]3 F* ~7 J( h3 L
- static int ccnt = 8;- G7 k6 f$ `; Y
- ( e! Y& d* T% d
- module_param(acnt, int, S_IRUGO);0 q2 z1 B. P. h! b$ r+ I8 N; M# M
- module_param(bcnt, int, S_IRUGO);
% o; ]) q, U5 }; H J" s2 F- f - module_param(ccnt, int, S_IRUGO);
复制代码 & b+ Z- i4 Y0 L& O# A
; @) E. U$ Z( H# p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, J, ~3 s1 Z% j0 ?/ ]1 p: d& L9 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% \6 K4 }7 _: h" z% l+ U! O0 H) u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: i/ `/ m( @0 O
' V5 `, v" [9 D" h% `6 m0 }- ^0 n( E1 i u: f) X6 z
|
|