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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: x/ X) R( v* V' ?$ Q' o+ c
  1. [code]EDMA sample test application, ?4 c& u) \: [% S( b
  2. /*+ A) Y! E0 L3 T# o7 E4 I( j) ?& y
  3. * edma_test.c
    # L, V! E* o! N( u3 Y5 y" t
  4. *. B, k, F  w0 G7 w- M: c
  5. * brief  EDMA3 Test Application3 Q" k+ m6 A' e& M/ H6 }. O% U6 H% v! i
  6. *
    1 _5 \  }) m! X( v" {/ V
  7. *   This file contains EDMA3 Test code." Y8 N) M7 r( ~6 v' c$ `7 d
  8. *
    , T' j; J2 M& q! Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ F, O% Y6 I7 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 v9 {; q! ^6 g" n6 j) O
  11. *         TO CHANGE.+ e) W- ?, D& ~
  12. *
    9 ~: B/ b( C) q+ w* r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! r  a4 m8 A; ?6 G. Q
  14. *
    8 W! v* c& }( M
  15. * This program is free software; you can redistribute it and/or0 p& m3 k, z) }- o: X5 l" a8 \
  16. * modify it under the terms of the GNU General Public License as
    $ N+ Q  [/ A1 ~! O# a
  17. * published by the Free Software Foundation version 2.9 D. [, h/ n% t; c3 `" p+ Q/ Y
  18. *
    . Q4 L0 A8 K: G9 V' O% f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ]9 N7 \4 i% b- P9 ?& A5 n  k* R& U
  20. * kind, whether express or implied; without even the implied warranty* p" F) R% E" O6 k$ V8 m* L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; W. _' g3 v: G* u2 j  q6 `
  22. * GNU General Public License for more details.( P/ v* _( h5 C8 y
  23. */
    4 h) E' ?/ T4 {  g+ c0 l
  24.   x/ @/ y& Q5 C- P
  25. #include <linux/module.h>
    . w. {8 w6 A3 G' p7 Q& m& c. D
  26. #include <linux/init.h>6 C2 l5 k2 V. M7 h2 _/ x1 H$ B1 d& U
  27. #include <linux/errno.h>5 ~6 y+ ]0 B4 ]% {1 K4 x; P& ]
  28. #include <linux/types.h>
    8 W; [; n* ~' }# r. g) T- j. f0 u
  29. #include <linux/interrupt.h>$ g$ G- i. ?4 k  ^
  30. #include <asm/io.h>
    0 V9 l) S- O9 k
  31. #include <linux/moduleparam.h>6 p5 D, q9 N+ r
  32. #include <linux/sysctl.h>7 L5 M3 N: ^5 ^4 X4 e  E+ n2 `) [  ^% C
  33. #include <linux/mm.h>" \7 j# c4 \4 N) R! F6 \
  34. #include <linux/dma-mapping.h>
    4 R, w, ]& H: B. H

  35. - _+ D) P7 H! p
  36. #include <mach/memory.h>
    . x2 K* ^" `0 {  D% j
  37. #include <mach/hardware.h>5 k5 X$ H# J3 F6 x" V! u) H# C
  38. #include <mach/irqs.h>7 z8 k8 z8 I4 C* D# i/ z/ m$ t
  39. #include <asm/hardware/edma.h>
      c. q1 H  T3 V7 C8 h  P

  40. - p: y1 B7 x" v0 d% B, ~9 ^; ]$ s, G
  41. #undef EDMA3_DEBUG
    ' v1 a1 Z* [* l
  42. /*#define EDMA3_DEBUG*/
    # ?0 y/ H3 X% h- Q
  43.   c. V. p! D6 t0 g" ^7 H
  44. #ifdef EDMA3_DEBUG$ ~+ J+ h: Z9 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 h1 q; p# J. C0 e7 a' a4 @' ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): |& w  A5 D- M" l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ^! }- {3 h/ Q2 b- D: @: H
  48. #else
    ( u& u9 n& ^4 w5 X
  49. #define DMA_PRINTK( x... )7 D$ E3 I; J5 V0 H) U
  50. #define DMA_FN_IN1 ^: W. f8 E& H/ D/ v9 \. `
  51. #define DMA_FN_OUT
    5 b* M. I$ x+ L8 H6 n2 d
  52. #endif
    6 K% I- v: g9 P( \5 }

  53. 1 q8 E. @5 o3 B7 h5 t5 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' q; n1 h& \$ Z" w5 s0 f* ~9 x
  55. #define STATIC_SHIFT                3
    ) `$ M' D) N. S( m# i6 r( \' G" X$ h
  56. #define TCINTEN_SHIFT               20
    , T7 y* x* n8 j, A
  57. #define ITCINTEN_SHIFT              21
    0 X. i0 X1 A- ~, _  N
  58. #define TCCHEN_SHIFT                22
    3 n) y8 o) B, N9 T) h$ s' J
  59. #define ITCCHEN_SHIFT               23( G# h' Q6 d$ M
  60. . m  e% R& K) U* j" S
  61. static volatile int irqraised1 = 0;
    7 S& h% s  f, Z. p" D/ U
  62. static volatile int irqraised2 = 0;+ K! M. k, ~5 H
  63. # K) a4 K- B' o  |$ |( e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' y$ i4 ?4 a  `4 I1 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : g$ W! j0 O7 L, h2 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 K" y% E" }) s# E8 [

  67. . S; Y0 i9 t1 t3 _9 k; _3 @
  68. dma_addr_t dmaphyssrc1 = 0;5 b, R7 l. A7 [% d
  69. dma_addr_t dmaphyssrc2 = 0;
    / J6 Z6 o4 z; S
  70. dma_addr_t dmaphysdest1 = 0;0 T4 l+ c1 _4 l: R2 Q
  71. dma_addr_t dmaphysdest2 = 0;, h" v! }7 B$ Y' U3 T! j+ U
  72. + h& i4 E( |- w( }" ~
  73. char *dmabufsrc1 = NULL;+ ]5 h# _  r8 \% l
  74. char *dmabufsrc2 = NULL;: L3 y9 F0 q4 D/ u
  75. char *dmabufdest1 = NULL;! @6 T, O+ K2 X. L. \, T
  76. char *dmabufdest2 = NULL;
    + K3 E! R, K& B# F% Z) z

  77. " Z: Z2 q# k( s% B, U  O& w
  78. static int acnt = 512;
    7 c! f/ Y3 y# ?8 {; A
  79. static int bcnt = 8;" R4 v5 @0 O- X* H) o, p! w$ e
  80. static int ccnt = 8;
    - _: `( B1 ^2 P: O( n' |
  81. . l) d" m! E! A* e: J" @( I
  82. module_param(acnt, int, S_IRUGO);" s" ?3 C! D; c2 \& k& e9 Z
  83. module_param(bcnt, int, S_IRUGO);
    1 b8 y6 y+ L2 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 ~8 W+ h# m9 t: p9 O9 k( W3 R; O5 n
$ h- Q, e) K  g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 A5 ^" V( }; [* W' y4 n+ Q" k. ]3 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& W( @5 B* s6 d: W' \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- h9 m! a- d3 M6 Y
) g- i( Q4 C+ I% b% U
3 t* Q! P- ?5 j8 ^5 N1 g! p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 16:32 , Processed in 0.040903 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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