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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. l5 m2 h! `" o$ \& ~" x& @+ a4 _, d
  1. [code]EDMA sample test application0 Q* S8 F% x/ o  I
  2. /*' r1 d  [6 T9 k4 |4 s$ O
  3. * edma_test.c
    ) ?2 Y: p' j0 K% p- I- L* ^
  4. *  U" a2 l* _$ b- s
  5. * brief  EDMA3 Test Application
    6 V3 m3 \  Y6 K) t- p8 ^. Z) i$ N3 u
  6. *
    / u$ z- \- @4 Z: Y2 g5 S" X6 e
  7. *   This file contains EDMA3 Test code., M7 X* @0 K  w/ ^4 R, F8 O7 }5 ]9 j
  8. *. D' I& O: \" l  }# R9 v* D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ~; R- r0 h5 j/ ]8 d7 Q1 P* s& y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ J0 U6 q( p3 W) Q4 Y* y' y
  11. *         TO CHANGE.  y! Q3 A3 f8 L! v
  12. *+ w, w% r  P8 E5 Q4 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - E9 e; W  j: u$ l8 g
  14. ** l# e: q$ I  \) {
  15. * This program is free software; you can redistribute it and/or/ v. P- V7 A# B" G
  16. * modify it under the terms of the GNU General Public License as! E, f  {9 ?8 n
  17. * published by the Free Software Foundation version 2." o9 \/ Q. g& ]# G7 {( c
  18. *6 l5 `6 Y# @7 {" Y& M' M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 l+ Y+ y8 [) v6 n- k3 `, a
  20. * kind, whether express or implied; without even the implied warranty
    2 C- X4 W1 n3 X; y! d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 H4 K6 w6 w$ E& a, n
  22. * GNU General Public License for more details.
    ' }- W; H2 t2 e
  23. */2 @7 w! y2 s. r  m  D, M; ^
  24.   m# ~3 `) C7 J# d7 e0 Q7 b
  25. #include <linux/module.h>4 z0 ?% `# w! @8 a7 p3 J3 @8 Q: V
  26. #include <linux/init.h>' Q+ ^3 m! e+ H7 |/ \
  27. #include <linux/errno.h>
    . ^1 Z) u! @/ E. X' q1 r/ C0 s
  28. #include <linux/types.h>
    8 F) ^0 N, R% K1 g! @
  29. #include <linux/interrupt.h>
    0 d  L* P, b% u: K# y
  30. #include <asm/io.h>
    ; z7 w- d, \' Q6 o1 F+ `
  31. #include <linux/moduleparam.h>
    5 _+ T1 S9 r& W  X" J
  32. #include <linux/sysctl.h>
    5 i; N! ?/ s5 o" ]
  33. #include <linux/mm.h>
    ! }1 h! n6 k- ~$ t
  34. #include <linux/dma-mapping.h>
    + z1 M: f) e! i; d' l+ n9 w8 y5 a% _
  35. / {2 Q9 [' P( a9 L8 [
  36. #include <mach/memory.h>
    7 ^4 Z3 B# {- h3 h0 W8 c
  37. #include <mach/hardware.h>
    : p9 N4 [/ T/ i3 E1 r; B
  38. #include <mach/irqs.h>0 V1 V7 x7 s( g& g7 y; z& ?* S
  39. #include <asm/hardware/edma.h>% i% U) o! r! q+ y8 J# ^8 t
  40. ) Q* k% X- e" R  b. j9 _" ]* [' E4 N1 i
  41. #undef EDMA3_DEBUG8 b; P. W# M  ^% ~( |4 h4 |2 j+ w
  42. /*#define EDMA3_DEBUG*/. O/ |% h8 S! e6 I7 T% h( w

  43. ; |4 j. l# G' W5 }' k7 E/ v  D
  44. #ifdef EDMA3_DEBUG  f' C5 o2 |1 v0 A- f( p- C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! k7 V) ^6 ]& Y5 V. H/ z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 h- Z+ \6 E, J* k# e" k5 J* k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # z: V% S! f% [; J
  48. #else
    ; o1 _& z2 E* o% N
  49. #define DMA_PRINTK( x... )
    ( D" t! d" t# F2 G8 z1 |
  50. #define DMA_FN_IN
    $ ~. x" z3 C3 I& e: ^
  51. #define DMA_FN_OUT9 B- ^) i8 W( n1 Z7 A! x
  52. #endif4 Q9 A4 ^0 S" p

  53. & B, w* f' `7 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" ^, v0 n9 B. o- h# ^( p" j; J  m$ u
  55. #define STATIC_SHIFT                39 r; u7 l: A% s. c  A* A
  56. #define TCINTEN_SHIFT               20. m# z) {0 v/ ~" f( o
  57. #define ITCINTEN_SHIFT              21- V. \* R: v! x% D
  58. #define TCCHEN_SHIFT                22
    2 N2 ?! C8 d3 X. d3 z
  59. #define ITCCHEN_SHIFT               23  S) b1 k4 a* o9 H9 C" d

  60. 9 E4 D$ n: d# U3 S
  61. static volatile int irqraised1 = 0;" {0 x! v7 K- _
  62. static volatile int irqraised2 = 0;- h* ?) o6 z! k

  63. 8 i, P% c( r! m4 c, A! l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ~0 |, K% ]* w( j6 N; ]/ @$ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u* B# N: ~2 E9 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X9 q! J% m% J1 E: a1 b

  67. - k# j/ [) V7 M0 v9 q# E5 G
  68. dma_addr_t dmaphyssrc1 = 0;
    2 U* _8 H0 c  }0 d0 R
  69. dma_addr_t dmaphyssrc2 = 0;
    ) l1 p# j8 T6 F% ]5 n0 }0 P6 j
  70. dma_addr_t dmaphysdest1 = 0;3 X5 o2 \6 A2 }4 }  h) f
  71. dma_addr_t dmaphysdest2 = 0;, G1 n( o: P' A7 L6 U+ o# B

  72. 8 ~7 q& n/ g5 |, K
  73. char *dmabufsrc1 = NULL;  D* V/ i8 }0 J: T- L( f9 |
  74. char *dmabufsrc2 = NULL;: ?3 Q6 x9 `8 `. j$ E% p1 Y. q# W
  75. char *dmabufdest1 = NULL;- B4 l  [" V/ @) J6 m0 ]& c
  76. char *dmabufdest2 = NULL;0 {  D7 k) j  j' L

  77. ! u- c" g% x' B( T- G( X" ^* ^
  78. static int acnt = 512;
    0 |) S/ L# `" t. G" A) C
  79. static int bcnt = 8;" A: b3 ?! r* I; J/ j) R
  80. static int ccnt = 8;
    . L( w# M" p% h# ?: n( `$ O+ M2 f

  81. / I4 E& I: Y% W8 O% B8 D
  82. module_param(acnt, int, S_IRUGO);
    7 W3 G7 ^$ c" F
  83. module_param(bcnt, int, S_IRUGO);
    ( i! a" x. a& b; J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, E" d! t7 f1 y
! [2 j2 E6 J5 w0 Y* N" T' I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* g; x0 z* s2 S9 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ?0 v1 H$ L  n* q9 G. {7 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. z4 }$ H0 c* E1 Y
1 Q' U% T, N( `& e; `+ g: Z& W
8 @0 P* H: k2 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 07:54 , Processed in 0.048834 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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