OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 x# W1 a, r* n) d
  1. [code]EDMA sample test application
    " n0 ^1 S  o1 `7 W, ?- U7 s2 s
  2. /*5 |/ R) \; c; R
  3. * edma_test.c0 `0 L% `' q0 U: L4 g' f3 @9 l/ d
  4. *
    8 L5 Q* f/ c' L% e
  5. * brief  EDMA3 Test Application- q. t9 Q( |: q. b) M
  6. *
    7 `' Q; Z) F2 q. R1 [: }
  7. *   This file contains EDMA3 Test code.
    0 b2 p% o  [/ G, _8 ?$ d7 G
  8. *
    * s! K- ]  @, G  \1 @& D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( C' \) d* Y7 u: `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 n' }  r7 s' X, |& ?2 ?; ~
  11. *         TO CHANGE.
    6 m5 h8 |$ q: L4 }/ |
  12. *9 y: Z/ B3 V$ {3 Z( x" [: c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 @8 [2 }& S5 r
  14. *" d1 T2 a3 Q0 \) }9 p
  15. * This program is free software; you can redistribute it and/or. C- d: }* p: B7 t
  16. * modify it under the terms of the GNU General Public License as. L6 p6 U$ K" r  l% E7 L
  17. * published by the Free Software Foundation version 2.4 e4 [# t0 X1 c
  18. *
    & m7 e, B8 ~* _  S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 w) S6 y6 k! q( l8 @
  20. * kind, whether express or implied; without even the implied warranty
    - P3 g: J2 T- {$ D/ P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, s1 N' V/ Y& L- w
  22. * GNU General Public License for more details.! n4 C# U% T1 \2 d! ~7 i. _7 N8 f: |  \
  23. *// I) t- e1 q" P4 o. N
  24. - ?# o) O' @. V- U! w" M. X
  25. #include <linux/module.h>& j4 S' [) N3 H4 ^& L
  26. #include <linux/init.h>
    : X) \! ?3 }8 ]8 v3 v, N# \# c3 G+ V
  27. #include <linux/errno.h>6 H: s2 |8 R; G. Y+ D4 C
  28. #include <linux/types.h>
    5 K# o2 g$ p& W( K1 A( N- |% T% p
  29. #include <linux/interrupt.h>& i' a. O' z2 K; o( Q) }& \
  30. #include <asm/io.h>
    2 G7 C9 k: ]& O: P8 ]
  31. #include <linux/moduleparam.h>
    * p- b- X+ O# W0 ^6 z! e
  32. #include <linux/sysctl.h># O" r  ^5 W  |/ E: H
  33. #include <linux/mm.h>
    6 M3 t, G, N6 k3 {- p# E2 }& E  c' G
  34. #include <linux/dma-mapping.h>1 F) t9 t2 n. N# d; k# C1 H3 v2 ^
  35. + V0 J) s% C) {# M3 ~/ ?9 ?7 q
  36. #include <mach/memory.h>7 G; s+ |: H7 r6 a$ H3 q
  37. #include <mach/hardware.h>
    3 ?& `& l4 n+ b' U" U
  38. #include <mach/irqs.h># l3 y4 E' B# M* @  Z, i3 b# L
  39. #include <asm/hardware/edma.h>9 F- E& ]& H8 F& \. W+ l, S- W' Z- T
  40. 8 d7 x9 U. W* F6 t
  41. #undef EDMA3_DEBUG0 T8 ?8 }. q; Z5 M% k
  42. /*#define EDMA3_DEBUG*/
    : O6 C) Z0 s: l. D* f# p/ [7 P

  43. / m; k- D( {- N0 B
  44. #ifdef EDMA3_DEBUG* I: Z6 J$ m/ T( e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 Q. T" C9 y5 n/ x% e4 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): N" C# |, N; Q: _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' X* O" T# F* ?- v
  48. #else( H0 q4 O- c, J
  49. #define DMA_PRINTK( x... )
    ( t- H+ T# ~$ P6 A
  50. #define DMA_FN_IN
    % A; v. p' U' h
  51. #define DMA_FN_OUT5 O; e+ R7 a2 g! C# _
  52. #endif5 B1 Z2 d7 h" Y  h; l% d$ m9 j

  53. , d( ~) x/ l4 W) f1 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      i$ [2 k, M, n" P6 }+ B
  55. #define STATIC_SHIFT                38 n) P5 _: a- `* m0 M
  56. #define TCINTEN_SHIFT               20& ~5 J- c5 i7 W7 ?6 P
  57. #define ITCINTEN_SHIFT              216 S/ i1 q/ C+ r. M7 a7 K
  58. #define TCCHEN_SHIFT                22+ X4 ?, d, [+ M1 a
  59. #define ITCCHEN_SHIFT               23  F) e* E! d* v9 _

  60. 8 g4 b% ?% |; o$ Q* U
  61. static volatile int irqraised1 = 0;- q& R3 }3 y- q1 ?; s# e, _! T9 K
  62. static volatile int irqraised2 = 0;
    6 U9 n0 [6 S6 _8 ^. O

  63. / W3 l9 f9 j8 ?! o  a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {7 H5 G, R. e6 v' S4 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m5 V- b, k* B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 W- ]9 d- `: E) `8 ~* h- K/ y

  67. 1 p) i; I6 {) p  R5 R
  68. dma_addr_t dmaphyssrc1 = 0;* n, }; G; a. E- S
  69. dma_addr_t dmaphyssrc2 = 0;6 n/ s6 S$ ~/ K4 Q
  70. dma_addr_t dmaphysdest1 = 0;
      \, a# F; k3 ]7 u# p- x( l' E
  71. dma_addr_t dmaphysdest2 = 0;& E, w  B" R  t! b) c

  72. 0 a3 h% t: D, N9 a
  73. char *dmabufsrc1 = NULL;/ c: r8 n1 j7 b% J# u
  74. char *dmabufsrc2 = NULL;
    8 a; C5 Z$ }1 Q+ \4 G7 _' K7 t
  75. char *dmabufdest1 = NULL;
    ' }5 i; G) J1 C1 ]* ^0 J+ f- u
  76. char *dmabufdest2 = NULL;
    * n( w2 w4 R2 V$ `

  77. 2 F0 b( c1 M$ z) V! @0 O
  78. static int acnt = 512;. a0 J, o  @3 F9 D; n7 j
  79. static int bcnt = 8;- e0 Q; |7 q9 ]2 }
  80. static int ccnt = 8;) G( t& {  d! Z: j+ `& @' q
  81. . C6 s' _& W, y
  82. module_param(acnt, int, S_IRUGO);
    ) O/ H  E# i' L! P. h
  83. module_param(bcnt, int, S_IRUGO);
    & Q1 E- V# R7 _& `  B2 A3 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( }6 s! D* J. I0 U+ G% T7 {# a
8 s6 V8 ^1 o( A. N7 g1 K+ B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ^4 B: F) ]$ {$ Z% u. Y  @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% Q/ ^: Q6 G4 o  ?& G6 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 F: I& `" p9 r
- i% a# q* h3 E# m; t
, q- K7 e, U, T1 h$ Q9 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 17:39 , Processed in 0.036645 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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