|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / J6 C7 T1 i, k4 y
- [code]EDMA sample test application
# b' K: t# G8 u- C7 e& S- q - /*
3 _5 o5 d2 b% l! l* R - * edma_test.c# |; O! y4 Y: j
- *
# r5 Q9 A4 W( j - * brief EDMA3 Test Application) d& b% _: O( K! \- u
- *1 C _! d; ^; ~9 P
- * This file contains EDMA3 Test code.
2 Z) ~& m5 Z6 z2 g: l3 ?/ W- l - *
. Z% ~% W. c3 T0 s, O6 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 {4 ~, K5 W* W, B5 N/ Y W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: c9 x; Z7 J# ]% F3 E - * TO CHANGE.
7 F |9 z+ v' \+ e8 z' | - *; W7 V' n/ O }) ]# O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- y" r, V9 {0 h/ p1 Z8 Y; Q+ w
- *$ ?/ p+ a, m% W6 Z9 g3 k
- * This program is free software; you can redistribute it and/or' R- |' m! i" x1 b$ v6 B
- * modify it under the terms of the GNU General Public License as6 t6 J+ ^! h' U9 r+ f8 w8 b
- * published by the Free Software Foundation version 2.
% e+ H% q; F5 \+ \& h% O3 u" V - *
/ S: W% U5 \* Z8 L" u: Z/ ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" S( B* \. K# v/ ?
- * kind, whether express or implied; without even the implied warranty
2 ?0 L3 a" F- w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! ~# D' D" W& y0 e1 M. T3 G
- * GNU General Public License for more details.' y1 b9 N4 X$ r! K) C
- */% z# ^& W; e1 y' Y o$ e/ V
0 I4 P, j/ o( I; X* T" o# n- #include <linux/module.h>
# W: P* K( j7 w - #include <linux/init.h>$ ]& s' S+ C! ]: Z; s. S7 D% E+ b* |
- #include <linux/errno.h>
6 K7 x) Z- Q, }2 `# u: G n4 S - #include <linux/types.h>
# F, K" B$ v3 r, ]7 F$ s - #include <linux/interrupt.h>1 \1 @2 I9 ]% G5 d6 K
- #include <asm/io.h>
. W9 s# V i$ G: u# P/ m - #include <linux/moduleparam.h>
! x2 p( w8 p5 m7 P) \* I - #include <linux/sysctl.h>
: b3 E. q! ^% Y6 a9 ` - #include <linux/mm.h>
{$ L9 u4 z, ?% Q: ]9 P - #include <linux/dma-mapping.h>1 O' N( G: Q3 ^
* ~4 n* X7 R# w9 r1 f& ^- g- #include <mach/memory.h>$ |" U8 w& w% S: X
- #include <mach/hardware.h>
y+ D# p& |/ W2 e5 Y0 T - #include <mach/irqs.h> h/ c8 W4 | k% S' p
- #include <asm/hardware/edma.h>
' K6 C8 r, u" H6 T! N- s8 s
) @" W! J+ |( c! v, M* ^, P; m- #undef EDMA3_DEBUG
# w- ^& A' y' j! u9 n - /*#define EDMA3_DEBUG*/9 M+ ^# N0 k2 H7 r; G
- ' @; N, @; e! R# n& V0 n" S
- #ifdef EDMA3_DEBUG2 W4 d4 v/ P3 G0 {- e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( p! {% L5 d, Z2 g- S/ q+ e3 V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! I) c& F5 U' E! A9 b' {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) S c" X& l8 h8 K+ z
- #else, j1 Q* G1 _- |! Y
- #define DMA_PRINTK( x... )
* x1 j8 `! `. T& D1 Z1 |: K _1 y" X - #define DMA_FN_IN
1 Z7 D/ a3 o! b/ ^7 b7 ?/ | - #define DMA_FN_OUT
# v+ T; Z1 |1 p4 N3 c$ ~ - #endif
: ]9 x! A- a- r. e. _ - . d% {3 A+ y/ h2 K. i' d) s* j( g% R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 e6 f6 @2 s$ X' s/ ~2 x
- #define STATIC_SHIFT 3- V0 c4 n- b; T* T
- #define TCINTEN_SHIFT 204 _$ R" K0 D3 O: N
- #define ITCINTEN_SHIFT 21) t" {! i1 b7 \+ j7 b+ P g/ _
- #define TCCHEN_SHIFT 22; v+ X: E6 U" b# G
- #define ITCCHEN_SHIFT 23
) b9 d& i( a% D% r, @. t7 {7 h - - O# B% j- X5 x1 F5 m
- static volatile int irqraised1 = 0;
* w1 Z' n1 m. R |- ?- O3 ]6 R - static volatile int irqraised2 = 0;+ n; |) F- A. N6 \$ T# F
- 6 X; ]; N z5 q2 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D" z) m! q" R* P# q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F* c: z" J6 c& ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M1 P: V7 [5 B( L. Y
- * y" g- ?+ }! v4 Y. Z
- dma_addr_t dmaphyssrc1 = 0;" q7 U2 l% e( `( t, Q- A7 j
- dma_addr_t dmaphyssrc2 = 0;* o) ~! q9 h4 G5 H/ A+ m- h; s
- dma_addr_t dmaphysdest1 = 0;
' j4 T8 k) d1 W r/ Z - dma_addr_t dmaphysdest2 = 0;
- |* n, I/ d/ B& K
( B7 p f" w" L9 s5 Q- char *dmabufsrc1 = NULL;! R5 W* O7 J# N. Z) q- C& Q
- char *dmabufsrc2 = NULL;
' a8 k1 K) A9 G - char *dmabufdest1 = NULL;
: s2 `: n. }4 G - char *dmabufdest2 = NULL;! Q" S2 m% h, ~) L3 z& ?( A( F
5 K2 N1 E( h; m7 y* C- static int acnt = 512;
. p* ^( Y$ S/ Z; t - static int bcnt = 8;' V4 @0 Y/ \& F$ E/ S" I8 r: q/ t
- static int ccnt = 8;
8 U5 r$ }& c) h( c, H% v# J3 s7 y - 9 T4 ?. u4 d6 {9 M# _
- module_param(acnt, int, S_IRUGO);
& F" K, C9 [! Y* @! ? - module_param(bcnt, int, S_IRUGO);
' J4 s* ^1 V, t8 ~" }+ K - module_param(ccnt, int, S_IRUGO);
复制代码
9 Q: }! _/ m6 p6 @6 T
5 a* F' u9 f. C" r5 Y5 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" `; t; n) I! a8 u$ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- r9 z& q+ u0 }+ n- T% v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ?" j; `* S: ]3 T$ D$ \# {
, N0 l8 K! z3 D2 [$ e# d+ w5 q4 Q& z
|
|