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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; [* Y& y9 L9 q( v/ h
  1. [code]EDMA sample test application
    5 n9 d: R: p$ z! n
  2. /*) E! L+ N' w! I
  3. * edma_test.c+ J! P$ N9 w& I  `
  4. *
    2 M/ G1 E* h/ ]  C0 y: U
  5. * brief  EDMA3 Test Application7 r  R3 H( y: Y( z  G" N3 T
  6. *. u) n5 P/ J6 |* [( X
  7. *   This file contains EDMA3 Test code.
    4 E" x  p+ H! L8 m
  8. *. v. q( E3 B* G. k8 s0 S( l3 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ F$ T) M7 Y4 P- P8 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) b4 E2 ~2 ~. D! y
  11. *         TO CHANGE.
    / A0 H4 a! C2 |& Y: K: g2 E$ X
  12. *
    % b6 e, ]* ^6 w6 p! a( _/ }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 v* J) b" R2 M5 p
  14. *
      @' [. c- P2 d0 L& i
  15. * This program is free software; you can redistribute it and/or
    8 Y3 n" K7 Q# C' ^
  16. * modify it under the terms of the GNU General Public License as& O! H5 U; g) Z5 d8 o8 O0 ~
  17. * published by the Free Software Foundation version 2.* e: s; ^& H6 q9 |; h
  18. *' c: w! I  K, S$ `; L7 b8 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / E' j" F- [' a: q
  20. * kind, whether express or implied; without even the implied warranty
    , g% c; B0 Q$ e$ m  H- d. U0 `. P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 z* }9 R. E6 \: L
  22. * GNU General Public License for more details.
    % {/ x% e: O4 |
  23. */
    9 _0 `8 F+ t1 A, A2 Q, Q
  24. ( ?# J! k+ a7 K7 O5 f
  25. #include <linux/module.h>
    2 S) T  l3 d, h- G
  26. #include <linux/init.h>7 P0 {6 i( @; O8 L% W' J# p
  27. #include <linux/errno.h># Z2 a( ?+ I) M' }: @: G& M
  28. #include <linux/types.h>
    ' f) E1 N. U& X1 Y. Y1 }  x4 W
  29. #include <linux/interrupt.h>2 Q$ `) @/ c" V. |, {) c2 a
  30. #include <asm/io.h>$ @- i, t5 l0 I7 H
  31. #include <linux/moduleparam.h>0 N8 G- Y2 L3 }) }9 X
  32. #include <linux/sysctl.h>: O- z, p( _7 l
  33. #include <linux/mm.h>6 b1 l0 Z! U6 _: `4 t; o$ x8 ^
  34. #include <linux/dma-mapping.h>% X8 k( N. v4 r  l* s  N5 C3 z
  35. " X/ E6 O1 k" R- s7 D
  36. #include <mach/memory.h>: ]" s  M. o+ y9 K. T
  37. #include <mach/hardware.h>
    ! w0 _( n: ]. {6 m
  38. #include <mach/irqs.h>
    , u4 i& j8 c6 K+ S) B
  39. #include <asm/hardware/edma.h>
    " t6 L3 H' L" e9 R# N4 g1 o! h+ h

  40. 8 E/ r) N0 Q2 G" H: ~# H) L
  41. #undef EDMA3_DEBUG
    ) ]  N' M, E, N) w, S) D1 L+ b: c
  42. /*#define EDMA3_DEBUG*/8 |1 p+ t& N1 U, k) \$ ?

  43. + s+ ^/ ^) ^, S' d  {
  44. #ifdef EDMA3_DEBUG' D9 \; A! T. P3 Q! `: {+ \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); ~  R6 o* ^  o9 y. u6 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , }7 r* u! k  K% }; k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      G/ B4 j+ X! z: Y  z# s
  48. #else
    8 v5 w- f) h; |& \9 P" T8 f8 I" f
  49. #define DMA_PRINTK( x... )
    $ o* A$ Q6 [% o- v/ ?! h' T
  50. #define DMA_FN_IN% s8 h/ m9 V" d# [1 s
  51. #define DMA_FN_OUT
    " V8 L3 d2 g1 s' y
  52. #endif
    ! y# J9 E) P: G
  53. ! O+ }# x& V8 h+ t2 c9 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , x: x5 b( T- S' u
  55. #define STATIC_SHIFT                3/ ~  T5 I( H; s
  56. #define TCINTEN_SHIFT               20
    ) \% i. A/ G! w: s, @
  57. #define ITCINTEN_SHIFT              21
    - K/ w7 R3 U7 Y$ c
  58. #define TCCHEN_SHIFT                22' R) Q+ I4 O; E! `" W
  59. #define ITCCHEN_SHIFT               23& b, j# A/ Z. Q! r$ |

  60. % T6 u/ X4 ^! W1 p% R
  61. static volatile int irqraised1 = 0;# N( l/ A3 ^& \: n- D" m0 p, |
  62. static volatile int irqraised2 = 0;
    9 e3 _$ S2 W& d$ w0 R0 v
  63. # Z' C! h* e7 O, M( I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N9 p# |. F+ T! s! q/ w! i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # o; _9 @( ~7 }, I5 H: }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 q( r. q4 x5 g4 @8 d9 N: H
  67. 5 }6 _" `2 k' [+ Z0 z
  68. dma_addr_t dmaphyssrc1 = 0;9 s: k: v. Z, Z0 e$ q) |
  69. dma_addr_t dmaphyssrc2 = 0;0 H. {6 K0 F& q
  70. dma_addr_t dmaphysdest1 = 0;/ C' [+ I. b$ r" _! H
  71. dma_addr_t dmaphysdest2 = 0;9 U/ I2 R, M7 Z& x2 i- X
  72. : K2 I5 c' ]0 G- J
  73. char *dmabufsrc1 = NULL;
    6 s) u2 u+ A* I; j! m0 `, D0 D
  74. char *dmabufsrc2 = NULL;* N2 L1 Y9 H9 d  G
  75. char *dmabufdest1 = NULL;
    $ Z3 U% x; G% N5 ^/ {6 ?) N
  76. char *dmabufdest2 = NULL;
      u8 a# V0 z' X
  77.   j) A" K. O/ w
  78. static int acnt = 512;
    2 i0 V' ]5 X1 D3 w* s
  79. static int bcnt = 8;3 Y: ~+ K7 i( p! s3 o  j
  80. static int ccnt = 8;, U1 L3 B* C3 d+ N* \0 X! g7 l
  81. 3 s5 [: s# F8 x8 A
  82. module_param(acnt, int, S_IRUGO);
    6 m- s1 G. k/ e  K
  83. module_param(bcnt, int, S_IRUGO);
    3 G: n8 N: N6 x) T2 _9 _* ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 p, l7 _; E# b' ?

+ ~* M, S; E8 x5 o* D9 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 z7 L! r! h! |) r; W6 S+ `$ p1 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# A% \, A3 q/ C$ ~! ^: r  r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 X( D$ ?- T1 ~. ?" v

! }  W) y3 m/ `' V* n( D: M( r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 22:23 , Processed in 0.038757 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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