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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' \9 J  k  U. F; [
  1. [code]EDMA sample test application; P, r$ M3 N+ L3 b+ [# u% W, @
  2. /*4 F+ |) F$ Y: P. c3 |, H
  3. * edma_test.c
    + \1 l1 _5 ?+ \2 a* M
  4. *3 y& e$ v8 D4 j5 W
  5. * brief  EDMA3 Test Application
    4 E; k6 k; ?. Q, [0 ?
  6. *" l% ]$ ~$ z- J- U4 l
  7. *   This file contains EDMA3 Test code.
    , b" i8 _9 o4 h# a
  8. *
    8 g; O& q2 {& q: ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& H4 k0 b* g1 `% j2 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - T$ H$ `( u3 A! A
  11. *         TO CHANGE.
    ! s/ s& s; n4 F- k$ v
  12. ** x6 U% r% M; {4 `" X8 x1 Z) n6 E* p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; F) R% _* O' P0 S
  14. *4 {2 c$ l7 _6 q. \2 s! x
  15. * This program is free software; you can redistribute it and/or
    4 X9 A' p2 E7 u7 k3 M% C
  16. * modify it under the terms of the GNU General Public License as4 a6 k, [: p# z; z: H
  17. * published by the Free Software Foundation version 2.
    3 ~5 ^. C& f2 Y4 i
  18. *
    ; ]% I, U) L# U; `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" f2 m# t: \( P$ e3 {# b; _
  20. * kind, whether express or implied; without even the implied warranty$ [& D' m6 _6 l) O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * L# M* S0 ?4 }/ J( X
  22. * GNU General Public License for more details.
    # x# y0 p/ f0 X) Y
  23. */
    8 r* c% O3 ?5 F. Z: g* R6 o9 E
  24. & |( i7 V1 r! ?2 x7 r! c2 g, p
  25. #include <linux/module.h>+ N6 Y$ ]1 C8 m* V, X
  26. #include <linux/init.h>
    4 F. H1 v1 {6 d( f6 D
  27. #include <linux/errno.h>
    % j/ W- T# f4 k7 g; B
  28. #include <linux/types.h>% ?) W7 i5 Y9 Q* ^7 K) \$ S4 j
  29. #include <linux/interrupt.h>
    9 w9 @9 W( ]( ?$ {4 K- h2 g& W' q
  30. #include <asm/io.h>
    ' J* w) U% x) N7 j9 a8 `& e
  31. #include <linux/moduleparam.h>6 R" L7 [6 u& E: f6 c
  32. #include <linux/sysctl.h>
      p" k  j2 [$ N6 R
  33. #include <linux/mm.h>. }8 i$ o% W1 \2 d0 S
  34. #include <linux/dma-mapping.h>- H: H. P. y1 H6 Q$ B8 N7 y
  35. & ?  j  R+ C$ c, `
  36. #include <mach/memory.h>7 }# F0 K; q. p& I$ H
  37. #include <mach/hardware.h>: @. W5 \( J4 {/ C# P8 q, d
  38. #include <mach/irqs.h>1 y4 j9 G# s% X& B0 H- T0 c
  39. #include <asm/hardware/edma.h>
    " x& ?9 G1 K( g( {/ y4 e. G

  40. $ q7 Y8 i! y/ Z6 f9 f
  41. #undef EDMA3_DEBUG! Z+ e$ H* J& D! |8 i+ R
  42. /*#define EDMA3_DEBUG*/
    ' Z" `$ |- ?, r

  43. 7 |) T4 v! A, p+ i4 m+ k
  44. #ifdef EDMA3_DEBUG
    + Q9 j' D$ H* y2 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) F4 g. J- Y" Z/ W4 ^- E. l2 X0 W& L7 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      Y" T8 s5 f: c% E5 W  i- g. {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! s! ^: A9 ^1 s# }- h! a  \! }! ]. K
  48. #else1 G3 A' r( W7 B2 u! z
  49. #define DMA_PRINTK( x... )
    & P6 h5 Z( l3 J
  50. #define DMA_FN_IN
    9 n: d) ~! s, a$ |5 Y
  51. #define DMA_FN_OUT
    ! T; h- w' Z& G  A$ w
  52. #endif5 k% B4 x. J. t! r" Z& i
  53. ; Q5 Z/ C9 C. ^( P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 `- i' c+ b0 [+ H- X
  55. #define STATIC_SHIFT                3
    ! @* y8 [9 u5 g' M" j
  56. #define TCINTEN_SHIFT               20
    3 B- h# G0 ]5 H' J: F
  57. #define ITCINTEN_SHIFT              212 o3 k" G& K7 I* V& ~5 l. e
  58. #define TCCHEN_SHIFT                22: t' z0 f3 j* Q9 `
  59. #define ITCCHEN_SHIFT               23
    : I& {8 x* _* r+ ^* n
  60. 5 G( S) W/ r6 c: e2 N+ K
  61. static volatile int irqraised1 = 0;
    , G' X+ j1 q: U$ C2 q7 ]% ]
  62. static volatile int irqraised2 = 0;
    * ^# w! K5 v# t
  63. & E* g6 J3 O$ L/ x# `0 w2 x4 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 a. ^  _3 k# h* b+ V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M! C, }0 ]; t6 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " |' \  X0 f9 X! \% J

  67. # Q8 X" I$ C3 i- \; C
  68. dma_addr_t dmaphyssrc1 = 0;
    6 Q) ~/ @9 o) y, z) B: A9 z$ e
  69. dma_addr_t dmaphyssrc2 = 0;  p7 H& e- T' _' Y  c" n
  70. dma_addr_t dmaphysdest1 = 0;
    6 b. r7 t2 V3 b! p; I
  71. dma_addr_t dmaphysdest2 = 0;6 {3 v7 n: d4 ~( }) l

  72. ! I  x3 u0 T' s9 Y5 w4 s
  73. char *dmabufsrc1 = NULL;3 J$ ]" H( D; C; g3 N/ d* M
  74. char *dmabufsrc2 = NULL;* `" {- F4 J2 z# U% [) A
  75. char *dmabufdest1 = NULL;
    1 y2 Z8 I: J# m7 q# M
  76. char *dmabufdest2 = NULL;7 Q/ }* [; @  @* S) Q1 i$ p

  77. ) M; H" E3 R& f8 p: [, z6 [
  78. static int acnt = 512;
    ) ^2 {) e& T! d. I# p" `
  79. static int bcnt = 8;
      p6 z/ p& W+ L1 c  j0 r/ K
  80. static int ccnt = 8;
    5 C& n2 v" ~, c2 S9 P; A
  81. : b! A% Y0 G1 ~( ^, b/ r1 X& V
  82. module_param(acnt, int, S_IRUGO);. ^2 E4 B( z! l3 u
  83. module_param(bcnt, int, S_IRUGO);% k1 D# a6 [+ u3 A" x5 F# p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: Z$ {. L" E$ W& y" G  S- T
  G$ X  I' n, @0 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% s: }2 A  L! g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 l" I' C2 b. J6 z  |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# J1 E8 G9 m7 n+ W) H' [
' w) [9 H" J, Q& ?) A" ~$ G
4 W7 |; x3 [) o& [) _3 J& e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 11:44 , Processed in 0.041029 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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