OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14510|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% `6 P2 k- @' G0 }" f7 @8 ~4 c
  1. [code]EDMA sample test application
    0 ~$ M2 L& {3 X6 {
  2. /*
    ) m% K. P* R# w) K( p5 a4 g% \
  3. * edma_test.c
    - O5 j% x' o! p1 E
  4. *
    - p$ W# k' N" p# \
  5. * brief  EDMA3 Test Application
    : i4 `- _( f- Z. a; @% q
  6. *8 @; p0 ^. }4 S* {, N
  7. *   This file contains EDMA3 Test code.( F1 ^; c$ |! D1 g, K2 D% _8 T
  8. *
    . ?( `. P# _4 }+ d* m( G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + g6 m& C8 M7 D5 ^" B4 t% V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 B, y* M) b, m- p7 w& V! T
  11. *         TO CHANGE./ G, i( g' Q' y5 j( W8 Y1 g( f
  12. *+ G& d- A$ S& E# e  j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) S1 n* w* q. |0 k$ M
  14. *
    - L! d7 b# h7 f& Z, J
  15. * This program is free software; you can redistribute it and/or0 Q6 w& w, h; n# S  f3 Q9 L  T9 [9 _1 @
  16. * modify it under the terms of the GNU General Public License as# a- p8 f1 F7 m# _# j7 q
  17. * published by the Free Software Foundation version 2.% J1 j3 B4 U' R1 L6 H
  18. *
    % L5 B0 O/ N. b  J# n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 E6 o& ^& V8 c
  20. * kind, whether express or implied; without even the implied warranty! n: Y% P" Y( M) P: j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / g, b) `- E9 N$ n
  22. * GNU General Public License for more details.# A5 {% a- X: N& Q
  23. */
    ( J1 d' n' J# k3 r: i8 u2 I
  24. ; u5 o" s2 w; Y, c, _
  25. #include <linux/module.h>
    6 `: ^4 T; K  v( K6 @; q2 O
  26. #include <linux/init.h>
    ( M9 u7 M, s9 |& R
  27. #include <linux/errno.h>: Z2 F% S9 Z/ N/ H/ [
  28. #include <linux/types.h>; L; w8 l- x, D0 ?5 [: {) y
  29. #include <linux/interrupt.h>7 y% a4 M; l, H+ u. u
  30. #include <asm/io.h>7 }4 k3 P! p9 {: H( t  b
  31. #include <linux/moduleparam.h>8 A( v8 e) H* f  u3 O( l
  32. #include <linux/sysctl.h>" u; d  W4 z+ ]" n
  33. #include <linux/mm.h># c" ~  T; i7 G( f: U3 g
  34. #include <linux/dma-mapping.h>1 C: Y5 N' B) l% H+ Y

  35. ' S& r' j1 J6 P+ n: }, `7 I( I
  36. #include <mach/memory.h>1 e9 |$ {: {, ~& P. Z
  37. #include <mach/hardware.h>5 g: t/ W  j7 ^. p, F& r* E
  38. #include <mach/irqs.h>
    & @6 f4 r' P- I7 y+ t
  39. #include <asm/hardware/edma.h>
    2 Y" t: Z  f8 e
  40. ; t4 \# w; K8 t- o, D4 I
  41. #undef EDMA3_DEBUG
    1 F) m+ ?) u6 m- |* i  o
  42. /*#define EDMA3_DEBUG*/& D; q: m7 S' M! S. p

  43. 5 B: P( }6 g2 y& P; _- D# b
  44. #ifdef EDMA3_DEBUG: b) J% R; e# r8 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  D6 z, |" P7 `3 R; X( u9 w, X3 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % e% F$ `- N: b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% G0 c* |: P6 B4 i: W
  48. #else3 \, Y3 S) z; {
  49. #define DMA_PRINTK( x... )+ ?7 I+ L0 \( L/ w( ?7 y8 l# }1 v
  50. #define DMA_FN_IN
    & W6 l: M* R: o, \
  51. #define DMA_FN_OUT
    0 O  c5 g$ ?; }6 ^, w
  52. #endif/ F6 A, G1 n8 X: v0 L6 r

  53. 9 m' l* F$ ]! y4 x3 d/ j) L* g. H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 A2 E& b' t$ W. Z7 z
  55. #define STATIC_SHIFT                3  \5 u& G$ u, c
  56. #define TCINTEN_SHIFT               20. y. [& {2 C, u0 ~/ A
  57. #define ITCINTEN_SHIFT              218 |& m  W# R/ b2 F
  58. #define TCCHEN_SHIFT                22
    # k7 Z* P. E8 W. [5 \1 }. ^5 e
  59. #define ITCCHEN_SHIFT               23
    9 \: B- q9 t' h6 H( o$ f# b

  60. 2 H+ m* k3 f4 l; R" Q! a: g( F
  61. static volatile int irqraised1 = 0;
    / T% v& L/ ~  ^& R9 v% `! L3 l5 M
  62. static volatile int irqraised2 = 0;  L. @7 ~9 C$ f& M4 L' r
  63. ; d- |+ M6 S7 b0 q8 J. K; I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }. n6 t# J5 h1 X) C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" v9 ?% [+ D' d) K4 q0 D# H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v  N3 Q9 D1 T6 [, `& t( l9 d. w

  67. , t2 x  j7 _( E9 f
  68. dma_addr_t dmaphyssrc1 = 0;, V/ c- G: D! s
  69. dma_addr_t dmaphyssrc2 = 0;: y8 }3 d- m6 f9 i" L6 ~
  70. dma_addr_t dmaphysdest1 = 0;
    8 C* P6 v3 Y4 V! l  R+ l: Z! Z' N
  71. dma_addr_t dmaphysdest2 = 0;: t; b3 [  ]5 U  W, K7 c$ P
  72. 7 Y& N: {* [5 Y$ x$ q
  73. char *dmabufsrc1 = NULL;6 R% `* ^8 f' H% x
  74. char *dmabufsrc2 = NULL;$ h( X0 h1 ?5 _: y, G
  75. char *dmabufdest1 = NULL;
    1 k7 ?2 d8 _' u, ?
  76. char *dmabufdest2 = NULL;4 h3 U2 ~$ _+ ]

  77. 5 Q( u  @; O7 F) B1 {. o: G) ~
  78. static int acnt = 512;
    + C2 L9 I9 m9 T8 ]% H$ [1 g
  79. static int bcnt = 8;3 C. i5 ^& O! x" I: O5 [! v
  80. static int ccnt = 8;
    / M, d' n! `4 m
  81. 0 r5 w% B* t( W0 ^  a
  82. module_param(acnt, int, S_IRUGO);
    / x+ }# s+ F- K& V2 D0 t' r6 K5 w
  83. module_param(bcnt, int, S_IRUGO);
    2 c8 T1 y9 D$ N9 Y2 p0 q8 F8 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! r3 N* q0 Z% [9 L$ }6 F- S: r
3 T4 @- L7 w. ]( t, m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ?1 z% f+ m+ j/ K1 J- Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) Y; k7 N4 w, _! `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ P) @) `: k6 X3 L" t+ w

1 c; E0 w  u: t1 B" b  A$ n2 V8 i
8 T8 r! @1 R2 c4 M/ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号 ) 

GMT+8, 2026-11-28 05:27 , Processed in 0.047637 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表