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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / d( _8 w) p7 {
  1. [code]EDMA sample test application
    3 v: s# j# o2 h  E5 A4 b
  2. /*& v9 K  m. I0 M5 Q
  3. * edma_test.c
    & j5 d) q9 E" ^
  4. *
    7 l8 ?& e1 H# F3 N
  5. * brief  EDMA3 Test Application* e% i( n  _1 k& P$ w; o: I
  6. *
    ! e* ?. Z) c  n! c; X6 h7 R$ \
  7. *   This file contains EDMA3 Test code.
    . W# E/ L/ P6 i$ I- K2 W
  8. *3 R, @* y8 Y  g8 W3 [( A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 B8 O2 ~/ ^' t" H8 W% \* W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: r6 x. C. z2 Q
  11. *         TO CHANGE.4 o" Q; Q& p  i: }" c4 x4 j
  12. *
    8 X! Q  J9 v/ c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 e9 a* y, Q7 e6 f- L
  14. *
    2 `! l. J9 @' N
  15. * This program is free software; you can redistribute it and/or
    8 W# a  t. V6 |7 F
  16. * modify it under the terms of the GNU General Public License as
    * C' b! j( J3 T
  17. * published by the Free Software Foundation version 2.+ Y* K: S( }1 U$ q- C/ S5 P. P5 R
  18. *. N8 A, w8 [7 [# y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " f9 S4 n, S5 \: l+ y6 E2 j0 I
  20. * kind, whether express or implied; without even the implied warranty, j, q5 R: ]/ Z' K( P5 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) F# e4 o. _: }
  22. * GNU General Public License for more details." X  v% [7 L1 H& W% K; o- I
  23. */
    . h6 [/ `/ B, @
  24. 2 G+ W0 X: l- j' w7 F3 p/ V* [4 u
  25. #include <linux/module.h>
    6 X. v6 l$ w* T; K( a. W$ _8 k2 C
  26. #include <linux/init.h>4 W+ Z# l3 D/ t# ]
  27. #include <linux/errno.h>
    $ P+ E/ k+ [1 d
  28. #include <linux/types.h>8 N6 m/ c$ ^/ ]0 A2 f5 Y
  29. #include <linux/interrupt.h>
    7 T7 f7 c0 |9 y' t# ^& d9 Z1 ~
  30. #include <asm/io.h>
    0 }, S0 [; ]' q. @6 l1 R. H$ O
  31. #include <linux/moduleparam.h>
      J/ u' B% J" [! Y" ^+ Q
  32. #include <linux/sysctl.h>
    # |! w6 Y) h4 ]9 f$ t4 r
  33. #include <linux/mm.h>
    ; C3 m7 k1 b) q8 k* ^+ S4 b2 w
  34. #include <linux/dma-mapping.h>, Y) u. b/ ]- s, S) u' z: M! Z
  35. # J; V, M* a' r3 Q7 k+ ]* p0 G: @
  36. #include <mach/memory.h>
    / G' {8 s$ o9 l
  37. #include <mach/hardware.h>" k. s! d  i8 l5 `* M
  38. #include <mach/irqs.h>1 g4 N, _5 I7 i1 U
  39. #include <asm/hardware/edma.h>
    7 Y: D2 A& u1 L/ F) ~

  40. 9 Z, W% N; n  Z2 k; h$ `
  41. #undef EDMA3_DEBUG7 R' W/ M0 }; M
  42. /*#define EDMA3_DEBUG*// U/ B; U* _/ i/ V2 ?/ I

  43. ' S, X8 M8 Q; z. d% s0 G5 Y6 w
  44. #ifdef EDMA3_DEBUG  ?: R5 u1 k  t' U$ \/ R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . m8 G  _7 B" Q! d% S. l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  F- ~8 O+ d: H0 G% @/ r' w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 i7 }# ?# l6 _
  48. #else0 x$ v9 M# h  j
  49. #define DMA_PRINTK( x... )
    , Q( ?1 Z: ^; E. f# Q6 @% [* S
  50. #define DMA_FN_IN
    " G4 q8 W+ N6 k
  51. #define DMA_FN_OUT0 f1 L; |$ Y1 q& P/ T  j- W( J) Z
  52. #endif' `* [+ k7 g+ m# L0 }+ {

  53. , C& E' g! F5 y9 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! z& T  W" }- N( u0 W: Z2 @
  55. #define STATIC_SHIFT                3
    1 ^4 \" q1 x" w+ t
  56. #define TCINTEN_SHIFT               20! m. H9 }- l. G7 x! ?- [
  57. #define ITCINTEN_SHIFT              21
    ( B- L. I$ Q" E
  58. #define TCCHEN_SHIFT                22
    - u5 c. D" x( Q; L* O
  59. #define ITCCHEN_SHIFT               23
    ) q; z3 N0 {9 l" o% W/ R' }# ?

  60. ; k, r# |3 h: T9 T* Q1 \; |2 Y) o5 x
  61. static volatile int irqraised1 = 0;
    # p* R' J) G4 G' _) J. Z' l
  62. static volatile int irqraised2 = 0;% `9 s* g* ?# _/ }
  63. ! c7 D$ i+ u" g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 d0 t9 }% ~7 A& x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : l* w" j1 c% s, L0 R4 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : w( \5 U9 k$ _2 L+ l
  67. 1 w) t: T, q3 C* b
  68. dma_addr_t dmaphyssrc1 = 0;$ U) z# N3 `2 R
  69. dma_addr_t dmaphyssrc2 = 0;; h+ L& ~: ?( M$ e, F6 w
  70. dma_addr_t dmaphysdest1 = 0;
    4 Y. ~: }8 L( W1 B
  71. dma_addr_t dmaphysdest2 = 0;
    7 I) B5 W, U8 \3 `  _1 a

  72.   K. w3 ?' o7 K( ?
  73. char *dmabufsrc1 = NULL;' K$ h7 m  i2 K% y3 J% l9 x) h3 I) H
  74. char *dmabufsrc2 = NULL;
    - X/ B5 |2 i1 T- W6 ^' k
  75. char *dmabufdest1 = NULL;& d. z4 K6 v6 u; r
  76. char *dmabufdest2 = NULL;
    ' D7 u. S1 K2 y

  77. , I' R( L, v) ]8 V9 w% k# H% @/ i, S
  78. static int acnt = 512;
    0 `* D. o& d  s" ]1 R( @' e# x; d$ l
  79. static int bcnt = 8;
    ' P0 T" v3 N  u6 g+ o! U7 h
  80. static int ccnt = 8;# Z7 M2 U" W* t

  81. 5 W% B5 d; S  O4 C
  82. module_param(acnt, int, S_IRUGO);2 s' E: W2 f. T4 s* G
  83. module_param(bcnt, int, S_IRUGO);% n& U$ ^4 A4 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" o: R* P; i) r0 ]! G
( ~! I8 w7 e* M6 R! H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ X: J. f2 w. s3 _! v, s2 @* larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ d* d# x# d9 V8 G" z/ M! g2 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ]  M2 K: u0 B8 s, X& t  I9 z6 D0 G* ^0 j2 O( c, N
9 D& L3 K- O1 R! G  o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 08:33 , Processed in 0.040449 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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