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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( X- i% X9 B# j5 }( y# y) D8 A
  1. [code]EDMA sample test application
    " Q# ]5 @' t$ S7 w. C
  2. /*" Y2 \. P, w( y0 V7 o0 n9 m/ E5 q6 h* }
  3. * edma_test.c
    & g9 m) k  b" y4 v* U
  4. *! {) }6 r, @- ?+ Z/ S
  5. * brief  EDMA3 Test Application3 p) t& _7 _$ d8 B; y! Y+ E
  6. *
    $ y& t. h* g& x- j
  7. *   This file contains EDMA3 Test code.
    5 D; y* J/ @4 G5 r4 U) H# {8 K
  8. ** U( r, p: r6 Q- o. Z' V4 I' z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& E+ S! R; F/ k% i/ G: Q+ D5 _; ]" y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 m2 v, C( x) ~+ |! t* \
  11. *         TO CHANGE.$ d& l' Q/ i2 l0 \5 e
  12. *0 \& L: a- g: z* j; F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 F/ o4 n! ?: i% Z) M* Z0 Z+ M
  14. *$ a' M" c. w; s4 {8 }  \" z% h5 y
  15. * This program is free software; you can redistribute it and/or2 F# Y( _& F& b( v8 m$ j" H8 ^9 i
  16. * modify it under the terms of the GNU General Public License as2 p& @/ o- S8 f4 o  m0 J# v
  17. * published by the Free Software Foundation version 2.
    8 X$ X6 L' o6 q: ~8 a( L
  18. *. K' t" v/ r. F9 t2 }/ F, H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # ^. u0 H' g& d; o+ |( a' ~: @( E
  20. * kind, whether express or implied; without even the implied warranty) P  S7 J/ V" ~# S2 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + i" W/ g6 u( \) h& u. k
  22. * GNU General Public License for more details.
    2 Z  B; Q' U1 J' c' K, U: r
  23. */
    ( f& w7 I$ M! w' y
  24. 7 I' @! m& K5 `3 D
  25. #include <linux/module.h>' F4 l1 z5 j5 F( I  Q2 a: F
  26. #include <linux/init.h>4 h7 X/ e" l3 G' Y: N1 x' @
  27. #include <linux/errno.h>" W- k& T1 O# `
  28. #include <linux/types.h>
    ' c/ ~' H# l) j" ]
  29. #include <linux/interrupt.h>, Q/ M8 x4 z1 G" k: e
  30. #include <asm/io.h>4 J: C  w( R: U4 q, v9 W
  31. #include <linux/moduleparam.h>3 `9 I4 m. l: Y- u3 v
  32. #include <linux/sysctl.h>
    1 |: l& O1 p8 ]6 {
  33. #include <linux/mm.h>  ~$ }8 l5 `# s; S
  34. #include <linux/dma-mapping.h>
    8 B; _7 j* Y. o) v" d
  35. ) m7 a5 ^# n2 H$ F( `, t
  36. #include <mach/memory.h>4 N% I) Z2 M( t' M9 J- s) C
  37. #include <mach/hardware.h>
    7 d& M$ M, U1 Y' J6 p
  38. #include <mach/irqs.h>
    1 ~/ s, u4 ?' ?* g
  39. #include <asm/hardware/edma.h>& T3 T6 `: K5 S8 V: J

  40. 1 k" [* Z% F; O" _5 y
  41. #undef EDMA3_DEBUG. A, V+ n  E0 e' x
  42. /*#define EDMA3_DEBUG*/, _. _. G) S, g2 {
  43. $ j8 H  _( H! H! R: {5 r6 F
  44. #ifdef EDMA3_DEBUG% B- e8 m% I4 [1 R6 X7 l; M2 R) O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . Y4 U2 X' A" X8 D/ E, O2 J- k  w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 z9 `) v6 m3 o( d9 R3 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 d% H8 W% k( S3 R
  48. #else
    4 y# }3 A" Q1 d8 {3 j5 ]. M% h& p
  49. #define DMA_PRINTK( x... )4 t. Z3 Z# c% G0 S9 J
  50. #define DMA_FN_IN
    ; G+ s/ s- c- Y
  51. #define DMA_FN_OUT
    1 E2 n+ s; S6 Q9 ^" e/ v2 V1 O! G" x
  52. #endif$ j( P) y5 M- M( e
  53. * Z4 @* b2 ^+ R; H+ @3 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); H$ A% ]5 v1 k
  55. #define STATIC_SHIFT                3
    ; E% ^. B6 a; R
  56. #define TCINTEN_SHIFT               20
    $ T, h3 c- h, o
  57. #define ITCINTEN_SHIFT              21
    # o3 a* k+ k- r: e3 o
  58. #define TCCHEN_SHIFT                22- _" |: L8 Z/ @* h
  59. #define ITCCHEN_SHIFT               23! M3 ], N% P4 N( ]1 Q3 p
  60. * U$ g8 j2 c% `7 H
  61. static volatile int irqraised1 = 0;3 l/ ]- |' e9 O, Q$ ^; I
  62. static volatile int irqraised2 = 0;
      y4 O2 [& G9 `/ N/ I1 _

  63. 0 s  Z/ O5 e, \2 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 \5 H/ F+ k% K2 f) w/ s) q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A+ A! {6 k3 a6 w  X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 i. S, Y; n* t/ o7 Y" K
  67. " Y9 e8 U8 q( m5 K4 I) G
  68. dma_addr_t dmaphyssrc1 = 0;( T1 o1 O5 Y" J3 G& x$ s: V
  69. dma_addr_t dmaphyssrc2 = 0;) n$ Y2 W. \  i; R5 @
  70. dma_addr_t dmaphysdest1 = 0;9 u6 T6 h5 R9 Z3 O% W( N! y
  71. dma_addr_t dmaphysdest2 = 0;* Y; p0 X5 F; A+ w1 o; V. ]

  72. 2 z* I/ z1 z$ T* Z" F
  73. char *dmabufsrc1 = NULL;
    0 x- i( l7 A) [. u+ w# m
  74. char *dmabufsrc2 = NULL;3 d1 b9 p! d  i& N
  75. char *dmabufdest1 = NULL;; r, C9 ^$ f7 S
  76. char *dmabufdest2 = NULL;
    ) {' y, C' k: ?* f
  77. ; p3 S6 d5 G7 h5 w" l' T' _
  78. static int acnt = 512;& b- Q5 L/ m4 a' U9 Y& c( R
  79. static int bcnt = 8;
    6 R; R+ G# ?4 b' p
  80. static int ccnt = 8;3 J' N4 W) G- x' j+ N: d$ R: d* ^
  81. % V. H9 X; g- T6 ~9 H2 ]6 N
  82. module_param(acnt, int, S_IRUGO);
    ( M  d# z: ~2 \% S
  83. module_param(bcnt, int, S_IRUGO);, O- G: B, _% V2 f( t$ }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 J# y7 F+ @; K3 c% Q+ a$ x/ Q

$ {& I5 w% k1 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 X$ X8 }% B/ r: m( o! O# farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ T9 ^3 P, Q4 z2 O+ y, o+ C# o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 [) L5 ~6 W' e, m/ Z
1 U$ u9 R! L- S9 q4 }0 X7 s' G2 I9 b% M2 L0 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-15 00:54 , Processed in 0.047742 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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