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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) k) H  N, t( X5 b6 V- [
  1. [code]EDMA sample test application
    2 r# e5 t7 c" U, e# ^; a+ V" X( [/ z
  2. /*9 v$ u) Y5 g/ i8 t0 H) R7 i( P$ Z
  3. * edma_test.c
    2 |; l" ?1 m* Z/ f; {+ E1 _: [: T3 o
  4. *
    5 `( M! N6 _2 S: B: m: O' K# @
  5. * brief  EDMA3 Test Application" V# h  }( Y( s! y) p4 W
  6. *8 \" u+ u) y' N, h# I8 }$ z' S
  7. *   This file contains EDMA3 Test code.
    / }% Q. R7 ~  L( o. ]- O/ A
  8. *
    & p, `$ j. l+ c* ~9 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% N* j; W, u; f( I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( e& Q# e( d% Z' l4 v
  11. *         TO CHANGE.
    ( D/ h( H0 `7 j' X6 D1 R" S
  12. *
    6 H9 N  ]4 n' j, n5 [2 s2 \/ H( ?  L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 O/ G2 t  P: U! J
  14. *- ?5 P' G4 z! P" Y
  15. * This program is free software; you can redistribute it and/or/ T; y6 K. z: Q* y2 T3 \
  16. * modify it under the terms of the GNU General Public License as
    ! W3 _* P* j! z  m. v
  17. * published by the Free Software Foundation version 2.- W- q2 R+ j/ H/ `* e
  18. *1 z; d! W* g1 W) H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 p& n' T' T0 r) K' k7 T
  20. * kind, whether express or implied; without even the implied warranty( i6 a+ X/ U  \& F$ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Q) Y. |* L& n( i) g. l
  22. * GNU General Public License for more details.6 k. }( B* p$ {& x
  23. */
    6 U( |; Z3 p5 k  j; Z9 \
  24. 8 O9 G; `+ o8 l* y
  25. #include <linux/module.h>
    " E; F7 b: h8 @, j. z
  26. #include <linux/init.h>
    ' I* S+ p; c$ ?) s, Z8 z$ d
  27. #include <linux/errno.h>1 o9 W% V8 w1 \5 N# J; `% g
  28. #include <linux/types.h>% N5 J4 b2 X. I, H+ r- Y- K
  29. #include <linux/interrupt.h>. D; C2 t  F8 h# y* h
  30. #include <asm/io.h>
    : i7 a- e& P3 s: k
  31. #include <linux/moduleparam.h>
      V7 k8 Z+ b! R& @
  32. #include <linux/sysctl.h># q) f& x$ i7 e4 d) {) L
  33. #include <linux/mm.h>
    + J+ u/ r. F1 f% @
  34. #include <linux/dma-mapping.h>
    3 w9 Z9 p* y& O2 n; a: S
  35. / Y9 ?( {) o$ K  ]0 R# Q% X3 c. i, \8 g
  36. #include <mach/memory.h>% g; F# {% P5 H- d
  37. #include <mach/hardware.h>! Q; A) b0 ?/ }- m, U; _+ d  M
  38. #include <mach/irqs.h>
    9 V# M. v4 t+ p5 b. a( D, A9 }
  39. #include <asm/hardware/edma.h>/ B6 c# F8 D$ v

  40. : \; @& k9 n1 m* D- O
  41. #undef EDMA3_DEBUG& K9 }4 d* t9 ?  n- {
  42. /*#define EDMA3_DEBUG*/
    $ _$ v9 N1 b: {% g9 j
  43. * m4 x( x2 h  ?9 {: f
  44. #ifdef EDMA3_DEBUG
    " C$ t, p" O0 k/ t7 h2 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 f6 u9 d) l  f: O$ S* R, x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * s1 W7 ]6 ~9 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( x) X3 }/ U; G: A
  48. #else9 i  G# h: F5 O1 M
  49. #define DMA_PRINTK( x... )& j* q7 \2 d) W$ |0 n3 D
  50. #define DMA_FN_IN
    ! z! i! F. O: Q; k1 M7 L7 ]7 ?
  51. #define DMA_FN_OUT
    5 N- u, V$ F! g' {
  52. #endif: _* o$ u, l' f% p: L( s, \
  53. 1 }( x" ~3 e: [9 g+ _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : n8 E9 d0 ?: Q' |3 J) m
  55. #define STATIC_SHIFT                34 Y) ^! n3 m6 e
  56. #define TCINTEN_SHIFT               20
    - ?! h. a' d! \: P
  57. #define ITCINTEN_SHIFT              21
    , C- P1 k' X0 o; }0 _
  58. #define TCCHEN_SHIFT                22
    4 E! |; O. \) u" a1 a
  59. #define ITCCHEN_SHIFT               239 v5 t( y* M3 _, p6 G( i& p0 L

  60. ) Z8 `- P4 [& M
  61. static volatile int irqraised1 = 0;8 a# }' H6 {5 T' e4 @
  62. static volatile int irqraised2 = 0;
    2 y- E+ z* c7 \( n) O
  63. 2 k2 W# q( G9 K- U3 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j6 i9 t9 i' \/ y# h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A  B2 s; v4 |( g$ Y$ S" |; \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 [* x3 P8 t8 G5 B. H& V9 w7 R

  67. 3 S( O2 C1 n( H% \
  68. dma_addr_t dmaphyssrc1 = 0;/ _0 a" V9 J) P; X- F7 O+ `0 o  f+ q
  69. dma_addr_t dmaphyssrc2 = 0;1 ]2 o% @% L4 x0 o* S- q5 \+ |
  70. dma_addr_t dmaphysdest1 = 0;
      z! g6 ?7 U; g" b7 n* n
  71. dma_addr_t dmaphysdest2 = 0;3 {3 p( [+ ?% J( a2 G
  72. ! U! t' ?* e6 n3 p/ p" b
  73. char *dmabufsrc1 = NULL;9 W6 X4 i7 K: p0 r9 _3 t5 J
  74. char *dmabufsrc2 = NULL;
    / ~, N4 {: m/ h( ^
  75. char *dmabufdest1 = NULL;
    ; H6 h1 V1 X) n
  76. char *dmabufdest2 = NULL;* T& R. d! z1 Y$ r" }& h6 F, N8 [

  77. + D) \1 X' }" c( S0 \
  78. static int acnt = 512;& G+ t+ I* P' n3 m+ Z# \3 R& W
  79. static int bcnt = 8;
    ( @7 q3 f* s/ N3 g
  80. static int ccnt = 8;
    % \* B8 d% b: j8 \
  81. 0 d( s+ `7 ?4 i% j* v
  82. module_param(acnt, int, S_IRUGO);; v! \0 t1 r6 V# L
  83. module_param(bcnt, int, S_IRUGO);2 f, O8 g3 T1 X$ [! g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 k2 R, p3 a% ^) M+ U

. L& E7 U! U1 R. g6 F, x0 ~1 U! b0 Q' w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& K) G, \* W& p- ~( m. c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" p9 S. Z; u2 A* q& I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 u+ O+ [; a3 M+ D, O4 s, s

' c( l' B, _  K8 I6 ]# J) S
# \' q% g, }( U( g) F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 03:10 , Processed in 0.045256 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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