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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; m' `4 R! e$ K9 \. @0 d) p' f2 k6 J
  1. [code]EDMA sample test application
    / t+ M" y8 T* D: y7 A0 b5 Q+ r6 r4 r
  2. /*) Z( y, Y; A3 _5 p1 B
  3. * edma_test.c3 A! V  b# Q( ~! `7 P0 u
  4. *
    9 G3 E6 u5 P0 [# S5 Q+ l/ I9 n
  5. * brief  EDMA3 Test Application- m# S( N, k' H% ~2 K8 }
  6. ** t- `# n  G& G; @, c1 d
  7. *   This file contains EDMA3 Test code.) u' |- f  }) F" F/ |0 \. y# E
  8. *% M( ?% F: z3 c, \( w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      j( D; y9 g, S$ f9 a6 v  I6 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 M4 r2 ~  Q+ O* Z
  11. *         TO CHANGE.
    ; ^# J" i3 h( g8 c% d1 w, t5 F
  12. *% `; e! L" L; h( k3 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 S* `. C" Y- x1 E# f& Z
  14. *
    , |5 m5 x9 V- k0 K3 G' G3 W6 N5 o
  15. * This program is free software; you can redistribute it and/or& l  m5 v- z% F5 L0 D
  16. * modify it under the terms of the GNU General Public License as1 Z' X' A! e# P8 Z8 r
  17. * published by the Free Software Foundation version 2.
    8 T% h6 ^2 p- j6 n1 d6 A$ z; b  w
  18. *& |- s$ R' q8 S0 l4 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : n% h/ W- R& ~
  20. * kind, whether express or implied; without even the implied warranty7 ^* J" Y) `1 h7 s6 q. _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 _) Z/ `, l& L
  22. * GNU General Public License for more details.# o& U- q# Z% o* W" `0 g6 n
  23. */
    8 N+ f9 }0 j2 C; E4 p2 @

  24. , U! C8 w" n9 j4 p
  25. #include <linux/module.h>
    - M1 _/ a( b" O3 F; w" K, D1 r
  26. #include <linux/init.h>" i$ M) i& F5 T, t8 G
  27. #include <linux/errno.h>
    . u' o5 Z, y& D! R" `2 {( o
  28. #include <linux/types.h>
    9 _5 @$ S  f9 X' Y
  29. #include <linux/interrupt.h>
    9 C* j" o  A- A: h
  30. #include <asm/io.h>
    ! E- m+ |" i6 I2 w. `
  31. #include <linux/moduleparam.h>6 O% g2 K! n& ]5 _. O; H
  32. #include <linux/sysctl.h>% t8 O3 `" J. C: M8 x0 R
  33. #include <linux/mm.h>
    3 x# j* w4 Q: Y; `  u3 U8 F: ~
  34. #include <linux/dma-mapping.h>
    ! q4 E, e+ j+ f0 ^) ]" `# W9 ]7 H
  35. 6 n8 M1 p0 z& N! ~2 `
  36. #include <mach/memory.h>( ^4 o( r) F: X& a! K( T
  37. #include <mach/hardware.h>
    ; a# T1 g, ^( B# ]  R6 M5 l
  38. #include <mach/irqs.h>
    # Y. r" i  K2 C$ w. `# M
  39. #include <asm/hardware/edma.h>
    " k  [* t$ \) x; v& O0 Z

  40. ) Z) y  [" v6 X$ i$ D2 v  c
  41. #undef EDMA3_DEBUG
    1 |. X' m  }- g& ~
  42. /*#define EDMA3_DEBUG*/
    ( ?& ^3 b6 ~7 y9 N' ~0 i

  43. 6 h. P7 D' F  \
  44. #ifdef EDMA3_DEBUG
    . U! z. a7 a. r& m" I0 l) q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! j  K7 O. q: @  l; o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # }# P- \# Q) {2 A6 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 C$ Y4 g( g$ V2 z6 \- b0 V
  48. #else& ~4 L, m  U# \: j" k4 _8 l
  49. #define DMA_PRINTK( x... )* v0 M$ ~0 n: m8 G# U5 F4 U7 ?+ X
  50. #define DMA_FN_IN+ d, ^# g# O' b" L; N2 {' A* n
  51. #define DMA_FN_OUT6 Z( s& w+ a& L% o" R5 I+ q
  52. #endif1 I+ n. N4 `. B/ p- Y2 D
  53. 7 ^5 \, c# f+ F8 ]2 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ F* L2 ], ~3 u6 g  e9 I# e% y
  55. #define STATIC_SHIFT                3. Q' B. v3 j/ t  h' {9 Z
  56. #define TCINTEN_SHIFT               20
    " U; X/ m  b  H+ o/ T% w, M
  57. #define ITCINTEN_SHIFT              21# \, C1 t- {. ]: L4 I/ B
  58. #define TCCHEN_SHIFT                22
    . {3 d& p6 b) g5 m7 b
  59. #define ITCCHEN_SHIFT               23- }7 m$ ]7 R# y: l7 I5 f

  60. 1 u8 |& c. z/ J" z! ?4 c. u6 u
  61. static volatile int irqraised1 = 0;  x+ e! z/ _1 K! ]  I
  62. static volatile int irqraised2 = 0;) w7 z4 a% Q- G8 H5 T
  63.   Z) K+ ~" O5 }6 t8 r% H/ y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      y: m% i' y, @' ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 E2 ~1 ^+ X/ w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 \5 _4 y1 A  _0 i

  67. , W2 z$ l: p3 j; w: B6 N+ k3 T' h
  68. dma_addr_t dmaphyssrc1 = 0;+ B0 h7 k. s- M! ^8 {8 n9 Q! R9 d
  69. dma_addr_t dmaphyssrc2 = 0;
    3 V+ M0 ?5 O5 H* d
  70. dma_addr_t dmaphysdest1 = 0;% ^: f( |# _; ^  P: N; \
  71. dma_addr_t dmaphysdest2 = 0;! l$ N. A8 }& l: d6 s
  72. . G* ]9 r( H# J2 U
  73. char *dmabufsrc1 = NULL;
    5 t! Y2 k# R! z) E
  74. char *dmabufsrc2 = NULL;, v( v" B( E( S0 m
  75. char *dmabufdest1 = NULL;
    , V8 ^. E) B, x: |
  76. char *dmabufdest2 = NULL;
    % P6 I- ^* ?8 \3 Z
  77. 2 T/ O" x: V( s
  78. static int acnt = 512;9 U/ j0 H) ~* W  U3 r
  79. static int bcnt = 8;
    ' M' ?* G: ^2 d9 K
  80. static int ccnt = 8;# o& {) m1 t. Z8 h3 w

  81. + q2 J2 j3 C0 o2 O
  82. module_param(acnt, int, S_IRUGO);% n0 x7 E- @8 \1 I) M5 Z4 H
  83. module_param(bcnt, int, S_IRUGO);
    6 r6 V! z1 g: e, r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 |' @3 n/ }( \$ R6 `+ \4 E6 f8 l
) @, ?* I1 p5 j* D2 `2 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ L2 r0 c0 `) V" V0 B  q8 N. aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 L. q- u3 X: Z/ X' O! U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 u3 x! m* Q- U  ?6 q1 R2 b. b. |4 S  |$ [

# z% A7 ?) p# G' k% w# Z" w4 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 06:47 , Processed in 0.038650 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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