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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ x4 F* ^  ^$ O
  1. [code]EDMA sample test application; S9 F' f% g' [" W- ]
  2. /*) D) c: v' v# Y7 k% ~* D- B
  3. * edma_test.c  B7 {. K) B( H
  4. *+ A6 P7 c5 Y1 s6 ~
  5. * brief  EDMA3 Test Application6 K8 }- G( w' v  t7 v$ G
  6. *
    0 q& p  e3 z: j
  7. *   This file contains EDMA3 Test code.2 n  b2 t& h; i" }' S5 E) K; R3 G
  8. *
    4 Y' p/ G9 y/ p+ {  D; Q9 X/ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 ]8 w- p4 w5 y, t& N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( V: N/ }/ B9 `) B3 @
  11. *         TO CHANGE.
      G; p; E! t7 J7 H/ R" M
  12. *
    # n/ w: k8 l# X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : @& |' n8 z$ R' w; H7 r
  14. *
    / S4 M0 L( X! y8 }' L9 \5 k
  15. * This program is free software; you can redistribute it and/or
    2 O0 @* U& c1 c; g9 x
  16. * modify it under the terms of the GNU General Public License as6 `! p' _6 Z" A3 J7 r! }1 o5 H
  17. * published by the Free Software Foundation version 2.
    ; s5 m) j0 g  i5 u  o
  18. *1 Y1 X( C5 C$ k" K/ f( }( U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" P) Q1 A0 Z& {
  20. * kind, whether express or implied; without even the implied warranty
    , o* k, i0 U  K# A  ]# a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 j+ d7 D; _, ]; ?7 ], H' v9 z
  22. * GNU General Public License for more details.! n( P0 ]6 l" g3 a
  23. */
    & k, r2 g7 h! n% I; l% R! @* n, L
  24. % K' a" M9 d! ^4 E8 @6 X  z
  25. #include <linux/module.h>( c8 l  S% q) o/ d4 G# n( d
  26. #include <linux/init.h>9 e: ?+ j6 P3 @5 q4 Z# K( j
  27. #include <linux/errno.h>
    : F' E7 _% U& W( K. z) @
  28. #include <linux/types.h>
    # B6 F: X7 f# b2 F! V
  29. #include <linux/interrupt.h>
    1 p+ h& n; T& m
  30. #include <asm/io.h>! W+ V8 D( F3 q- h' W
  31. #include <linux/moduleparam.h>
    % e! y2 B+ L$ }% s" `2 h8 |
  32. #include <linux/sysctl.h>
    ; x3 R; |/ {4 j- C; E7 @
  33. #include <linux/mm.h>, ~2 I9 H* B( s. o; h# U! C
  34. #include <linux/dma-mapping.h>/ t* m, l) I  N3 o, f# ^
  35. 0 }1 T5 |7 a* f3 H! p  y; D) x
  36. #include <mach/memory.h>
    6 c$ S/ T2 |. V0 J$ A
  37. #include <mach/hardware.h>
    9 q& J0 h$ f4 T/ @$ Z
  38. #include <mach/irqs.h>
    5 K. T6 s5 x! Z* t3 S) F; `( n
  39. #include <asm/hardware/edma.h>: p# m$ A7 B, C/ |1 W
  40. # O/ _/ m8 h& T- q' K
  41. #undef EDMA3_DEBUG$ v8 x$ K$ s) w, V2 m2 H
  42. /*#define EDMA3_DEBUG*/3 M% M% k3 A$ M! c: M% O+ \# c
  43. 5 o3 n" H% d+ [. o6 g
  44. #ifdef EDMA3_DEBUG7 h- T, g6 _/ {; f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & l9 B0 T4 E2 ~  }* C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / z% c7 u7 y# }6 w8 I1 B: o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & ^+ E- }1 v9 K" N6 s7 F- ]6 ^
  48. #else
    " T: _5 I% B9 q
  49. #define DMA_PRINTK( x... )
    3 `' H9 h. W) v) r* M4 G/ d
  50. #define DMA_FN_IN
    " @# B2 O3 U& Z3 S& A/ p2 d- ?+ a
  51. #define DMA_FN_OUT
    & t) c& s( x* w; m# ?" _( [, s
  52. #endif
    1 Y$ N* F# `! Z- d

  53. ) ?3 G; M( c5 ^* w' x- C7 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 O: a# e; A6 G
  55. #define STATIC_SHIFT                3" w# B% r% j& g$ |! ~
  56. #define TCINTEN_SHIFT               20
    + h% H% I8 u( B9 ?+ I/ P( B
  57. #define ITCINTEN_SHIFT              21
    0 h1 @- F" j, z) K: L7 n/ G4 T
  58. #define TCCHEN_SHIFT                228 M0 _/ N" P) r8 o  R
  59. #define ITCCHEN_SHIFT               23
    * l, U, O1 A8 {

  60. 5 t! @0 q& z2 M6 z9 g* ^; H
  61. static volatile int irqraised1 = 0;
    2 W6 l/ B( K7 A; z7 m: f3 K: c
  62. static volatile int irqraised2 = 0;) s+ x" M+ T+ r, D6 s2 V3 |% N6 q
  63. 8 O, @( ~6 J, ~' p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; L  l# a$ `) N5 F3 V- C8 E- I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 S+ `6 a1 m  r: M" i/ c2 Q6 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }" M& D+ T: y

  67. 8 f5 g/ b8 ^7 E1 q0 C; }
  68. dma_addr_t dmaphyssrc1 = 0;
    ' P% K% H5 B& K7 W+ Q' p
  69. dma_addr_t dmaphyssrc2 = 0;
    : d+ s) I& V# i6 H5 O4 F
  70. dma_addr_t dmaphysdest1 = 0;# L4 O5 Y( k- J5 r. C
  71. dma_addr_t dmaphysdest2 = 0;
    + c6 r2 N' ^+ B; H- u) a  `3 E

  72. ! S6 C8 N+ z1 }( C" g
  73. char *dmabufsrc1 = NULL;+ S6 s- A- Y$ y$ H6 a' s2 e
  74. char *dmabufsrc2 = NULL;' A: d* G7 Z( S  Z% }) L9 b" |  R) ^' L
  75. char *dmabufdest1 = NULL;+ P$ n8 d; G# A% y
  76. char *dmabufdest2 = NULL;
    * u. C) D; n! J: a" B2 ]

  77. 0 _8 M$ Z8 ?% l& S7 u/ ]
  78. static int acnt = 512;# A, Z, q; h7 c0 J3 w! v" u5 X. ?
  79. static int bcnt = 8;8 B+ |$ \" E8 r; q8 t( }
  80. static int ccnt = 8;
    " o( O, q  d( m5 ?8 X3 r8 c

  81. ' U3 R# ^- u) p- K4 E8 G' M
  82. module_param(acnt, int, S_IRUGO);8 n- [5 L! S4 J- G7 f' C) H
  83. module_param(bcnt, int, S_IRUGO);$ n! T+ A& d* W, z8 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  N5 ~0 i. ?" I6 [, P0 G* [8 W- D
& W+ ~; ^# W( v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 z% G, V+ o" }  q' Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' B- i- R1 m; p5 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* p9 N' |5 X4 G& E, ~, y: g; d# S9 z; U
' q2 I/ j0 ^* A0 w; e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 03:14 , Processed in 0.036605 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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