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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 x$ i9 s+ u. F- Z
  1. [code]EDMA sample test application! u% F* r  L8 r
  2. /*& M% w/ C, ^) G- O9 R  S9 D, J) o
  3. * edma_test.c; L* y% Q" l4 T$ U; }3 G
  4. *
    ; x* I8 g" ]7 v: H$ V0 |
  5. * brief  EDMA3 Test Application0 k4 D- `3 S  ~0 r% ~8 ^! m- V' k
  6. *7 `& y5 w% @: x5 C' W3 o& s
  7. *   This file contains EDMA3 Test code.3 h" ~% L' f5 G) _% g7 T
  8. *
    , c! w5 l7 Y* h# T1 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 w& Y+ _' O" @5 H- |0 m6 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 n2 B1 ~% h4 w- s; Y2 l1 [2 k6 [
  11. *         TO CHANGE.$ R- W8 P0 M0 o8 t6 A; a
  12. *
    . Z) `4 D- m! k1 J$ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . B5 N( t9 E) _* j$ |- k5 r
  14. *- q2 u% R" K8 U& K
  15. * This program is free software; you can redistribute it and/or
    - Z; f3 R+ \; G3 m" Y' I4 j' J
  16. * modify it under the terms of the GNU General Public License as; u% `4 R7 k# G* K8 E  Z+ b8 q
  17. * published by the Free Software Foundation version 2.
    8 a& E7 z6 t, j  y; X: }
  18. *. I' k; k4 V* s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' @" \9 J' a8 u% U- N+ G3 a
  20. * kind, whether express or implied; without even the implied warranty
    & q- |, E  ~: @" \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% A  t4 T' _& I( O$ K* E% c
  22. * GNU General Public License for more details.
    0 V& D1 u0 _% X' X7 a2 E) ?# ~
  23. */
    0 J6 n1 n, V$ K( t" a
  24. , C6 z  r+ y& ]6 p3 H$ M
  25. #include <linux/module.h>
    $ c  b3 x' H: @: {3 T4 N) m
  26. #include <linux/init.h>
    3 S' w3 P2 D5 D3 p( ~
  27. #include <linux/errno.h>, i/ W' ^# r6 A' u: G
  28. #include <linux/types.h>
    - w2 f# d1 C" B7 k  _) d
  29. #include <linux/interrupt.h>  B* a1 P$ A3 G
  30. #include <asm/io.h>
    ! g7 i3 ^% T' G' i% Z; [( I: g* q
  31. #include <linux/moduleparam.h>
      @- \: e: n& m$ W7 u. S! l
  32. #include <linux/sysctl.h>
    ! d( H- D- K1 P% j
  33. #include <linux/mm.h>
    & U1 k% r+ F. x# J7 l. e$ O
  34. #include <linux/dma-mapping.h>
    ; V: c3 R7 m% O2 ]4 S# w; _

  35. + j4 R9 W% R' B9 K
  36. #include <mach/memory.h>
    6 L, O# p7 A1 T0 s+ S
  37. #include <mach/hardware.h>% V4 U* ?% \8 X, h. ]: z! u
  38. #include <mach/irqs.h>
    5 s1 [+ y, T, T6 \2 P0 |7 u
  39. #include <asm/hardware/edma.h>
    8 E/ b, e! ^; g

  40. ' B; m% W! n( Y/ `$ m; t
  41. #undef EDMA3_DEBUG2 Q/ H4 @; w/ I; m6 G2 d- I
  42. /*#define EDMA3_DEBUG*/
    ! h! y+ i; M( W' U
  43. - ^$ B: B( X) o6 E6 h2 z
  44. #ifdef EDMA3_DEBUG3 l% o( \/ ]8 G$ B4 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 P3 x6 n/ U5 U& h  \; j' \) W) `# _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% u  |8 U  u9 s. w/ p* f; O: `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 N" B" ]- l; M2 n: x& @
  48. #else
    6 B; O' t5 t; a0 R
  49. #define DMA_PRINTK( x... )
      V2 r. A: G( o; x% Q" }( k
  50. #define DMA_FN_IN+ H9 J* d$ u; l# C; w( n
  51. #define DMA_FN_OUT
    - e# \) H/ d) c$ K' Y
  52. #endif! V  z8 ^/ J- X4 U+ E

  53. 8 S2 Y; C9 h8 A: I0 `4 Y1 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      q2 A: z6 o' F1 S: Z# F, [# A- V, `
  55. #define STATIC_SHIFT                32 s7 I* n3 ?9 I/ L" h4 J( h% U
  56. #define TCINTEN_SHIFT               20
    ' b" T- \+ v, L- f5 r; }, C
  57. #define ITCINTEN_SHIFT              21; W* [! x) \& H' X0 e
  58. #define TCCHEN_SHIFT                22
    5 }5 H( _* l% c" f2 v$ t
  59. #define ITCCHEN_SHIFT               235 f4 R* F0 a( s; z( ^$ d; w# {

  60. & h2 I7 P( y5 f3 v3 ~% {  p
  61. static volatile int irqraised1 = 0;. u. g2 W0 I8 O; j" O" Z" R
  62. static volatile int irqraised2 = 0;
    ; U8 b+ l7 R6 q% f8 }

  63. * }! Z! y2 o+ B5 Y7 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 r9 K9 b6 R7 D/ [' H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ B- c, B. d  O% U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M* J. q  d- _* n* Z
  67. 8 [6 q7 l/ T* ]; Y
  68. dma_addr_t dmaphyssrc1 = 0;3 T+ F7 L3 g9 E# }" k( R
  69. dma_addr_t dmaphyssrc2 = 0;
    , C' q: n- a0 Q6 D: n) H1 M
  70. dma_addr_t dmaphysdest1 = 0;
    / o: l4 L" z$ k& q1 y1 U! _
  71. dma_addr_t dmaphysdest2 = 0;& L) x) G7 K7 R5 g$ p
  72. # r% K2 v) d& ^9 q5 n1 u
  73. char *dmabufsrc1 = NULL;. ^# ^& @; F# c% O, Z( w
  74. char *dmabufsrc2 = NULL;
    3 U  a. W% `' x) G
  75. char *dmabufdest1 = NULL;
    5 Z6 G: _! P6 m5 @7 m
  76. char *dmabufdest2 = NULL;
    # L. U7 L! ~/ P4 \

  77. - Q$ H  @5 Q4 V5 A# r0 z
  78. static int acnt = 512;0 Y) W( ]5 G1 Z4 n
  79. static int bcnt = 8;! B& a. J& Q6 {& R3 Z- ~
  80. static int ccnt = 8;6 [; W3 k" K6 ~0 v  W, X) f$ n: |
  81. ( B, q2 G4 @4 U1 }, Y
  82. module_param(acnt, int, S_IRUGO);
    0 a" z) C( z. c) M1 D
  83. module_param(bcnt, int, S_IRUGO);) |& f( E- ?+ F- N: Z( H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  x' G# ~. D; W* a' \
, Y/ o) c. {9 d% U9 }$ w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Y9 E# @$ b' u0 P9 G( R$ |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 F3 Q9 H8 m# }+ ^4 s# }! L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ t( `: X2 t5 _" o2 ~1 q5 U" ~% J! U

* }5 ]: A% y$ G6 w/ u4 C3 `: j! T7 b( K$ W- U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 15:59 , Processed in 0.040025 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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