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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  ]$ y+ s. I$ p; g- H' R/ h
  1. [code]EDMA sample test application
    : L. e+ E4 [% M7 w7 U: R0 h  n: f/ K
  2. /*
    5 [* b" z) j) U6 M
  3. * edma_test.c
    - o  u9 W% O/ p2 t8 n' E
  4. *
    + o+ o3 V6 U+ V! O! F6 E
  5. * brief  EDMA3 Test Application
    % l: P9 s) a0 `  e( W9 q. L: a
  6. *. N# ?# y4 c- ?- r6 S
  7. *   This file contains EDMA3 Test code.
    ( V* j2 I- i3 g8 _& \( h8 F
  8. *8 T0 x" C5 X2 o* \( @( ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + r( \" `3 _- ]; ]% r5 w1 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - _3 f  @1 I% {. F$ V: X
  11. *         TO CHANGE.
    , z# a/ X9 n* A! V. {
  12. *
    $ o: ?8 B1 A0 [' L6 l+ }, Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n, t, c' P0 Y9 `3 b& v
  14. *3 ^- [' y# }& T- @0 z
  15. * This program is free software; you can redistribute it and/or
    6 ?/ T. I' f. E5 J8 {, }& F
  16. * modify it under the terms of the GNU General Public License as
    9 X% B2 s2 M2 u) B- h6 u
  17. * published by the Free Software Foundation version 2.
    ! _" x; J9 O: N( }1 ]3 N- O, }
  18. *
    ! v+ m( t' u/ Y& \0 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 {- G: u/ Q9 V' c) N
  20. * kind, whether express or implied; without even the implied warranty
    9 p7 I3 R3 M! {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : }9 B+ E. u' h4 O  w9 M; F, k
  22. * GNU General Public License for more details.
    ! Z1 N( A/ _- [0 L" p4 y, o
  23. */
    . R, w, b' ^* q+ q0 c6 W( F

  24. / ?4 a5 K' |2 ]6 ^$ ]$ k/ f
  25. #include <linux/module.h>
    1 s- E! L. G; E/ i8 `6 }' E
  26. #include <linux/init.h>
    7 v) z7 U, p' c3 i( ~
  27. #include <linux/errno.h>+ c8 c9 a. o' W  b
  28. #include <linux/types.h>
    # y3 {! }5 p" _, _2 V; d% P0 r
  29. #include <linux/interrupt.h>
      v0 t2 p* \4 C; I
  30. #include <asm/io.h>
    ) u8 N% j$ O) S8 Y8 B& q& H  K9 T
  31. #include <linux/moduleparam.h>
    ! v$ ~& r" ^/ N& n" a1 F8 _2 i$ f
  32. #include <linux/sysctl.h>
      p  b# z' q( ^# e; w
  33. #include <linux/mm.h>' m# S  R" Q. a% r
  34. #include <linux/dma-mapping.h>* _# S' Y- Y# H4 C
  35. 8 v) }6 W3 Q# @5 W% x, c- }
  36. #include <mach/memory.h>
    2 y/ \: i4 |9 c! x1 O8 x
  37. #include <mach/hardware.h>
    4 d4 t+ g9 H5 I# e7 Z9 Z/ v5 @
  38. #include <mach/irqs.h>
    5 R- E" ~9 m: e8 n( M" }
  39. #include <asm/hardware/edma.h>
    ; @7 o4 g. g8 e8 O* f' D( r, t
  40. " K3 G; \7 S, _9 @0 X; N! C
  41. #undef EDMA3_DEBUG# d3 g' d  j! S( X4 _7 a) n
  42. /*#define EDMA3_DEBUG*/
      `$ [$ R3 T8 a$ [; r

  43. # h, v4 s3 o& D% }  O
  44. #ifdef EDMA3_DEBUG
    ( N! Z4 G$ i# I- D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 Z4 B. B# q' f% S! b" B3 A( E+ y) K+ L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ~. Y9 O& e# }" P* `$ M: H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 z# |+ }- B* g5 _- _8 A/ H
  48. #else, Q7 N) E8 w) r$ V
  49. #define DMA_PRINTK( x... )) ~" p) A5 Q' v8 w5 U
  50. #define DMA_FN_IN
    + \6 \3 o" y' q0 ~) @/ {. o( R0 Y
  51. #define DMA_FN_OUT
    ( l( k% S4 c8 |$ p) q$ o
  52. #endif  o! d7 Q! J$ @$ q! v

  53. 9 i: j9 R! ~3 o$ c# b* j1 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) z# N7 @! y* X/ d% ?$ s/ e
  55. #define STATIC_SHIFT                3- [. D3 }/ N4 w9 _: q( W) G8 n/ |  |
  56. #define TCINTEN_SHIFT               20
    ( ^8 v3 c- O! C) o2 A. F' M8 K( t
  57. #define ITCINTEN_SHIFT              21' Z( m' O9 z# G* H/ S) @/ Z8 w
  58. #define TCCHEN_SHIFT                22/ x+ s( |% H/ H9 @
  59. #define ITCCHEN_SHIFT               23( p2 z9 n/ _; Z7 G$ H

  60. 8 O( D* F& a) f. g1 w" ?
  61. static volatile int irqraised1 = 0;, J, J7 U4 B+ }4 _
  62. static volatile int irqraised2 = 0;
    # T( J+ X9 w, W- s

  63. 5 ?! M: D7 T3 I  g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ B' R/ q3 Z0 J% D% X+ P, @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k, O! S7 s1 M$ x: |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }8 f& Y3 ?0 y) {1 o& P( C

  67. ( ]# l) \# l7 O" P5 P
  68. dma_addr_t dmaphyssrc1 = 0;
    : t$ T! _( @, C9 b( T  l7 }6 @
  69. dma_addr_t dmaphyssrc2 = 0;
    3 C' l* @& K5 ?+ I
  70. dma_addr_t dmaphysdest1 = 0;
    , `1 o6 j3 ?0 C" k
  71. dma_addr_t dmaphysdest2 = 0;& D# w7 T6 D& P0 K# n4 I, _
  72. 3 m) b+ w7 c6 t& C
  73. char *dmabufsrc1 = NULL;
    5 u# b7 \7 U& g: _& }
  74. char *dmabufsrc2 = NULL;5 E( A5 x- ]! e; E
  75. char *dmabufdest1 = NULL;
    4 O1 g' b2 R3 P3 l. d
  76. char *dmabufdest2 = NULL;
    0 Q) ]6 U2 I% v, Z$ @6 V
  77. : H( d" T4 k! n9 h' q
  78. static int acnt = 512;1 W& |# b6 |4 c$ y  O) V4 C
  79. static int bcnt = 8;
    : p9 d- B. |& F6 {0 x  z! N4 }. z
  80. static int ccnt = 8;- a; Z  P/ |5 [( V* i. a2 {

  81. ; l- T: n0 N: `8 y3 }" I2 S8 j. w, R5 k
  82. module_param(acnt, int, S_IRUGO);
    / N. a2 b1 X5 T
  83. module_param(bcnt, int, S_IRUGO);
    , B, u2 k  f4 ]1 S! o& Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 K  x4 ~5 q) A8 G/ c4 L: c
2 B' Y6 G# j* r4 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 J+ K* \  ]9 A4 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ V9 }2 k2 ?; H$ B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; N8 x. n1 {9 u: r) d* F

7 V6 P6 T9 Y' Y! R) e& b) u9 P2 s+ b" G/ a4 X0 p' V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 20:13 , Processed in 0.038959 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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