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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' ?1 X. Y; |  m- W# s6 [# \
  1. [code]EDMA sample test application" b+ R* j3 n6 f2 e1 V
  2. /*. A6 L; B7 m4 T' Q) V1 D% P
  3. * edma_test.c
    : s! `) N( b% S$ D$ t$ z$ q
  4. *5 h) }; w+ z' S, p& Z# ?
  5. * brief  EDMA3 Test Application, \- A. d' p% m! U4 h
  6. *
    + Q4 e' f/ W& t8 R/ j+ Y6 n3 D/ F
  7. *   This file contains EDMA3 Test code.
    . ~7 I# r' ~; p6 M* A; ^
  8. *8 s" k8 C: w, A! t1 h, [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + |' H* m) L$ R0 N$ \" l7 K2 f  y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & O8 ?1 Y* I' C* R8 k
  11. *         TO CHANGE.
      v: w+ c. H. H( k- Z* P- {, z
  12. *5 {2 Z5 |. q9 @6 S3 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( [$ V! A. O0 {7 r- D6 y' [
  14. *2 m9 Z% M  ?$ H0 W) x$ d
  15. * This program is free software; you can redistribute it and/or3 P- R. i+ \9 ]4 K. j* @
  16. * modify it under the terms of the GNU General Public License as
    : W1 }. o6 p, Y, X6 Q0 C
  17. * published by the Free Software Foundation version 2.
    " @, j) |- F/ ?3 u# o& j
  18. *# N3 h. ?; k6 Z9 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 a- W4 u( l! S
  20. * kind, whether express or implied; without even the implied warranty
    . r* S+ T2 k  x- B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 y/ z0 ?6 s& N
  22. * GNU General Public License for more details.
    ; j$ \, g6 `# F" H  a/ |# |/ k
  23. */+ G% h& P& p" k& Y( w/ a! R/ F
  24. # _$ r4 k+ \( K" G! B
  25. #include <linux/module.h>
    ; O, A( |& T- W  ^; J9 J5 ^; u( X
  26. #include <linux/init.h>  O5 {7 K7 W# Q
  27. #include <linux/errno.h>
    " I) c  Q4 ?/ L: c' z8 w( r
  28. #include <linux/types.h>
    / P# L' B! D' c  S) K3 e
  29. #include <linux/interrupt.h>
    6 g3 Y" t3 d$ X
  30. #include <asm/io.h>, {* c6 [& f4 p% N& h' k- c6 @4 T
  31. #include <linux/moduleparam.h>6 B! Z: w4 k2 J9 S' {& o% _
  32. #include <linux/sysctl.h>5 Y: m& t) o/ e0 X* ^' H
  33. #include <linux/mm.h>( O5 v; ]. f9 ?
  34. #include <linux/dma-mapping.h>3 Q1 z& V' J! T+ m. I

  35. 3 E0 p: A% ~3 Y' b
  36. #include <mach/memory.h>* c" M8 G( I& s" U  ]4 f1 d8 H
  37. #include <mach/hardware.h>
    " ~2 W5 T9 ~& l1 c) S1 J; b6 w
  38. #include <mach/irqs.h>0 ]- L. w% B" t; r; h  }3 R$ d
  39. #include <asm/hardware/edma.h>
    + A% v/ G+ B( g# S* [6 F
  40. + ^5 j5 [# C% {9 N/ }4 a) T
  41. #undef EDMA3_DEBUG. C# B  n4 p8 `
  42. /*#define EDMA3_DEBUG*/
    8 _6 ?' u: D1 y5 e8 O
  43. 6 O* @- q" \" l6 S$ T! m
  44. #ifdef EDMA3_DEBUG5 t$ J# S# T0 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % s) W/ o3 D3 k, o' @( ]1 ^  S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( {& h+ A/ t0 r. P' J# s1 f/ R1 V8 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( F- ]( n  f% Y+ ~
  48. #else
    9 R$ s' K' w6 `* n
  49. #define DMA_PRINTK( x... )) F0 z# l9 M( U- Z: Y- A
  50. #define DMA_FN_IN2 F! I( C6 o) M$ \8 a( s
  51. #define DMA_FN_OUT
    4 E" R) c- N3 K1 ?, C7 {( f
  52. #endif
    3 {) A% y) z, o

  53. ! L) ^7 s% i0 g! u2 h5 O6 o" m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 Z- i, [% E' r
  55. #define STATIC_SHIFT                30 |5 q7 ^; C2 K( i; ?+ S" x
  56. #define TCINTEN_SHIFT               20
    " e5 H! r2 v! n  u# w! J( J9 j
  57. #define ITCINTEN_SHIFT              21
    % r3 x  L! A0 Q2 H0 E7 L
  58. #define TCCHEN_SHIFT                224 g: Q) X: A  P& [/ O
  59. #define ITCCHEN_SHIFT               236 S7 b* f+ r4 g0 p
  60. * _8 w+ X/ W4 @% m0 C) l/ T( |
  61. static volatile int irqraised1 = 0;5 A  r* q; K8 K! c; i+ e* ~, X; p
  62. static volatile int irqraised2 = 0;/ R- N0 k! F0 V
  63. 1 {% h8 J8 v, a. A4 ]1 r6 w  L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % g. ~% p' G+ \9 |6 i* e4 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D% V$ l( e1 V2 R# m$ E: T+ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; t3 k( p, x$ }( S7 @! q" ^0 U

  67. & |& f; w; n- m# w5 D, B2 K( |5 Q  K
  68. dma_addr_t dmaphyssrc1 = 0;( K7 p$ _& q1 _/ y' \5 w) R/ v" l6 }
  69. dma_addr_t dmaphyssrc2 = 0;
    " ?4 D3 S6 L  r6 J2 ~' H/ y
  70. dma_addr_t dmaphysdest1 = 0;
      [; ]% y# e8 N/ m( M, r
  71. dma_addr_t dmaphysdest2 = 0;/ m. v9 k8 r& Z3 p) w# h6 o7 y" S- |

  72. : ~& ^4 N' U% J1 L& T
  73. char *dmabufsrc1 = NULL;3 {- H) ]; F, m4 u: u/ Q
  74. char *dmabufsrc2 = NULL;) e+ K2 O' H6 x
  75. char *dmabufdest1 = NULL;9 ?6 y4 m) |0 D4 T9 t$ J; G
  76. char *dmabufdest2 = NULL;
    : B: }- j! _5 c) a+ b& ^

  77. : l: @0 |1 U, J, R5 Q
  78. static int acnt = 512;
    ! r4 C7 A5 Z# l4 h, o
  79. static int bcnt = 8;
    " Z4 F* n  I$ v( [. Z
  80. static int ccnt = 8;% m( s' F& c  F  }, |" O9 n' i! _

  81. . K' x* \5 ]) g# }
  82. module_param(acnt, int, S_IRUGO);' n$ B- i) j! Q: g2 e+ a/ E* V1 E$ h
  83. module_param(bcnt, int, S_IRUGO);( L0 }" i/ L# ]5 r3 K6 N: w8 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 c0 E, ?$ L' \+ B  {' j
4 K- J! t4 u3 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- N  q! L( K/ n0 P: E. Z! d4 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) O  S5 M1 r- i% V, A, z( y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, w+ ?5 d) k9 @  A0 |
, s* U8 E1 I+ B0 A; O& b. C% T, d+ s4 Z6 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 12:31 , Processed in 0.038699 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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