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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" J9 I' J% V, i$ ^  w
  1. [code]EDMA sample test application7 Z6 h3 E; ?! U( M+ h, b
  2. /*% r+ A, c3 c( n& W  d  c( y
  3. * edma_test.c4 ^5 L) s; S# [* b1 f
  4. *. B$ r' Q/ u' w/ Y  D4 @
  5. * brief  EDMA3 Test Application
    ( Y! N: J7 ?; p& r! v
  6. *
    1 x9 C0 e  a& `. Q# p/ S3 c
  7. *   This file contains EDMA3 Test code.
    ( L& C* p# \# C& g1 p! l
  8. *
    : F1 X$ [" a  ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) L2 m6 c. q* |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 N! b6 ]# a2 r& n) g
  11. *         TO CHANGE.
    + Q4 A+ H# [7 i3 V  E7 d  L
  12. *! O7 o3 Q4 p0 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      j  M: `. b1 I" S
  14. *
    8 a9 w$ N' [- r) Q; f: z8 Y7 @
  15. * This program is free software; you can redistribute it and/or8 d, {6 p6 M" F& K9 f: L
  16. * modify it under the terms of the GNU General Public License as' H- \+ N4 x/ U0 @! f; }, j6 @0 o
  17. * published by the Free Software Foundation version 2.
    " Z. N2 U6 t9 T
  18. *9 \( o& {4 T! g/ @0 i) o# p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Y. R0 z- o$ |: \) {
  20. * kind, whether express or implied; without even the implied warranty
    . K/ x3 A# ]- u& P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 ~4 o: V& m' r$ G
  22. * GNU General Public License for more details.% L( Z! [" }% `" O
  23. */
    $ l2 ]; y! M6 C. [+ Z( F

  24. 7 ~3 V7 \1 {1 j) j
  25. #include <linux/module.h>+ P) U; s) K, f) }
  26. #include <linux/init.h>( r4 F1 v% a+ D+ Q2 T7 W
  27. #include <linux/errno.h>
    ' e* N! C% ^$ h4 J
  28. #include <linux/types.h>
    9 v3 {4 o2 Y' W  M6 M8 o
  29. #include <linux/interrupt.h>: o- d4 W# v: H# ^8 B
  30. #include <asm/io.h>) p9 }' r- d+ C4 A$ a: p) w! q! z
  31. #include <linux/moduleparam.h>
    6 G% s6 ]( x1 ?1 D4 ~; q$ r. M2 W: ?
  32. #include <linux/sysctl.h>& d/ s0 q* p$ c  L4 e* O
  33. #include <linux/mm.h>
    ! ]! u" U: L9 I2 B$ J5 {$ u; f( H5 K
  34. #include <linux/dma-mapping.h>4 j, \6 y0 l& @4 J5 |
  35. & o; q: m6 k: I3 t
  36. #include <mach/memory.h>
    " K& Y- @! z$ B9 `# @
  37. #include <mach/hardware.h>
    5 w: I. n6 y  w: Q
  38. #include <mach/irqs.h>. Q% B$ j. A. H8 e/ N8 r
  39. #include <asm/hardware/edma.h>
    + {- s& ]7 S( n

  40. $ d. V" L' M8 ~3 F* E" c
  41. #undef EDMA3_DEBUG0 W' v& L) M; p! e; }
  42. /*#define EDMA3_DEBUG*// x! R! Q6 A+ x; T, _
  43. 5 o; J: ^2 o  X  e3 w5 r
  44. #ifdef EDMA3_DEBUG7 [& V, D& s; A; {2 {4 `2 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# g% O! E# A" Z1 I! @% E! n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 I" ~0 |6 T( l9 u# b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , D! g: J# I3 e& t# U
  48. #else
    ; M9 p3 {3 t; ]& x* v% I, D) u( P3 F
  49. #define DMA_PRINTK( x... )1 Z8 {1 d8 [( V) `* Q7 K
  50. #define DMA_FN_IN4 n' K) T/ G+ z4 G5 J& ^6 c# L* w
  51. #define DMA_FN_OUT
    ; F; A+ W6 j+ i+ x
  52. #endif4 N" o* ~0 f# }8 r$ x. T; ^" ~

  53. 8 Y8 y9 F7 s$ u$ R# ]+ K; b" _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + E5 D7 g* Y! Z/ J
  55. #define STATIC_SHIFT                3
    % [" o9 M4 U: {( f, e" p9 ]
  56. #define TCINTEN_SHIFT               20* x& f# C- H# S
  57. #define ITCINTEN_SHIFT              216 }  C) E& d4 y+ A1 O7 k/ z
  58. #define TCCHEN_SHIFT                225 i) l; q1 a/ a3 w7 _5 l) h$ A
  59. #define ITCCHEN_SHIFT               23
    4 \% a  o6 ?5 X0 r  s
  60. . f+ E0 z7 D0 @$ F1 y& g' W
  61. static volatile int irqraised1 = 0;  ?  A, B6 L" U% c
  62. static volatile int irqraised2 = 0;, z$ f& v7 k! D* M9 W

  63. : v& X2 h  {3 d; O9 G. @3 ^6 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " w% j2 r2 g) t& i2 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* P2 }/ g9 k8 c# h; D* U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 U: A8 I1 u4 U$ q
  67. 3 I6 ]2 S# K( |0 Y/ W, ]  V
  68. dma_addr_t dmaphyssrc1 = 0;
    7 c/ R: l# v- B! V6 a
  69. dma_addr_t dmaphyssrc2 = 0;
    % C  d# h; P8 H( _: q" H5 N: e
  70. dma_addr_t dmaphysdest1 = 0;
    4 U: R# G- m! t: F9 ^" D5 {
  71. dma_addr_t dmaphysdest2 = 0;: k: _, W2 o& D, R8 c
  72. 8 i! P9 A* K- h9 _* L8 Q
  73. char *dmabufsrc1 = NULL;
    4 z& i8 g. e5 N8 g+ c- W& c
  74. char *dmabufsrc2 = NULL;0 C+ k0 o' L# X$ l$ ~& U
  75. char *dmabufdest1 = NULL;
      v' Y) ?1 W( x" L3 `% v
  76. char *dmabufdest2 = NULL;
    & S4 d# J: O- x6 w

  77. 3 I) i. S7 ^) e$ U
  78. static int acnt = 512;
    * Q  D8 r( g( v
  79. static int bcnt = 8;
    , X+ ?$ F% R- B4 u: }; M- @5 i. l
  80. static int ccnt = 8;
    + ^9 ?. w6 _, \/ f& X. w$ c
  81. / T% ?! I+ d1 `  x0 D% }2 ~9 Z# T
  82. module_param(acnt, int, S_IRUGO);
    ) u; G& q) E, P
  83. module_param(bcnt, int, S_IRUGO);: B2 E8 x0 n- m, ^  Y: q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ e9 p0 n' _- h! I2 ?
' S* ?0 |+ E4 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# N/ D9 N6 b8 R) d- l* ~9 b1 ~7 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- l* h. V! T, u* F+ H  ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 X$ L! t+ Y, n. ]
3 b) F. C) f. A" H

3 O! M" S8 R) P1 [6 U4 }. E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 17:25 , Processed in 0.047090 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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