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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# I  [6 f1 {) n- P8 ?
  1. [code]EDMA sample test application
    0 d2 C1 C- I- x4 o5 _
  2. /*8 L' ~7 R! r* v) m
  3. * edma_test.c+ }) q3 X8 n& X0 d5 n/ M
  4. *$ P7 ]+ ~  j/ C
  5. * brief  EDMA3 Test Application, E! c. E- U. o3 \% n
  6. *
    / v) B/ x' o$ A- C3 M/ K$ d
  7. *   This file contains EDMA3 Test code.9 P* ]4 ^/ j5 p/ y* m9 j
  8. *
    4 {- f) ?  ^) x$ i( t5 W/ f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      X& L3 O. N+ a- i  L  U% l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . i# h4 m3 x+ c  E4 ]) j8 s
  11. *         TO CHANGE.
    8 |* s% \( J: B! s
  12. *
    # S: B. A! P' r0 O8 o9 d1 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: y2 a5 X8 h) o9 b, o; r( R
  14. *" {% v6 V3 r" }
  15. * This program is free software; you can redistribute it and/or+ o/ j5 q8 C, W
  16. * modify it under the terms of the GNU General Public License as1 h% r& l! i6 g) o* h- C4 z) v
  17. * published by the Free Software Foundation version 2.7 ?6 n5 B, f+ |
  18. *1 n6 f8 k/ u3 i% Q! j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ^- z/ R& x( ^2 g8 h" T% R
  20. * kind, whether express or implied; without even the implied warranty7 b, o$ N; u+ l5 y- a1 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: g% [$ j( J0 E
  22. * GNU General Public License for more details.
    ( V* a* P5 K1 b" r
  23. */
    , Z. @+ J( Q( a5 k' M1 o2 H

  24. 9 p0 ^$ e! V' K" u( F+ Q( K
  25. #include <linux/module.h>
    2 i! _$ b3 v: G" R/ M
  26. #include <linux/init.h>, N1 z% L2 {$ k/ x5 E; J5 C9 x
  27. #include <linux/errno.h>9 `2 D( Q3 D. P- U; k
  28. #include <linux/types.h>/ c9 S0 N) g* M& X) ]( `5 g
  29. #include <linux/interrupt.h>7 h: G( m6 M, X% a9 a& W1 E
  30. #include <asm/io.h>
    0 c  J8 q5 I) u& i& n' c' j: [7 t" K
  31. #include <linux/moduleparam.h>* P  L+ Q5 L% O
  32. #include <linux/sysctl.h>
    # E; n" X$ {! q: V9 W4 I0 ~
  33. #include <linux/mm.h>
    1 ]* a& w  Y$ o& r, @$ l$ f
  34. #include <linux/dma-mapping.h>7 U& Y/ s8 ^' s( K  J5 g
  35. ' y6 W2 S2 Q* K& o( g
  36. #include <mach/memory.h>% y1 F  e) ~) P1 ~3 V0 R
  37. #include <mach/hardware.h>
    . h; J& g8 g) n; `9 S
  38. #include <mach/irqs.h>. i0 B* j4 G( l2 I8 i
  39. #include <asm/hardware/edma.h>
    . I( ]0 S0 {% `" o' w3 H# X
  40. & q# \& v7 M) Q) e
  41. #undef EDMA3_DEBUG, l* g; B% P8 |. X
  42. /*#define EDMA3_DEBUG*/
    0 x/ A4 C+ H7 h

  43. ) n: l, ^  s# B8 E
  44. #ifdef EDMA3_DEBUG
    1 Q2 H& `% \" Q4 Y! ]5 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 G! N+ y0 i$ J( v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~; P) H1 [5 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , c1 z1 l3 J5 _5 I2 h, E: g
  48. #else
    1 K0 D0 v0 U, F$ G  e  d
  49. #define DMA_PRINTK( x... )- G; e8 C9 B1 u! u) U
  50. #define DMA_FN_IN
    $ |/ `1 g2 q  I
  51. #define DMA_FN_OUT$ C% F+ t0 q/ P
  52. #endif8 K6 x8 w4 g- i- i; f

  53. ) ?! \' I4 k& _+ S3 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! L9 f# d8 b* H+ _3 x
  55. #define STATIC_SHIFT                3( l& Y8 ?  n9 S
  56. #define TCINTEN_SHIFT               20; v# K, _8 U7 y% y% v# r
  57. #define ITCINTEN_SHIFT              21
    ; ]) n; ]2 @* ]' t; I
  58. #define TCCHEN_SHIFT                22
    $ F8 {) D. e2 f. F
  59. #define ITCCHEN_SHIFT               23
    - ^6 q# F# H' Y: d, c% l( ]

  60. ' @" h# Q5 Q! c6 \
  61. static volatile int irqraised1 = 0;" C2 I  C7 J1 `$ t; O
  62. static volatile int irqraised2 = 0;
    & Z# {9 `1 t0 r  Z: `

  63.   m1 X/ C4 ?, f7 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M4 K) o3 t" n" I9 i: L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ M( p% Z3 V' x/ G. J8 P9 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # v! N. F  A0 ~! X+ e

  67.   ^: A2 ~) P6 J# k3 n: \
  68. dma_addr_t dmaphyssrc1 = 0;) e4 B& a  V, _6 P( f
  69. dma_addr_t dmaphyssrc2 = 0;
    * o; Z. B7 _5 f9 [  G" f/ H
  70. dma_addr_t dmaphysdest1 = 0;
    ; Q1 X& O1 T' |
  71. dma_addr_t dmaphysdest2 = 0;1 e" e  F# Z; O' G5 i$ `/ K
  72. 5 Y2 J' {& H+ J7 t* Q* d# z
  73. char *dmabufsrc1 = NULL;8 `9 [7 u( u4 Y: E$ \  U
  74. char *dmabufsrc2 = NULL;. L, E" m3 O; _8 U3 u
  75. char *dmabufdest1 = NULL;9 a0 t3 N+ u6 g# M0 S
  76. char *dmabufdest2 = NULL;
    % _; p& o/ V+ R5 r" O4 Q
  77. + h4 _: @5 N  r  Y
  78. static int acnt = 512;
    " s0 r* b; D, \. u; w4 C1 C
  79. static int bcnt = 8;
    + {$ {2 m+ N) @9 e. X
  80. static int ccnt = 8;2 F2 b, A9 t2 ~# i9 |) J! E
  81. ! X. _7 A3 r) }" F1 s
  82. module_param(acnt, int, S_IRUGO);
    3 F' T! C+ ?' @" R1 I# A& a6 E& b( y
  83. module_param(bcnt, int, S_IRUGO);  k  ]  f" ~( X  R( ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 ^8 {: Y. _4 M9 \# s$ x( C: \( d* {5 o8 r; Y9 [: I2 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! T; h6 o; H: Q# \# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ t# t" m, g: X+ v; B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ O( k9 `2 G7 y' i% ?9 y4 o0 \1 u
* C; x3 y3 z7 [6 c! r
# }" ?) y" \' f) X  O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 07:34 , Processed in 0.039660 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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