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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q( D( w7 {; R
  1. [code]EDMA sample test application- }  N) y6 N9 ?* e* P( ^! D. R' Z5 o
  2. /*& c& X6 V0 v* f7 U( `
  3. * edma_test.c- L: e; E- {" T  U7 x( A' V
  4. *
    " V( r: E& Y/ N. C9 p5 }/ K$ O
  5. * brief  EDMA3 Test Application
    7 B% G0 U! Z$ C7 k
  6. *+ X+ Q, ^% w0 M3 B
  7. *   This file contains EDMA3 Test code.
    ) E, ]/ V( ?1 e# A
  8. *
    2 @3 _" L1 U6 Q/ I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 S, e4 c6 w& d" y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 r/ f$ H3 A# u# n
  11. *         TO CHANGE.
    , w' c& A- T9 Z! g
  12. *
    - V9 M4 I/ `2 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( W5 S- C+ ^: f5 i9 w2 g5 d
  14. *
    . R! R2 p* m$ Q0 k
  15. * This program is free software; you can redistribute it and/or0 y0 H7 t- d- }+ n8 Y
  16. * modify it under the terms of the GNU General Public License as' m7 X! L% E7 A4 i
  17. * published by the Free Software Foundation version 2.1 i* D, y8 C, F' Q& d& l) V( t
  18. *) o; B2 [% E% @! E4 H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - E* h4 K# G! L# r! |, s: D6 t0 u2 y' o
  20. * kind, whether express or implied; without even the implied warranty
    & m# u9 E: q' X& H: K( B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ~9 R8 s. }# q" O* O: `' L
  22. * GNU General Public License for more details.+ G; H% B  o" u
  23. */
    2 ~$ o3 n- h/ q) U- `

  24. 8 L9 G/ @  Y; Y4 [! I3 G4 u0 c
  25. #include <linux/module.h>
    9 S- E4 Q. c- }( i
  26. #include <linux/init.h>
    * n1 E/ r' D4 f5 {' o2 R4 U
  27. #include <linux/errno.h>- s8 J3 }; |" R! S
  28. #include <linux/types.h>
    : F3 u, ^, A5 w1 r, H* O
  29. #include <linux/interrupt.h>
      q2 f; J& H# t& {0 [
  30. #include <asm/io.h>$ m. N, p$ u- a2 G: Q# U
  31. #include <linux/moduleparam.h>
    6 e% s/ D7 v3 s. G
  32. #include <linux/sysctl.h>+ p3 x- ~. U- N0 U9 X( H% `* A
  33. #include <linux/mm.h>3 o! y/ J) H1 O. _1 w
  34. #include <linux/dma-mapping.h>. x5 ^' b; i  K6 _8 v

  35. / k5 f! j6 W: I& u  K. P, Y" c
  36. #include <mach/memory.h>3 W, e6 N( X& G; y
  37. #include <mach/hardware.h>) E' }4 d1 T3 `4 i! \$ k
  38. #include <mach/irqs.h>
    9 ?% K9 p& \9 n8 F/ @
  39. #include <asm/hardware/edma.h>
    ! S" c& U) A* j" K/ w& \/ @  r

  40. ) \( P7 ^3 G& Y4 H( o
  41. #undef EDMA3_DEBUG
    % V& X- M2 o% B+ J" n4 S$ N& _/ \
  42. /*#define EDMA3_DEBUG*/5 f, f. @( I" ^: D: B
  43. ! B0 }) m# {8 Z0 j. U" ?
  44. #ifdef EDMA3_DEBUG
    6 E7 ~3 c$ R' a) `$ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; G: ]& I/ ^+ K$ a! @% V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Q. n# M- L! ]3 S& u0 Y! k- s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! B! I5 V  D0 K
  48. #else0 U% R/ _: L$ ~1 @9 j9 f
  49. #define DMA_PRINTK( x... )
    5 f0 Z# O. `& x5 R) V0 y- c
  50. #define DMA_FN_IN/ L. G8 a6 [9 _* c8 u. E
  51. #define DMA_FN_OUT- H9 i) E, f; Y0 S
  52. #endif
    ' L% Y4 j- w/ W/ J& z

  53. ! H3 x. y! z' _. V. p/ A- I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) J0 Q' S- x( K
  55. #define STATIC_SHIFT                3- R, Y9 k$ M) |
  56. #define TCINTEN_SHIFT               20+ T' h5 A8 I5 B# A
  57. #define ITCINTEN_SHIFT              21
    6 J. a! [8 l' _* [5 s% B: S
  58. #define TCCHEN_SHIFT                22% G- r, v3 s( S
  59. #define ITCCHEN_SHIFT               23$ b9 T( _; H; r3 G9 q8 o/ C6 n! g0 ]

  60. # [. s; C, L  D/ p
  61. static volatile int irqraised1 = 0;
      ?! x2 w! k6 y: ^! e# R4 L: w# b
  62. static volatile int irqraised2 = 0;; D: G7 P. m# u" s

  63. 8 r/ ^7 z0 u9 D0 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~6 Z/ Z8 C" c' ~8 [* q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . T0 c( W" I. ^* K. Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' H  E8 z1 `  Z5 N" g

  67. $ N7 j. A' T5 L
  68. dma_addr_t dmaphyssrc1 = 0;
    ! B( b8 G7 o; L6 ]' F( L8 M! w
  69. dma_addr_t dmaphyssrc2 = 0;
    & G4 |% F0 X! ^% y1 v7 d
  70. dma_addr_t dmaphysdest1 = 0;
    ' ?* u; N1 \5 Y% ?0 v7 a
  71. dma_addr_t dmaphysdest2 = 0;4 M( D3 D/ B! m( \' Q' I# @

  72.   N3 T+ _8 S1 _4 Q) S6 i2 P0 D
  73. char *dmabufsrc1 = NULL;$ p! O5 u+ |4 J6 b
  74. char *dmabufsrc2 = NULL;
    9 f3 K, }: y# b9 N6 }* t& B
  75. char *dmabufdest1 = NULL;
    $ d: I; P! b$ n* t
  76. char *dmabufdest2 = NULL;
    + b0 e" n# B9 A0 o: u+ z) A* c
  77. ; s/ m" K. R9 t- ]1 N
  78. static int acnt = 512;
    " ?! x( a5 i5 z
  79. static int bcnt = 8;8 A6 |  L) E0 L1 D3 Y/ N$ _+ n0 i
  80. static int ccnt = 8;
    5 G4 `$ q) X+ _

  81. ) r2 e- r# ?% j2 |/ j/ D* D
  82. module_param(acnt, int, S_IRUGO);' ^2 F5 I* h- d( l; M8 I" L: {3 Z
  83. module_param(bcnt, int, S_IRUGO);" P" i! `5 N  E$ ]) e& u7 F  |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 R' j5 `/ [/ S5 H5 p
. k. S. ~& _% \$ z9 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 J! d- @0 I) f" R6 v* W4 J. M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! a1 B# k: O+ A  ]# s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ _1 J( A- b9 x8 ]2 s' Q
; W, L5 [; \& K6 O! l7 H7 a) X8 F2 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 05:34 , Processed in 0.038259 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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