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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ]* P0 u- X0 `7 j* N3 V
  1. [code]EDMA sample test application
    : A9 S1 q  e: K3 X5 S
  2. /*( A) D$ l4 C& T: t
  3. * edma_test.c1 y- @- p% x4 t( `! R" E/ G2 ~! S
  4. *
    . R" Y% B: W/ ?* x0 |- s# c9 @
  5. * brief  EDMA3 Test Application  k  X8 ~% Z! M0 d- W: p# g
  6. *
    * i: B, [8 d( C- e* S
  7. *   This file contains EDMA3 Test code.
    0 N4 j& D" H' x0 K2 C
  8. *
      ~; i6 {8 [) z5 J' T1 u7 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # X) _# Q0 I) ?" H6 J& L3 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ ]: W) t/ C* [! r4 Q( M
  11. *         TO CHANGE.7 [1 t' H2 s- {! b) a
  12. *2 H& K+ w5 T, t8 F- S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , M2 B8 k2 G" W" }; k# r
  14. *7 f* j. t, y# R6 {
  15. * This program is free software; you can redistribute it and/or8 \5 x, I- k& t+ |
  16. * modify it under the terms of the GNU General Public License as
    5 e- C$ C. D# P9 W( J
  17. * published by the Free Software Foundation version 2.
    5 r0 ]/ d) F2 E% n# M2 n, G  w
  18. *! m* i9 ]0 X- T) C# e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% k" ]( L( v/ @! G0 @
  20. * kind, whether express or implied; without even the implied warranty
    : U5 F% g2 O) o3 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 n- N) z, q- b+ c. }
  22. * GNU General Public License for more details.
    ! j5 S  w" ~1 d3 f; K) P" p
  23. */
    + j6 t7 E, ~3 R# Z
  24. 7 ]  R, a  P6 [+ l: \
  25. #include <linux/module.h>. {# C5 P" g3 g& l& r4 R
  26. #include <linux/init.h>4 c# b5 J# j9 n6 x: N1 ?: }
  27. #include <linux/errno.h>1 c* F4 M/ f: Z) I
  28. #include <linux/types.h>
    : U3 _' T; T3 [& g5 i
  29. #include <linux/interrupt.h>: J( s( w$ i1 t/ s1 Y: a" e
  30. #include <asm/io.h>
    7 W9 U4 P0 M( P& p, k9 R+ Y! w+ i
  31. #include <linux/moduleparam.h>
    - e* j1 {2 F# t- c; F* o. I* Y  t4 }
  32. #include <linux/sysctl.h>
    9 y" s9 ~/ V& @9 ]$ G# W) u
  33. #include <linux/mm.h>
    # m5 r9 j8 S; Y* B# _; t1 _- U3 e
  34. #include <linux/dma-mapping.h>
    0 |+ t: s( O# R) `

  35. . z" x4 l2 Y; A! B- f. U' l
  36. #include <mach/memory.h>; M( U; n4 v! Y1 ~
  37. #include <mach/hardware.h>/ v! j. F0 G$ Q5 ^" j! n
  38. #include <mach/irqs.h>$ i. Y4 t5 A* r& h9 `' q6 k! D
  39. #include <asm/hardware/edma.h>
    7 F1 F) U& M+ b1 J7 ^

  40. . _9 D* f% N$ C
  41. #undef EDMA3_DEBUG
    + a. ^& ^7 Y8 I
  42. /*#define EDMA3_DEBUG*/2 w) L- ~/ Z5 n/ |- I" ?7 z  g) [

  43. 8 g+ s6 ]- _" Z
  44. #ifdef EDMA3_DEBUG
    / P: |. ], m# c# H1 |. \; t( @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 W! G& l. m4 m9 M7 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ l) [, _5 i2 e$ _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) c# f' c# C2 }. a( O& a! w( _
  48. #else
    9 i9 I. ?  c4 E5 S& [, U" _6 z
  49. #define DMA_PRINTK( x... )
    0 |, c% ^* ?" H4 r
  50. #define DMA_FN_IN
    4 _4 q$ J. b! z, V1 v
  51. #define DMA_FN_OUT) K, Z& A% q* O5 d6 G5 X
  52. #endif' R! x$ N3 p. Q
  53. - {+ O* e  N# H4 C6 b, T( Y7 `0 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 j) ~% H/ L0 {# g; a7 N
  55. #define STATIC_SHIFT                3; M5 U2 q/ _. H
  56. #define TCINTEN_SHIFT               20
    # w# y9 B  m+ O1 ^( Z
  57. #define ITCINTEN_SHIFT              213 Y* Z" ~& J4 U7 h
  58. #define TCCHEN_SHIFT                22& W. Z6 r" I+ y7 r7 `! [
  59. #define ITCCHEN_SHIFT               238 F. v9 {& k2 @' S

  60. / F1 W, G$ Q, \  z
  61. static volatile int irqraised1 = 0;7 a) ~8 I& x4 r8 q
  62. static volatile int irqraised2 = 0;
      B$ R" J4 h; g8 c" Y
  63. ( {6 G6 l+ f/ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 F6 b- J! l$ s8 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 E4 h0 d3 Z4 S: j1 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& N' L/ N& J  C& W% @
  67. + g- v! y+ W! Y% S; h
  68. dma_addr_t dmaphyssrc1 = 0;8 [( I8 u7 x9 V& V
  69. dma_addr_t dmaphyssrc2 = 0;2 e5 G5 n$ e" n- s
  70. dma_addr_t dmaphysdest1 = 0;8 t/ y4 t4 ^+ v( T# |
  71. dma_addr_t dmaphysdest2 = 0;
    / G- T" x( m+ h! K
  72. ; r  N* z. x0 [& T
  73. char *dmabufsrc1 = NULL;
    8 J" V! o: O; z6 W0 q; I
  74. char *dmabufsrc2 = NULL;& c! M0 m: ^/ ], _2 K# [
  75. char *dmabufdest1 = NULL;
    5 q& N' C7 E; E0 Y3 u' d
  76. char *dmabufdest2 = NULL;
    3 F5 u2 q" f! N: J
  77. ' R% I* }7 B1 x! x
  78. static int acnt = 512;
    1 W4 V# |, V2 ]* Q% s- z" C
  79. static int bcnt = 8;: E9 d2 H( }. p& B( W
  80. static int ccnt = 8;3 @  X7 w  K9 e" G8 T
  81. $ q6 b% n  `2 g" E1 P/ J. f
  82. module_param(acnt, int, S_IRUGO);
    ; l& r/ k0 r0 v! k; \: Y2 V
  83. module_param(bcnt, int, S_IRUGO);
    : V' A6 c7 B8 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# h2 @0 y1 Q# H, e8 t+ t1 b4 o" W. k( b. H& Z. i* i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 g9 S) H' O, s; ^' A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 Q0 O; Q. ^- y, X; t1 N4 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Z3 B1 k! ~- `1 j

* T: d' U7 H2 V
. s! B2 t; D. N% N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 12:32 , Processed in 0.036817 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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