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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 S* R. @, d/ G. |7 R8 J3 C
  1. [code]EDMA sample test application
    / u1 {7 A$ }, r4 E
  2. /*/ ]1 V2 s( D1 m4 v4 w
  3. * edma_test.c
    $ b# c3 _9 @1 q# E4 e
  4. *; y% ]. L+ w3 y
  5. * brief  EDMA3 Test Application
    ! F5 \* w/ p) O3 a: U
  6. *
    / v+ c) N' v5 b8 ^) }0 c( J& C0 b
  7. *   This file contains EDMA3 Test code.
    ! u+ W* a9 `1 h) x
  8. *4 Q) k: G; g# `- w9 T" H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* T7 U5 `7 l6 N4 X# O- M! f9 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 k6 C% |  Y: }  ~
  11. *         TO CHANGE.
    7 s/ q& s0 s8 ?: m. [2 Y
  12. *" o, f1 Z7 S2 |8 E# j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 j  t  j0 Y6 |6 A( j. y- g  O/ j
  14. *
    ) m7 W1 n& o7 S8 ^: i7 A; {
  15. * This program is free software; you can redistribute it and/or% K% ?* o) F+ U
  16. * modify it under the terms of the GNU General Public License as
    ' v3 a. b9 v/ p
  17. * published by the Free Software Foundation version 2.
    # T+ E* k, o' O1 c: W, G
  18. *: g( J; b+ z) h# t! _% z* Q8 \$ `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - ?: w2 y! B! x! c) G8 i
  20. * kind, whether express or implied; without even the implied warranty7 z1 [8 a5 C7 E4 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! ^. L0 B7 c, ~$ `  C
  22. * GNU General Public License for more details.
    6 f, q6 F, t" Q  e. H; z4 P) A
  23. */! o: p8 F9 H2 M; }. K0 p
  24. - |! f2 M0 }+ P5 l, Q( H8 g- z
  25. #include <linux/module.h>
    3 Q0 u! ^8 V0 ~7 ]' k$ @+ P
  26. #include <linux/init.h>" C: I7 p$ [$ n( S. m: X
  27. #include <linux/errno.h>
    & K, P) ?: M4 }  Z' C; [
  28. #include <linux/types.h>
    . `$ |6 f( O5 E# i7 b
  29. #include <linux/interrupt.h>' Y& i  M/ \* R% V
  30. #include <asm/io.h>* ^) F1 K4 D8 q
  31. #include <linux/moduleparam.h>
    ' q2 v& L" \# {5 i: N
  32. #include <linux/sysctl.h>: P, O" d2 J! a* ^
  33. #include <linux/mm.h>/ f8 g7 N4 O+ J; d
  34. #include <linux/dma-mapping.h>- Z2 D8 I* d0 h$ i6 z" j) D
  35. ( T0 h8 ]8 e1 `3 p  W
  36. #include <mach/memory.h>/ U. P8 F) B) m& D- m% e
  37. #include <mach/hardware.h>
    ( m. v$ R% g$ k  Z( A/ ]1 B2 w
  38. #include <mach/irqs.h>
    1 k: U3 w3 N/ f# z
  39. #include <asm/hardware/edma.h>3 j" q( a3 w4 k4 T0 s; C( J

  40. , `$ ], J* f& N6 u7 x; e6 j/ k5 _
  41. #undef EDMA3_DEBUG8 o! Z. f% @" c: \$ K  E
  42. /*#define EDMA3_DEBUG*/  e( U' m5 u& s6 j+ g

  43. / J' x0 D5 j9 e% u) h
  44. #ifdef EDMA3_DEBUG
    7 N! x- j3 s5 w" _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 T  T4 U" B# j3 V) b9 O7 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- @, m. K* Q, K7 N6 j. H" q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + i/ |4 {& Y. \
  48. #else
    - ?" K7 M+ B* q' c3 W, |7 n: @
  49. #define DMA_PRINTK( x... )
    3 @! d! z/ J4 b  V5 f
  50. #define DMA_FN_IN, e: J+ w% h, Z
  51. #define DMA_FN_OUT
    ) S* M0 E: W5 l
  52. #endif
    , m# O. @% k- m: z

  53. ; K; \, w4 R. h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 w* q8 L0 ?$ \* N5 h: e
  55. #define STATIC_SHIFT                3% D& {0 F/ N+ ]( v" S, a" x/ f
  56. #define TCINTEN_SHIFT               20$ e$ k9 C8 t1 W' p, v, A) m/ j# x
  57. #define ITCINTEN_SHIFT              21( ?% i: p; H7 q# e8 Z6 R0 Z
  58. #define TCCHEN_SHIFT                225 B, f( L: d5 d" T2 c
  59. #define ITCCHEN_SHIFT               23- A* A, S/ y( w5 f( ~# l) q
  60. " [  d5 c" s0 Z$ t$ i
  61. static volatile int irqraised1 = 0;
    7 e# [. Q" U, q( Y6 E
  62. static volatile int irqraised2 = 0;+ Q5 M; F# M$ a' O/ s5 Z

  63. " E1 r* W1 S7 u4 @, l6 A) A* i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 g" ?+ W0 l& F. J0 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % m! p0 _2 |/ F$ b/ L- R3 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _; K/ x! m0 p2 q. Y

  67. / C$ x8 S9 m0 Z+ I6 Z3 z" ^
  68. dma_addr_t dmaphyssrc1 = 0;1 O6 v1 v# I& |6 a" V. [
  69. dma_addr_t dmaphyssrc2 = 0;' [7 Q# T3 |2 V1 _3 z& \2 R1 ^
  70. dma_addr_t dmaphysdest1 = 0;4 W" t( G  k& ~5 X3 L3 g. x
  71. dma_addr_t dmaphysdest2 = 0;
    , t+ n$ @& K9 `

  72. 4 |/ T5 p# N0 i* G8 S! n8 E
  73. char *dmabufsrc1 = NULL;
    $ S5 Q6 Z* d1 x: n: b; M5 `& E
  74. char *dmabufsrc2 = NULL;' K9 V# N2 B5 w( s
  75. char *dmabufdest1 = NULL;( o! F4 v1 A  a3 ?8 C% ~! T
  76. char *dmabufdest2 = NULL;
      u9 W+ ~9 l, e2 a% \6 d; v

  77. . s) C' e2 n  o, T. @$ }/ d  ~
  78. static int acnt = 512;( d0 L8 E. v3 Q- m' j/ J# A5 |
  79. static int bcnt = 8;
    , s' t3 d- d  h" l: ^8 u* a) g5 _
  80. static int ccnt = 8;$ \# A# J( r9 c) A4 n0 R

  81. 6 `5 ~; Z) n: a( S6 r; Y5 i  G6 \
  82. module_param(acnt, int, S_IRUGO);
    5 k7 h* ?3 S2 h* {& |' U! u
  83. module_param(bcnt, int, S_IRUGO);+ d+ {* z  L" n3 q) ?9 P! K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 N0 w5 [' E1 f8 {( H. N" O, [' U  D7 e  m; r8 N5 ?! x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& y3 B: B# ^& }" K1 d4 D1 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]" }2 X% F* s3 M: j2 y' S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B: y9 ]( ?2 m6 ^; c7 |) B# ~7 `4 R" C- F7 F
; t* k# _! j' j; K2 Y# O3 e: e  _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 22:19 , Processed in 0.042293 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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