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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; b6 l0 y! G3 m
  1. [code]EDMA sample test application
    0 A1 i" o' N" Y# T: v. s
  2. /*
    0 p# D$ m& \. g. r
  3. * edma_test.c9 \* |5 |! K  P" e! g8 A
  4. *; Y6 w* m7 R) _1 g( q
  5. * brief  EDMA3 Test Application
      L5 h7 v+ B6 E+ b. @3 u
  6. *
    1 `" E% Z) e6 G  Q, X9 N
  7. *   This file contains EDMA3 Test code.
    : `1 z+ ^  P7 I0 E
  8. *
    3 j% P8 h' [  y, x3 m/ V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 M3 [3 k* e0 r. u3 E1 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; u( X# J2 x6 ?
  11. *         TO CHANGE.
    4 q: P6 ]" n  @; N
  12. *
    : T  n3 T6 Q- `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; `+ K) g5 o5 t) e
  14. *1 [0 R+ v( H" \/ U% u. P
  15. * This program is free software; you can redistribute it and/or
    2 Y7 N' I- B4 L% h* A
  16. * modify it under the terms of the GNU General Public License as$ z  s- L, B4 ~
  17. * published by the Free Software Foundation version 2.6 S8 E  j! A  v: i8 l* G
  18. *5 k# e: b8 T. c: ^/ z& L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  z$ S' Y4 Y- r. H/ |9 e
  20. * kind, whether express or implied; without even the implied warranty
    - q/ @4 i/ V2 D5 I1 O: D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 D' z0 \3 D6 O: f* k9 q
  22. * GNU General Public License for more details.
    , Q+ H! B: B! ^& s. }! g% v- a( B
  23. */
      ]9 k% U8 i% p
  24. * ]8 P/ Z4 x) u. [: [
  25. #include <linux/module.h>
    ' z9 t9 w: g/ `6 t1 Z
  26. #include <linux/init.h>
    4 [) w$ G8 v# d$ p; J
  27. #include <linux/errno.h>5 g: F" ^7 r- d/ Q# T  i
  28. #include <linux/types.h>
    0 b' v% k& @+ C, D. u+ e7 {. {, e
  29. #include <linux/interrupt.h>
    " v1 N9 ?- ~& o8 N! e1 U
  30. #include <asm/io.h>+ g) N( ~, L$ b4 w9 P$ X& D4 F. k$ ?
  31. #include <linux/moduleparam.h>: l* n2 w, a9 K  x) h2 T$ `7 N
  32. #include <linux/sysctl.h>6 R, T& p! k$ n7 D2 h6 @
  33. #include <linux/mm.h>
    7 i1 _1 R0 q6 B% ], _6 u* L$ A
  34. #include <linux/dma-mapping.h>
    $ A$ C( m9 D3 E. C
  35. 3 w! d2 }- ~) z: l, ]. x
  36. #include <mach/memory.h>
    4 ^  C  h- X8 F  }" [
  37. #include <mach/hardware.h>: y, _6 b7 r2 L* R
  38. #include <mach/irqs.h>
    ; {) o! E0 W8 Q2 U1 p0 m: t* S
  39. #include <asm/hardware/edma.h>- x3 c: ~/ m# C1 p) C" v9 ^

  40. & o  X7 L6 M& r" W
  41. #undef EDMA3_DEBUG
    ) }) C. N; g$ T/ E# p; N9 j, c
  42. /*#define EDMA3_DEBUG*/
    $ t# m% j9 s! V4 |% ^6 n

  43. " X/ N+ B: y& ]3 Q
  44. #ifdef EDMA3_DEBUG
    6 L5 m; |& c* z# O! w! n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ j  U2 T. u% O& B$ Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " q8 o( f% \. G& [, H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " z) U% m. u  D8 u8 R
  48. #else
    * G/ u& V% J, J/ z6 v5 ~3 n
  49. #define DMA_PRINTK( x... )
    : A6 ]! P" |6 C' f% i
  50. #define DMA_FN_IN
    9 X3 j0 L  H+ r8 K/ }
  51. #define DMA_FN_OUT
    ) u6 @! S7 X3 h- m) E. d
  52. #endif' y3 V! ~3 S  I, X  q

  53. 8 W$ ^! P3 q1 p8 x- F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 A/ Z9 O( S- j  u, H
  55. #define STATIC_SHIFT                3
    : X( U2 _& u9 t+ y2 [/ R+ G4 c
  56. #define TCINTEN_SHIFT               20
    4 e$ l8 g! s* G8 W$ n. V
  57. #define ITCINTEN_SHIFT              21
    " \# E2 F& I, b0 `* f9 O
  58. #define TCCHEN_SHIFT                22
    - a7 U( ], X: R* P3 q' Z0 l7 Y
  59. #define ITCCHEN_SHIFT               23
    / y0 \0 r0 }$ i% [+ q. G' P# ^- {, d7 r

  60.   @0 u( j! O' e3 L
  61. static volatile int irqraised1 = 0;+ v. \0 A8 W3 \' ~
  62. static volatile int irqraised2 = 0;
    , P9 n* Y7 X! v# k  s# C+ X1 o  s
  63. . t# `5 N: B$ a" {3 a2 w, W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: B+ Z  O8 G; E# j+ u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * u9 v" G" @! r) V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 x* M8 {6 V; D
  67. - l  P. j" T- w3 M- P
  68. dma_addr_t dmaphyssrc1 = 0;7 J% D+ ^2 p1 d- w$ {* }& b
  69. dma_addr_t dmaphyssrc2 = 0;6 |2 p. |  P% W3 h# c7 Z
  70. dma_addr_t dmaphysdest1 = 0;
    8 r* u1 f: v5 N* v7 a% `
  71. dma_addr_t dmaphysdest2 = 0;
    8 i; D, g. }+ E% F5 X9 \
  72. ' A/ r9 \9 {, \  N6 J( \) a$ b
  73. char *dmabufsrc1 = NULL;
    # \2 K# e/ I3 D" d
  74. char *dmabufsrc2 = NULL;
    * s$ }+ V- W$ {5 H  L& F
  75. char *dmabufdest1 = NULL;, q3 V" [, C: S4 K; n# j8 ^% e( n
  76. char *dmabufdest2 = NULL;
    ' D+ k. G; [# h& H' t

  77. / ?9 v7 q6 D/ R  o2 a. B: a; w
  78. static int acnt = 512;2 ^0 B4 V- l4 O# s0 ~# l
  79. static int bcnt = 8;
    " N) y6 A# f9 [( U+ O8 K
  80. static int ccnt = 8;$ N+ e. ^9 x& K& ?( B
  81. 3 q$ \& s& q6 v
  82. module_param(acnt, int, S_IRUGO);; W6 w3 o# j0 U9 U  q- J4 {1 f
  83. module_param(bcnt, int, S_IRUGO);
    / t1 X+ z& R( T$ H$ B  c( W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- H+ o. o, ~2 L) W; _7 l+ \( w  q+ b# f  t& f0 [# r  N" e  ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ U3 e0 q/ j" a" _) E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( h4 c" B* q+ p1 }6 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. t9 O6 W" D( |* R' j, V# \# Y% N- n# f3 b
) v/ B5 F0 T2 n( ]
9 W4 O7 t' p2 c7 T, ^& P* i7 u- b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 08:55 , Processed in 0.040496 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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