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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; e9 ~1 z7 Y' a  O" I
  1. [code]EDMA sample test application6 J) x+ U  T2 Y; i  x4 J& y& g. j
  2. /*' c: n1 H5 K9 u: C' ?" i0 I0 Q
  3. * edma_test.c
    , r1 }/ {9 t8 R2 B2 g5 K, G' ^  ]
  4. *
    4 R9 G6 R8 c  a% h$ \
  5. * brief  EDMA3 Test Application0 y+ T- h: R& ~8 e& B
  6. *" w- J. w  l/ g9 _1 G
  7. *   This file contains EDMA3 Test code.* \$ [) F, S5 o) |
  8. *# s6 ]3 ~) N4 t! ^! p0 v5 l9 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , z+ ~0 C) h  i3 D! r8 v. p( ?$ Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 H) |" g, a' o6 L
  11. *         TO CHANGE.
    * @9 o" b- T- K- S0 t5 I% e2 g
  12. *
    - `; Q' j; Y! E. w2 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 v, c3 a, M$ P  {. h
  14. *1 p: r- X- o: B* q5 H4 e
  15. * This program is free software; you can redistribute it and/or
    & P# H) g7 x$ Y' [  u' F
  16. * modify it under the terms of the GNU General Public License as  K0 P, m" r1 `
  17. * published by the Free Software Foundation version 2./ d# N- O8 \" p4 u( g
  18. *
    + b8 s4 S7 G, t$ j7 L! }! j4 P2 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  z0 l$ o1 }4 \1 Z
  20. * kind, whether express or implied; without even the implied warranty
    - A6 Y, S% Z$ Z& U" [; P& ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " o: @) W' w* D
  22. * GNU General Public License for more details.
    5 _6 i% ^" K7 {$ M9 r' J
  23. */4 H* W: m8 [9 m: ]
  24. # ~+ y; x+ m. V* v
  25. #include <linux/module.h>
    - W" P0 `; m! C5 u
  26. #include <linux/init.h>
    : a% n$ u# l3 _
  27. #include <linux/errno.h>
    # f4 s7 J( u$ \9 C
  28. #include <linux/types.h>
    ) P% Y- N( k6 y
  29. #include <linux/interrupt.h>
    ) ]4 n+ r; S2 A% k8 j
  30. #include <asm/io.h>  q9 b/ O* W; v6 _1 C- l
  31. #include <linux/moduleparam.h>9 U; j) q8 H% L$ T8 m
  32. #include <linux/sysctl.h>
    ( X2 G; d, d0 G& ~2 b. d% ~# E* {
  33. #include <linux/mm.h>1 Y) x9 x: Z& [9 h5 x
  34. #include <linux/dma-mapping.h>
    & E( ^) y4 i2 J+ k& ]2 |

  35.   l8 G9 Q7 `, y* {2 R7 X4 V/ _- P
  36. #include <mach/memory.h>
    $ y3 }( `& b' {, \6 T4 N- O4 d
  37. #include <mach/hardware.h>
    3 `8 }7 @/ N; m1 |2 y, C+ F6 ^
  38. #include <mach/irqs.h>* L, Y7 `2 h( q' @8 i
  39. #include <asm/hardware/edma.h>+ N2 A/ d0 e+ E0 ?( a- C% D: S* a, q
  40. 4 E2 v3 X3 j' F; D
  41. #undef EDMA3_DEBUG1 V/ n" n. h: E( U2 X# e
  42. /*#define EDMA3_DEBUG*/
    % k/ K! L" c1 J: n8 g( W
  43. 3 C2 L% V. V' w0 U6 ~+ y" Y* s
  44. #ifdef EDMA3_DEBUG
    8 d8 t. |1 X5 N& Q9 P+ C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 H) d+ V' P, j6 S* c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' J+ ~, _9 W: w8 x" ]: |7 y1 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 z* W" Q- p- i, g! w) t
  48. #else8 Z( `' W! D, {, D' x  G! C
  49. #define DMA_PRINTK( x... )$ r/ N7 [* c, F  F/ m0 V
  50. #define DMA_FN_IN
    8 h3 s, K; l+ a
  51. #define DMA_FN_OUT
    ( Q8 _( n7 G! a" L( t$ Z
  52. #endif' B$ H, K  w! w, H7 O4 g

  53. 1 b1 t3 z  @, V# E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; J5 }) j* x! m  E, a1 \
  55. #define STATIC_SHIFT                3
    " T. g) ^: |5 a. a  L% ~
  56. #define TCINTEN_SHIFT               20* ~3 i/ j: K$ y7 f3 |
  57. #define ITCINTEN_SHIFT              21
    / G. b5 j+ |' N5 m% p+ T
  58. #define TCCHEN_SHIFT                22
    - ^7 J. y7 L7 e
  59. #define ITCCHEN_SHIFT               23
    ! m1 g; n4 A  m$ K' Q9 x
  60. ( E( q/ `! a; G9 T( o
  61. static volatile int irqraised1 = 0;' E) x  l1 P. R- D0 A4 g
  62. static volatile int irqraised2 = 0;
    4 r1 t' U+ @3 Z) ]3 U* [

  63. 0 O& y  d" P$ H, B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' J) {2 G$ b# U5 I5 I( M6 e- M) ~5 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [. A. B5 ]0 `" {/ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x7 B- f( m& V/ s$ ]7 z

  67. & l7 O" \2 H) I) I9 g5 R
  68. dma_addr_t dmaphyssrc1 = 0;
    9 R$ u- c4 k0 _$ h4 L" x1 y
  69. dma_addr_t dmaphyssrc2 = 0;
    $ w6 K  C* K3 F% Q# |
  70. dma_addr_t dmaphysdest1 = 0;. |: D$ u' n5 I
  71. dma_addr_t dmaphysdest2 = 0;
    " u/ z( v  {" n3 c( n# y$ ^
  72. $ H- X. ^0 b- L/ ?9 ~, r8 z2 y
  73. char *dmabufsrc1 = NULL;
    1 r" [0 d; c8 y" H1 J) y$ S
  74. char *dmabufsrc2 = NULL;
    + N5 A7 e+ t$ B
  75. char *dmabufdest1 = NULL;) H# J+ f5 c; \
  76. char *dmabufdest2 = NULL;
    % d: e: g* u9 t. @
  77. 5 N* K! @0 s5 {$ H
  78. static int acnt = 512;  E$ m6 ^4 r$ b
  79. static int bcnt = 8;
    % j. }3 Z/ R/ o7 Y! k  C! I' Z
  80. static int ccnt = 8;
      V) D, V6 F% S! R. O, ?2 v

  81. 4 ]( Y& h( Q3 y8 }& R
  82. module_param(acnt, int, S_IRUGO);
    . S  U) H/ x# }7 ^! d
  83. module_param(bcnt, int, S_IRUGO);8 S+ N+ k! Z" ~. a% T: |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% ?8 `( S+ ^, `& J# I
, i5 @4 o- X0 h7 X: m( Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. D! N; L) c5 ~9 z& iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 k0 D: q9 L9 ]6 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 i, Q8 b  q4 R% E

6 b: W* c( j) W' d0 Q! j
; K" h1 [% E6 m- X4 v& m) O( L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 06:10 , Processed in 0.041053 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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