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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , @6 n% w( u" P: m0 \3 g
  1. [code]EDMA sample test application* I1 ^( W! @) z) h
  2. /*
    9 Z" B8 Q7 j0 {8 l# ~5 T
  3. * edma_test.c( A% [7 `6 c' d8 H
  4. *
    0 F+ S( X; q! X7 h, s/ U# t
  5. * brief  EDMA3 Test Application
    * B0 R) G4 ^% u/ U! u$ J
  6. *
    + ?, n/ E- a' w7 V* i' L
  7. *   This file contains EDMA3 Test code.  Q2 t4 O8 ~5 e' d$ x  Z
  8. *0 D4 a; W3 R& G$ {$ U7 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  z2 o7 X0 R, u0 X' }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  d# F+ O: }5 ?/ U% V5 R6 C3 c. t
  11. *         TO CHANGE.) `6 T' P1 V  p' T* _# ]
  12. *
    ; i& _# x0 M& g; ^. m; D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" J+ v: C! p* y8 j- r4 e  H
  14. *
    1 D% G9 u% \/ i6 r) Z
  15. * This program is free software; you can redistribute it and/or
    & j  f) c, m# `: b( }
  16. * modify it under the terms of the GNU General Public License as
    5 U2 C$ f: G& u- _1 A9 {0 M: B
  17. * published by the Free Software Foundation version 2.! r& q& t6 R, x7 }, j
  18. *& R* l. ^% p$ h$ ]1 Z  s1 @% Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 e, l# X% s1 h6 o
  20. * kind, whether express or implied; without even the implied warranty. @* F) b. k# R3 N" d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      }9 h# z. C0 U! p
  22. * GNU General Public License for more details., w! M5 X) ]  V
  23. */5 C$ e  s4 E: |9 L7 W
  24. * ?! ~1 f" o$ T0 I2 d
  25. #include <linux/module.h>0 v' N' e2 P& ]3 L* g
  26. #include <linux/init.h>. z4 t$ g" {& j
  27. #include <linux/errno.h>
    % o$ |* w/ R* o& D4 o% K: R: B
  28. #include <linux/types.h>% a  T4 U( N+ {4 t! I& M
  29. #include <linux/interrupt.h>  B- |4 N0 }! |9 x1 S! w+ g
  30. #include <asm/io.h>' C: e3 _, Q' z% L4 X
  31. #include <linux/moduleparam.h>- n8 l$ x. a6 v8 w5 a0 V
  32. #include <linux/sysctl.h>0 g& R; B! n0 Q1 R
  33. #include <linux/mm.h>, l. H" _0 R* A
  34. #include <linux/dma-mapping.h>0 }$ O: r. E* j# W. p/ L

  35. 8 j* }) Y+ w9 K4 h5 N
  36. #include <mach/memory.h>: Y0 W7 |+ A1 d' x2 h
  37. #include <mach/hardware.h>
    2 |* `: U6 B; @" l+ Y
  38. #include <mach/irqs.h>
      g3 E) L; o: t6 A( F/ z
  39. #include <asm/hardware/edma.h>
    : X% G6 }% P* z0 \9 ?

  40.   m4 Q: S8 z2 \. ?3 H+ Z" [
  41. #undef EDMA3_DEBUG' x+ ]: f- {  {" u8 ]: q
  42. /*#define EDMA3_DEBUG*/
    + l  C$ d" s! I! ~% G5 u

  43.   x6 d/ x0 v$ F( ~$ ]0 d* H6 J) J, }
  44. #ifdef EDMA3_DEBUG! A; d1 U, O' J% ?8 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 f+ q" R2 d* S6 h8 {' l( p2 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , d5 x5 P. t7 R- C( g7 F1 B9 _7 x7 R" n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / S1 a1 m4 V0 C" _! }- [8 t
  48. #else9 c3 W, Z& g4 K  \
  49. #define DMA_PRINTK( x... )+ J9 d0 T2 u# k2 d& m
  50. #define DMA_FN_IN6 E: m& Z& X8 ?  n. x
  51. #define DMA_FN_OUT, g# G) Y4 g0 d" J8 ?
  52. #endif) l/ b  ^! \# r: z. r) Q
  53. - _; q7 d3 K' _! _( I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) u9 J8 J4 |* \' P# e
  55. #define STATIC_SHIFT                3
    ' d( c" |; L' C+ e
  56. #define TCINTEN_SHIFT               203 S' e9 P! U# i% [3 v! _/ v3 A
  57. #define ITCINTEN_SHIFT              21% j: [( u2 s1 P# J! W0 R: f
  58. #define TCCHEN_SHIFT                22( P  g- d4 _; V& N$ {
  59. #define ITCCHEN_SHIFT               23
    . e; R$ T; Y! U7 n
  60. 5 N9 T& \$ ?! z+ d6 \, X/ u& v
  61. static volatile int irqraised1 = 0;4 g4 Z$ a& f! M. D8 l
  62. static volatile int irqraised2 = 0;( Y% m/ A/ F1 X& I% [) b. s; b3 `

  63. 2 ]& y$ w1 K& k1 H& ~! a0 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 L4 ^5 W. }2 z" f" B/ {) i3 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q: u9 E  \' Q& W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; Y* _8 B0 k9 r  `8 g

  67. 1 ]( b+ n3 d! l5 {3 w7 ^5 w
  68. dma_addr_t dmaphyssrc1 = 0;- h8 ~$ O. f" y* h, T
  69. dma_addr_t dmaphyssrc2 = 0;1 f. g1 D' y7 E" f
  70. dma_addr_t dmaphysdest1 = 0;
    2 R1 h: v; U# k$ A( v. h
  71. dma_addr_t dmaphysdest2 = 0;
    ; T' M) @9 o6 l0 k% e

  72.   {( d- K; _: \! I/ T1 ~
  73. char *dmabufsrc1 = NULL;
    ; l! g; R# u& S. W
  74. char *dmabufsrc2 = NULL;
    " ~: v4 `( z- J8 C
  75. char *dmabufdest1 = NULL;
    ( P( l- U4 Z1 c
  76. char *dmabufdest2 = NULL;9 j) D8 n# C2 E

  77. 7 S  p/ Y3 c* S: j5 |3 q1 Q
  78. static int acnt = 512;3 J( Z" c0 Y& H+ I! q! t, @
  79. static int bcnt = 8;
    . |/ H) c$ Y( k7 p0 w8 F# p. F
  80. static int ccnt = 8;, ]! F1 U8 \# g
  81. : ?. S  @7 g  \- R4 I8 e
  82. module_param(acnt, int, S_IRUGO);; W6 Q7 q6 u, R4 [, K
  83. module_param(bcnt, int, S_IRUGO);& @5 R: i$ r6 i# n; f  q7 ^+ ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 n. T. P1 M6 O; M+ e1 Q0 n: r

; i6 n0 M$ s9 B* u( U, n, h1 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ N4 ?" L7 ^. Y2 K7 _: ^& Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ x9 U. ]8 o/ T: R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 K2 w3 B" r. Y% X% N7 P8 W

! T# h. q+ `0 Q: w$ O0 G! a" b8 G4 z  }7 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 17:54 , Processed in 0.038287 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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