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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) y8 f7 L6 L! ~
  1. [code]EDMA sample test application$ H2 f! N$ o: e4 ]; Y
  2. /*% C8 e% j, N1 Z' }9 g
  3. * edma_test.c% K" F- p1 f/ }* a0 j
  4. *
    / n6 y0 d5 z0 z
  5. * brief  EDMA3 Test Application
    : @5 R) c6 s- S! A1 T5 Y
  6. *
    7 T3 c0 Y6 u6 F! B
  7. *   This file contains EDMA3 Test code.
    5 e( w' Z! f9 J2 Z6 u) s/ R& ]
  8. *
    1 U# }- ~) J+ `& z! e4 @9 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . F5 s- B# V$ M& i% c4 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 X, M& A, q. p  L+ e# L6 w% }
  11. *         TO CHANGE.# N/ @5 b4 r( b1 z3 m
  12. *
    & g6 L  {  ^3 O+ a' `6 @. U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  L5 S8 D/ P# K* _
  14. *
    ( C5 d- g7 S0 d% y3 _
  15. * This program is free software; you can redistribute it and/or
    # d% P. ?& M% w; }  M( e* G- Z
  16. * modify it under the terms of the GNU General Public License as
    4 S3 y- L6 z% L; r+ [$ M% i# [
  17. * published by the Free Software Foundation version 2.
    9 l" T# p" l3 `0 o
  18. *5 i5 A5 }) Y$ \) L4 v$ \( o& d) q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & x- W, T! |& V
  20. * kind, whether express or implied; without even the implied warranty
    8 ?. A, J) w! y' ~* s# w- p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ U' l& J" G) T7 o4 Z6 |6 A" g% U# ]
  22. * GNU General Public License for more details.3 ]5 E7 c4 T, W. L
  23. *// @! J9 P) L8 |9 V3 O9 ]( ?

  24. " {4 i3 o1 K) L; M) X5 A& V
  25. #include <linux/module.h>% A" x+ W* V- D- m' b4 v* c% a
  26. #include <linux/init.h>
    7 t- X% y9 d) ^) }1 a( ~' M
  27. #include <linux/errno.h>
    / A5 E" O3 r3 q4 |) h* t
  28. #include <linux/types.h>
    ( [$ [, t; \5 b( W6 T# [  Y0 s+ j
  29. #include <linux/interrupt.h>0 B5 h( f/ \0 a6 n; w9 M( X; R7 r' d
  30. #include <asm/io.h>
    6 I# L% a: e+ W& y' J* L
  31. #include <linux/moduleparam.h>
    9 t1 F! j8 p. C  {% I0 ^. z
  32. #include <linux/sysctl.h>
    & i# p% o; h; e" J
  33. #include <linux/mm.h>
    ( U. l3 m6 W/ H9 R
  34. #include <linux/dma-mapping.h>4 i! x: H4 m, K- o
  35. 7 I; v# L' v3 T7 L# @3 t% O! {
  36. #include <mach/memory.h>
    ' m2 p0 Y& ~( j* `4 Y  L8 ]1 s
  37. #include <mach/hardware.h>
    1 I# U* W) v5 V' ?  r) K  J. k4 e
  38. #include <mach/irqs.h>
    * o- D, l, _& j- s$ V. [2 l
  39. #include <asm/hardware/edma.h>! P& P6 I3 C# {4 p! G0 |$ y( {
  40. # {: A2 t, u) v  t# F
  41. #undef EDMA3_DEBUG
    / E, ~* c1 j6 k7 ]( P9 C
  42. /*#define EDMA3_DEBUG*/* I2 j; G0 O" ^

  43. ( J, p3 g6 h) l' w
  44. #ifdef EDMA3_DEBUG2 G) U0 G3 h, w, o+ u! C; D  ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 X* m; i1 g2 ~1 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! `- c+ r. C& ?. V" p9 n6 Y  P7 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 [# A) C' a+ w  l
  48. #else
    : l; i, b8 w/ c& e- R
  49. #define DMA_PRINTK( x... )
    * w8 ^5 |7 d- a1 w: t
  50. #define DMA_FN_IN" Y# V2 J' t& |& x0 O8 N
  51. #define DMA_FN_OUT7 f7 m; R4 t2 |7 l7 L5 T# n- a" n7 Y
  52. #endif
    # |$ F6 d5 W! _. d3 t& }

  53. ' a/ P2 n# g3 d3 [' H+ d1 F/ k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # \2 J% {' Z- s& [. P, K
  55. #define STATIC_SHIFT                3
    ! J+ A) ^. L# z  A' B
  56. #define TCINTEN_SHIFT               20
    & \1 K' x4 K$ L5 L" m
  57. #define ITCINTEN_SHIFT              21
    * v, Z6 m  ?, @' L' Q- d
  58. #define TCCHEN_SHIFT                22
    8 k  f7 z) p1 v& A
  59. #define ITCCHEN_SHIFT               23
    / e) {$ b9 I" O  K
  60. & d$ e) H" I# ?' H0 d
  61. static volatile int irqraised1 = 0;* T8 T7 N; S. {8 \$ l* M: P2 [
  62. static volatile int irqraised2 = 0;
    ' z4 ^' w( B0 K+ T

  63. " j" s6 @2 {. x3 r3 g- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' j7 h& q7 a7 N: c# t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 d+ k- u$ y7 U; `/ q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H5 O& Y2 P" P/ ]/ e& S1 j

  67. 0 V* C4 \6 a4 m5 l" ?" H) x0 T
  68. dma_addr_t dmaphyssrc1 = 0;
    ) k! m# O% o0 w' ?
  69. dma_addr_t dmaphyssrc2 = 0;
    , T5 c3 n9 m3 P3 _
  70. dma_addr_t dmaphysdest1 = 0;0 u+ K- R0 f4 c: b4 @0 B
  71. dma_addr_t dmaphysdest2 = 0;
    + c. T; ~  B, Q
  72. ' o$ S- \) v) y, Q  \7 Z, N
  73. char *dmabufsrc1 = NULL;
    3 M. x: _! D' t/ f) j5 [" z( }
  74. char *dmabufsrc2 = NULL;6 V2 V6 F; A2 E+ H1 ?# Z6 R& j; z
  75. char *dmabufdest1 = NULL;6 b; f+ t+ n+ L" L5 F
  76. char *dmabufdest2 = NULL;/ }' J0 ^& G3 Z; M$ N9 J7 g

  77. - m8 \6 d8 F) I1 }* B. {* H- |
  78. static int acnt = 512;. L. e- u# o% ^4 k( v# v9 {$ x- I% C
  79. static int bcnt = 8;
    ( A+ z  Z% t" L9 h1 P1 Q5 |
  80. static int ccnt = 8;/ q9 ~) H4 L; Q3 _2 v+ P1 U$ z5 L
  81. - k; _9 t' U" o4 S+ r+ W. l, F
  82. module_param(acnt, int, S_IRUGO);3 E3 h, p: T6 K. g
  83. module_param(bcnt, int, S_IRUGO);* i5 ^) b5 F+ X5 c" u! R( r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; l4 g+ v+ [/ N+ d
% |# ?& H% o4 H( c) e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 {5 W2 s. e0 D8 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ~; A8 s9 F8 B7 b) d" ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* M/ `  A8 l- I6 P1 N
. D) B7 a* d+ _
; s0 A, O3 a% f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 10:36 , Processed in 0.047595 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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