OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! t" P  X  F- t# p
  1. [code]EDMA sample test application
    5 s& {" ]6 P& ~$ v
  2. /*) d  z7 `5 E7 ]5 u3 x3 }
  3. * edma_test.c7 c5 l8 C  `+ n8 z0 o. [
  4. *
    5 G% B  A" X, u' @
  5. * brief  EDMA3 Test Application. d! v6 o6 ?! w% Z% N; O& b+ c
  6. *, p) S! R' Q" W9 j, u9 Z: X* a1 q
  7. *   This file contains EDMA3 Test code.1 Y5 o) E# s' f1 p0 J" d7 {4 f7 O
  8. *
    " @+ z1 u' Y# n3 i" k: G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 e* _3 Z0 W% Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 T4 d  Z7 C: |( K
  11. *         TO CHANGE.; i- A! e$ w) y9 f
  12. *
    ! K5 S0 u8 v5 z# O6 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 U  t2 H: m3 J3 {
  14. *6 T; E; n/ N6 t# \4 V
  15. * This program is free software; you can redistribute it and/or, M; e8 r. I+ D5 C- z" s$ x. l
  16. * modify it under the terms of the GNU General Public License as( i1 o# j* b% m, p$ W; b2 R
  17. * published by the Free Software Foundation version 2.. w+ I. F0 t4 f& o5 p
  18. *
    ; A2 S: B4 N& [) d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 S9 ~" E: a$ N
  20. * kind, whether express or implied; without even the implied warranty) L# c; ?2 q! I9 q6 X' K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 G% e& r  [9 \. y  `' o( ^8 o% T* F
  22. * GNU General Public License for more details.
    : o6 N7 C# @' ?* R! P0 r
  23. */2 J* I* I& E+ U6 d' J

  24. # ?7 |7 Z. K. x6 K
  25. #include <linux/module.h>7 H  D" L: `0 p  e5 ~) C
  26. #include <linux/init.h>
    , b2 A8 Z/ h1 ~
  27. #include <linux/errno.h>
    / e5 Z6 m6 B4 K) f
  28. #include <linux/types.h>
    4 x' w  y& t2 a9 C
  29. #include <linux/interrupt.h>
    , ?3 c  h2 A0 Z1 f7 P( l
  30. #include <asm/io.h>3 p( |% c5 N; O/ @
  31. #include <linux/moduleparam.h>4 r) w) H1 N1 p: W8 _7 P
  32. #include <linux/sysctl.h>& n- a! Y0 b; E
  33. #include <linux/mm.h>% a. f, n8 \7 e; a( W9 z& m
  34. #include <linux/dma-mapping.h>
    & g$ W7 `! X/ ?, ~0 ^$ W& N  P+ \9 }& Z
  35. $ e# P# L& n/ Z% {
  36. #include <mach/memory.h>
    . S1 \* w$ L! d) J: q: U
  37. #include <mach/hardware.h>0 W% s) i! l" b# L# N1 A  w
  38. #include <mach/irqs.h>8 ^( E! @$ [, f; Y9 ]$ M; B9 _/ U6 H
  39. #include <asm/hardware/edma.h>
    ; m) c, x) x5 P* g% w2 h: |9 B
  40. ' W" T2 M0 }, m& @
  41. #undef EDMA3_DEBUG
    4 m2 o2 d3 R3 ?
  42. /*#define EDMA3_DEBUG*/+ W% y$ v, d5 g0 j8 ~& ~
  43. - y& R3 V5 r1 o2 [9 ?" T# b
  44. #ifdef EDMA3_DEBUG
    : U* P/ `9 l( t! j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 c' L% Q) M0 ^% P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 S, P  {6 A" ~1 M3 U4 N9 |+ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - T! z; B; ?" h/ u+ S; v7 {; B
  48. #else0 b. K* ?0 d" E4 t' t& [0 b
  49. #define DMA_PRINTK( x... )
    # _/ E, ]3 L: I- W
  50. #define DMA_FN_IN2 b! |  u$ a; w6 O7 |6 N
  51. #define DMA_FN_OUT; {2 P' x/ D  Z# [( o* W* X; _6 C
  52. #endif+ I0 f' r% {) C' k7 I4 A
  53. + {3 o$ m+ S, c/ v, E+ f) d% @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 F, b% Q8 V4 |
  55. #define STATIC_SHIFT                3
    ( Y; G0 u" q: i8 X
  56. #define TCINTEN_SHIFT               20% _* c$ y, E/ f* A) M7 ^3 g& J; H
  57. #define ITCINTEN_SHIFT              214 k, v5 T3 v$ x' ~  @) B! j
  58. #define TCCHEN_SHIFT                223 \, B4 n" Y* O$ a
  59. #define ITCCHEN_SHIFT               235 ~/ [$ h2 W! Y* N+ \% L

  60. ; \3 A4 S0 Z# i
  61. static volatile int irqraised1 = 0;* J' L5 ~5 y4 E1 J- z
  62. static volatile int irqraised2 = 0;
      u+ t8 ~0 K/ A$ A. A

  63. % o+ ~, y! W# j4 \5 A8 L6 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 e% [. m: I0 a9 M$ ]  c. v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. R9 n7 A' G% u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 k) n( O/ r+ t. b

  67. - d3 F0 |# }, w4 D3 T' v! h1 V
  68. dma_addr_t dmaphyssrc1 = 0;
    8 v0 _; R& a3 k) u, i
  69. dma_addr_t dmaphyssrc2 = 0;( U5 t' L! M. V- J/ @0 U
  70. dma_addr_t dmaphysdest1 = 0;
    - |: v! U: [' R& c* y* a
  71. dma_addr_t dmaphysdest2 = 0;$ ^* _# }, G/ N+ j

  72. & ]( ~6 V& K! y5 ~  O8 |
  73. char *dmabufsrc1 = NULL;% ~) f: @% \8 W& A
  74. char *dmabufsrc2 = NULL;; [/ L* W1 O4 u% w- |
  75. char *dmabufdest1 = NULL;
    , w& A% M6 m5 L, U& }. x1 s8 S. ?4 M
  76. char *dmabufdest2 = NULL;* M& f. j2 ~' S/ m
  77. + W& q5 _4 B& c* \2 w0 h; @, V" D
  78. static int acnt = 512;
    ' T% O* r' L/ B, t9 }
  79. static int bcnt = 8;& l0 R3 K) O; y4 I4 o1 K1 N
  80. static int ccnt = 8;
    1 i# i  C$ p/ ^7 }* N
  81. . J5 p2 O/ g0 I' M1 u7 [% u
  82. module_param(acnt, int, S_IRUGO);
    - |/ I7 c! W+ R' i
  83. module_param(bcnt, int, S_IRUGO);
    . Z4 D. b9 P3 G* I  s- Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! n) s/ L8 Z  [9 F1 `. J! Y* `7 ~1 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. w6 l( V: A$ x9 n1 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 X0 s. v8 U& U5 p( _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 N* T. T8 m& d1 V; [

3 w$ s, A" `8 o9 S. P6 F$ V% U( f! z. r' U* `' q/ ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-13 05:40 , Processed in 0.036546 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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