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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 B& _+ S! j4 R% c. h" p
  1. [code]EDMA sample test application2 W; r- B2 Y; F0 ~1 T: ?
  2. /*9 t/ Z% |! g# b2 {
  3. * edma_test.c2 |. T3 _2 @/ W4 r; M+ s/ K
  4. *1 T( E- O0 Q& s- i8 ], t, {- X0 E
  5. * brief  EDMA3 Test Application, S5 X: b3 M( T
  6. *
    ! N! E4 ?8 r+ |" n- D3 H7 r3 _2 `
  7. *   This file contains EDMA3 Test code.$ p4 O3 Z7 G) J( ^
  8. *
    4 }8 u0 h4 @# N& q/ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* V7 I+ U# K  K, ^% G8 L4 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 H3 f/ k- K* ~! y
  11. *         TO CHANGE.0 j( v$ R& d( |3 r$ r
  12. *
    , O( }; H7 a, ^' e( o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. \8 q) {+ S* w+ R# `! x
  14. *. f; T; [3 x; }' V
  15. * This program is free software; you can redistribute it and/or
    " v" l8 j1 i' w0 w
  16. * modify it under the terms of the GNU General Public License as
    ' t7 S; M& k# s, r
  17. * published by the Free Software Foundation version 2./ a& w2 M% B) i& x4 Q
  18. *
      [" f8 [$ m0 `6 _# R6 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' i/ D9 q. p- W$ q1 l  N% @
  20. * kind, whether express or implied; without even the implied warranty
    - f. I. V9 T+ H, q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. f- {0 F0 E" r
  22. * GNU General Public License for more details.
    . X5 K% s/ @! G  ^7 C2 C8 E, B
  23. */
    3 Y' V) V2 j' C3 E7 W3 B# G! L
  24. . L4 X! l  r1 \: P  t! k3 u/ d
  25. #include <linux/module.h>8 V  W( l4 i+ P0 e& o/ Y' n8 N. w
  26. #include <linux/init.h>
    * B+ C2 z0 [% k- b
  27. #include <linux/errno.h>
    1 K" {* R7 T8 w! C7 u6 t9 q
  28. #include <linux/types.h>
    ) ]: u% D, x. n9 ?5 e
  29. #include <linux/interrupt.h>$ T% M, e* @2 H( M% H! D$ p
  30. #include <asm/io.h>2 s3 V9 V5 ]' S' h& H. A" r. g6 t0 M
  31. #include <linux/moduleparam.h>0 X5 \9 m5 z5 Z9 f+ w
  32. #include <linux/sysctl.h>/ \' `$ l3 W/ r# p6 e
  33. #include <linux/mm.h>7 }+ a8 S7 b4 W+ P
  34. #include <linux/dma-mapping.h># k6 _* x; F( s& M+ H* c
  35. ' x8 W: }/ R- D) [5 E; S
  36. #include <mach/memory.h>
    ' Z9 X& u; n9 j+ m5 M' |7 O
  37. #include <mach/hardware.h>! N3 Y) b8 A" P: t8 ?% Q5 _
  38. #include <mach/irqs.h>3 u+ u  A. ~0 n' C
  39. #include <asm/hardware/edma.h>
    - G4 g* u5 v6 p* Z: v1 P+ W

  40. 6 u- }5 z& |4 `7 k" `
  41. #undef EDMA3_DEBUG/ O5 R# e2 s3 ~  A5 _9 P
  42. /*#define EDMA3_DEBUG*/
    . p. s. o% P/ B) W2 {& o

  43. 4 q; j( S1 N# j7 K; [
  44. #ifdef EDMA3_DEBUG
    1 G" ?, W  a6 U- r' r. j$ ]- y4 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 v; ^% z# Z* m9 H$ Q' N* S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 d5 ^7 f1 K7 c0 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & B1 D' O( x8 k8 J: r
  48. #else, ]8 C  i& T& O- H9 d8 Y
  49. #define DMA_PRINTK( x... )
    - j2 k  d3 [* H% H
  50. #define DMA_FN_IN* B/ d  C( A  @1 g
  51. #define DMA_FN_OUT' A9 i, Q; w, I0 l9 ^2 Y
  52. #endif
    * B2 ]  L! L6 w! a4 e$ V

  53. / f9 F* U4 h7 e6 K3 U* w9 e) y* t- @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ W5 u7 @1 c9 Z8 Z
  55. #define STATIC_SHIFT                3
    8 c8 S9 H- g5 t6 }
  56. #define TCINTEN_SHIFT               20
    " V, A. O* C# \3 A( n! s# o
  57. #define ITCINTEN_SHIFT              21
    9 {$ O6 g# ~( ~
  58. #define TCCHEN_SHIFT                22
    4 ^) [; E4 `" J3 O5 g. \# B# N
  59. #define ITCCHEN_SHIFT               238 Q5 O9 E  \! \0 q
  60. 9 ?( H3 @, G, s" ^2 |4 Y* N
  61. static volatile int irqraised1 = 0;: e6 I$ \0 z6 z
  62. static volatile int irqraised2 = 0;
    0 r9 E) c  \$ U7 \" C# T' o2 z

  63. , R! Z/ I& u- e: D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , Y; ^0 ], O% p2 {. W. i, k9 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h/ X, y) Y# P8 q3 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  E& j3 ?- k& Y6 f& j2 O
  67. : c2 {" |% Z& ]7 a
  68. dma_addr_t dmaphyssrc1 = 0;
    $ D7 Y$ W4 g7 c. L5 i+ Z5 r
  69. dma_addr_t dmaphyssrc2 = 0;5 y; g3 Q. q9 s1 \. H; }
  70. dma_addr_t dmaphysdest1 = 0;
    ! G7 [) v  m# I6 b  Q# J
  71. dma_addr_t dmaphysdest2 = 0;
    . w2 I! J% i4 E
  72. * u3 k# n( Z, I  X( X: f& A
  73. char *dmabufsrc1 = NULL;
    & P/ u7 c6 h" @/ X# F1 I
  74. char *dmabufsrc2 = NULL;! s& u4 s" B+ A# q0 o$ R
  75. char *dmabufdest1 = NULL;
    3 v# L& _! |  F# s0 [! q
  76. char *dmabufdest2 = NULL;% y4 n, a, y; n# p6 o+ S' c3 |
  77. 4 \: R( H" f6 q1 u
  78. static int acnt = 512;( T2 Y2 L* W- l
  79. static int bcnt = 8;+ q" N" W* n' e" H
  80. static int ccnt = 8;
    " z  {0 d7 V! @8 Z* }! S! g
  81. 1 k$ G" a% v/ }
  82. module_param(acnt, int, S_IRUGO);
    ; M" J  w3 J! O2 X$ V+ Q
  83. module_param(bcnt, int, S_IRUGO);
    9 \6 O1 y% Y2 F  d- A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! C- |4 Z0 X5 _' a4 u
2 N0 f) n6 J( I: d8 s$ t9 _* ~- Z5 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 e3 P1 c6 Q" K& [2 F8 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 c, O1 ]( ^2 A, X# f; y5 y, G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( k, K+ G) S) ]: u
, a5 C+ y( h4 `/ u# X# O0 n3 @0 U. a6 F6 I$ f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 13:47 , Processed in 0.042058 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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