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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 W; N3 T8 x' J4 }, E8 _
  1. [code]EDMA sample test application. V  [/ L8 L8 S: v- f* W7 [. @
  2. /*2 j+ U; {# {4 x* {
  3. * edma_test.c3 u. v& A. @' `7 c
  4. *
    4 |! u: j: t0 h! Q
  5. * brief  EDMA3 Test Application
    " ^2 O3 N. d1 D+ I# p
  6. *
    1 l$ u/ f7 C) P. b+ X+ g: {5 b6 o
  7. *   This file contains EDMA3 Test code.$ H- n, v% k: b# N: P7 q! B# u
  8. *
    : M: T* e; a) d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & c$ a: E4 y  g. c$ |; n9 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 L  ?9 U/ f  V/ c. d. G/ c9 s
  11. *         TO CHANGE.' j8 [" v! g3 o- W1 I( E
  12. *' c/ p6 U& {- y$ \1 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* c: Q3 }0 p/ @* r4 X8 u) Z3 ^# v
  14. *
    # z' R  l$ M, I; B' R1 c- C1 \
  15. * This program is free software; you can redistribute it and/or0 w% Z! u2 m& H% m/ \7 a" Q
  16. * modify it under the terms of the GNU General Public License as
      h3 L- V; {+ {5 h# ]6 T5 \
  17. * published by the Free Software Foundation version 2.
    9 u9 ~6 R, C* x; [1 |' Q5 [* O
  18. *' ]1 F8 g2 z) }# w2 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " v0 E8 y) u- m& j
  20. * kind, whether express or implied; without even the implied warranty) d7 K/ j7 S  d. l4 J7 m5 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, [  U0 @! l, X
  22. * GNU General Public License for more details.
    0 p& y  c/ g! \
  23. */
    4 P  ]$ T% d# n3 n  S6 w
  24. ) t, V# t0 d; d& \3 V/ t
  25. #include <linux/module.h>
    * j  F9 F. O* u. N5 f. P4 m, X
  26. #include <linux/init.h>5 k1 C- o! ?; w% }
  27. #include <linux/errno.h>7 b; t+ d% U+ a! }8 V& N9 Q
  28. #include <linux/types.h>6 x, s4 K$ W5 n- Z  E
  29. #include <linux/interrupt.h>; X0 g  w8 O2 t2 \  |
  30. #include <asm/io.h>
    % M( [: M; b' v' `
  31. #include <linux/moduleparam.h>- k0 X1 d- M6 Z) ]8 X5 o) j
  32. #include <linux/sysctl.h>
    6 u/ R/ \1 g! C5 x7 H4 i- ~9 t
  33. #include <linux/mm.h>
    1 G0 R( [; D- F0 B5 W0 |
  34. #include <linux/dma-mapping.h>9 R- |0 ~7 L+ h" t9 z
  35. * w; b* @, C+ F; x/ ?3 x# d% \% f
  36. #include <mach/memory.h>' w7 a3 Q. U5 U
  37. #include <mach/hardware.h>0 u6 l  N0 m) W8 a, g( G) Q2 x9 j' X% V
  38. #include <mach/irqs.h>
    - }& N& v) d2 H+ K) b
  39. #include <asm/hardware/edma.h>
    5 D/ D2 C/ A6 O
  40. 4 t7 O- R/ q  j
  41. #undef EDMA3_DEBUG+ I4 g) {4 E! U
  42. /*#define EDMA3_DEBUG*/
    ; I( m6 r8 }- I/ ?$ ?: E
  43. 0 M& e6 A1 C) Q0 j* L
  44. #ifdef EDMA3_DEBUG+ A8 c2 L! q. l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 y* ^$ R6 Q4 ]3 s4 g( A( C5 ^# F) P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ^. N" x7 o$ q! `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( @5 y) |. B' E- t  r1 h
  48. #else
    " `' m( H8 E( M/ P8 I, y
  49. #define DMA_PRINTK( x... )
    " q# }2 O6 o/ r1 z! h
  50. #define DMA_FN_IN: u: h3 }8 N. m8 W
  51. #define DMA_FN_OUT4 w: j! I4 B5 B, Q/ r7 S* x3 _; j
  52. #endif
    3 I9 Q4 ^9 l  V/ h/ D  T3 b
  53. & R# I7 q) u4 o" j  D% t5 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 a! m2 z! Y4 N/ S+ r
  55. #define STATIC_SHIFT                3- C# [1 q+ ]5 y4 v! D
  56. #define TCINTEN_SHIFT               20
    6 c+ u5 l9 O1 E: S4 @
  57. #define ITCINTEN_SHIFT              21
    / n; f, a8 _8 w7 F9 r( i# m
  58. #define TCCHEN_SHIFT                22
    , Z2 @7 o1 l. u# S! o
  59. #define ITCCHEN_SHIFT               23
    + g: N2 l% o$ X. ]4 f) t

  60. 7 D, s; S' ~( f+ i6 \% X1 O
  61. static volatile int irqraised1 = 0;. `/ Z1 G% K5 ^6 @  j0 A
  62. static volatile int irqraised2 = 0;
    # L: N7 c4 J3 ~0 J$ Z7 h

  63. - {  X. T: N1 d4 M6 \  D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a9 Y$ @/ J- A! r& L0 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c; f( |2 y; Y, X( }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q' b3 W  B, P. ?, W; T

  67. ! f% y6 }! g  i( R( g* o' a
  68. dma_addr_t dmaphyssrc1 = 0;
    7 K/ h& B! A% Y1 }4 B
  69. dma_addr_t dmaphyssrc2 = 0;
    ( T8 \7 Y) E9 L" w% X: y
  70. dma_addr_t dmaphysdest1 = 0;
    5 U- d3 q* u/ H9 I' N
  71. dma_addr_t dmaphysdest2 = 0;( H# m8 B! H! W) H4 ]
  72. 8 T: W  @8 ^" d; F
  73. char *dmabufsrc1 = NULL;( F" l4 m1 Q9 t
  74. char *dmabufsrc2 = NULL;
    ) \4 c7 h; Z5 n5 i" t/ X8 k0 `. G
  75. char *dmabufdest1 = NULL;
    : I6 v) O& C/ j0 }  _
  76. char *dmabufdest2 = NULL;. {6 T& X+ ^5 F5 {
  77. + D2 D) }2 s  f4 S
  78. static int acnt = 512;" c# ?* h6 Z: _6 u0 o; v- N8 _
  79. static int bcnt = 8;
    ) L( K. x) W0 {3 g) R( O
  80. static int ccnt = 8;
    ' X" T/ ^* [" J
  81. # P* V0 u: A3 O. a  h+ o9 U1 l
  82. module_param(acnt, int, S_IRUGO);& V! C) r3 M3 M  l* V) S! y5 F
  83. module_param(bcnt, int, S_IRUGO);* \4 F" x0 `& a9 [  f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ c8 h7 G# H6 l# a8 ]3 \- M3 m4 R7 @# z( L5 C: J  V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% [( E( j( ^% s% z7 y7 d9 t' ?9 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, p; ?' M/ c. C2 i5 \  V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 {, \0 f5 q6 v1 U7 k8 o5 q

) z' k2 A+ H1 z7 X: k
6 T7 v& H; Z1 P" g* @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 23:02 , Processed in 0.039414 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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