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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! w$ K6 V8 h4 V2 A2 H  U! S7 f
  1. [code]EDMA sample test application6 G) I. m6 l* f! ^/ _$ A
  2. /*
    $ o9 O# }& X6 i+ @- r
  3. * edma_test.c
    0 Q/ `8 Z4 b: `4 P
  4. *
    5 y+ I& K6 P, M' [) M
  5. * brief  EDMA3 Test Application
    * d* {2 J4 o) V# j9 Q% @" v! N
  6. *
    1 D6 e) Q. I$ W; _' L1 J2 n
  7. *   This file contains EDMA3 Test code.
    # D# ^1 W' B- s% G, E
  8. *
    8 q8 s! W6 O4 x, W' n. J  {* g: t( j( R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' \; c" ^+ n5 s$ F$ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ e* A2 u  N7 _$ u
  11. *         TO CHANGE.
    # o! W3 o0 V/ `9 Z; h) G
  12. *
    - ~$ v' e2 b% h2 n. D$ @8 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# \. b; Y' H; D' k
  14. *. J+ Q9 ?3 Q' i# s; r
  15. * This program is free software; you can redistribute it and/or
    0 h6 S  ~4 Y* O6 j" ^$ x
  16. * modify it under the terms of the GNU General Public License as
    , p' [: k) A$ G# C) A
  17. * published by the Free Software Foundation version 2.9 m1 J# B) O" M% ]
  18. *9 @* ]) }1 b0 V8 {6 g1 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      I: L2 V! W9 ~" q
  20. * kind, whether express or implied; without even the implied warranty$ ]" T6 }" m- Q* x% K  `) o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ L9 m  n% F3 h9 d
  22. * GNU General Public License for more details.
      l' y4 q- G6 S8 H$ ^/ X
  23. */
    4 l+ w0 K" G% M5 R

  24. ! g7 o; \1 _, k4 ?: H0 m" e- @
  25. #include <linux/module.h>+ B% W, B0 b: h1 A: K' v
  26. #include <linux/init.h>
    ( R2 e3 o$ X* E
  27. #include <linux/errno.h>& w+ z# M  i4 S9 _4 F5 l1 F
  28. #include <linux/types.h>2 T: C* o$ {( u( d; a/ E7 S
  29. #include <linux/interrupt.h>, y6 v% d5 @7 h7 U# h6 q$ b' p5 ~
  30. #include <asm/io.h>
    , E$ P! h3 O' \7 |
  31. #include <linux/moduleparam.h>9 J6 J; J# q5 X: d
  32. #include <linux/sysctl.h>" \7 {, E' j( g; Z$ Z) L
  33. #include <linux/mm.h>
    . u3 v) @$ I. _( F  F
  34. #include <linux/dma-mapping.h>
    2 e' Q- _# f7 [7 l: F

  35. - a8 v9 E" O8 l+ U0 U& Y
  36. #include <mach/memory.h>
    ' {" t6 g. ^0 u/ h% @
  37. #include <mach/hardware.h>
    0 C' V! N2 u% k: Z
  38. #include <mach/irqs.h>
    8 N; y/ }0 I/ m, a) Y2 h3 c, C& R' s
  39. #include <asm/hardware/edma.h>! K# s$ ]  z) H/ U

  40. 5 v' z/ R. M4 |+ Q
  41. #undef EDMA3_DEBUG5 n' p; n6 c5 C  z# P) a2 M7 _' E
  42. /*#define EDMA3_DEBUG*/" M7 o6 L2 M  o, [' q& }

  43. 4 N% N, O' `! m0 `
  44. #ifdef EDMA3_DEBUG
    ; R; \& F/ c1 b. D# D# R! [) f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 _( S% z1 q; N& s* H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! X. s0 i9 ~+ Z1 b: e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + M. x" g4 v! C& T
  48. #else5 M4 n  k, u0 [. A. h/ W4 {4 Q
  49. #define DMA_PRINTK( x... )
    5 p: T+ {" ~( b  `3 y  B; H2 ]
  50. #define DMA_FN_IN9 F$ H- K7 a; _6 Q. L
  51. #define DMA_FN_OUT
    8 g! i5 b8 P8 w5 `+ f2 Y
  52. #endif
    ! k4 }0 h! Y- G; ~8 ^8 M

  53. # ~& ?( u# K+ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& c8 f, _1 N- x4 v& i- B
  55. #define STATIC_SHIFT                3& V% ~0 m+ e2 c8 o
  56. #define TCINTEN_SHIFT               20- C' S! r' g4 l' f. `5 C" M! y
  57. #define ITCINTEN_SHIFT              21
    . e3 {7 y3 \8 d) f8 [
  58. #define TCCHEN_SHIFT                22
    ) z2 E. O& ~: s2 J& G, D9 F+ O
  59. #define ITCCHEN_SHIFT               23
    ' |; D2 D+ P3 ~5 s: n0 X" t$ A
  60. 4 P) e9 R; w) u& s5 M5 g
  61. static volatile int irqraised1 = 0;
    * c3 o) d3 T4 G! e5 i
  62. static volatile int irqraised2 = 0;8 w& v- G" j; e1 P0 X

  63. , Q5 y7 d; v5 o. g# z9 l. H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  A  H" m4 v/ h& }7 ]1 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?% O0 k% _# n: `5 r) a/ n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X5 x$ d$ z0 s

  67. 8 G8 G/ }0 |# _
  68. dma_addr_t dmaphyssrc1 = 0;
    - Z, G2 y- @; X
  69. dma_addr_t dmaphyssrc2 = 0;: {5 ?" [! H: _) F/ \! U9 ~- c. ?
  70. dma_addr_t dmaphysdest1 = 0;
    1 Y: t0 x, o" a3 L$ M
  71. dma_addr_t dmaphysdest2 = 0;
      |& U9 N! i$ K5 [1 _9 I' Q
  72. ) w! P: o# ~0 R5 S# U5 ]
  73. char *dmabufsrc1 = NULL;
    . D$ u4 E7 {) e. v! e
  74. char *dmabufsrc2 = NULL;
    3 {) b/ C& [1 d+ J( k& {0 t! c
  75. char *dmabufdest1 = NULL;* c3 M  B, _" G4 B0 z' `& \" S
  76. char *dmabufdest2 = NULL;
    3 \# J& e/ d. \4 C+ g7 z+ g

  77. : L) A! d3 q0 ?) v$ o
  78. static int acnt = 512;4 E! W" `. q! E
  79. static int bcnt = 8;& ^: g( |0 {1 W! P
  80. static int ccnt = 8;9 ~. }2 s+ r& D+ D3 W
  81. 2 `* f2 H  p, j" [3 z; n# `! h
  82. module_param(acnt, int, S_IRUGO);
    6 c2 m+ ?* T4 e8 r
  83. module_param(bcnt, int, S_IRUGO);
    : X) f9 B- y' R! b5 @! i# F+ j+ }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: i) ]9 o; T7 P
+ C5 A/ X' u; a7 a, a! @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; X" u9 n8 Y# O; z) |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 R2 Y5 ]) }  W! k. ~4 |" L/ {6 W2 u3 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 k) p6 p& `3 s: A

" f7 c) r" J/ n: B* w0 H
3 g# G* ]( y! B* F/ V9 O7 I5 H+ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 08:12 , Processed in 0.053970 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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