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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* t$ W/ O) g5 T% c1 A
  1. [code]EDMA sample test application
    - ^- p/ S$ Q7 j4 q! x7 H' y7 d
  2. /*2 l8 [& O/ c6 E3 ?; N
  3. * edma_test.c
    8 d& e$ W8 L/ h9 D* Z' u- C
  4. *
    + z" Z* h- }# Y
  5. * brief  EDMA3 Test Application
    4 j+ M; W' ]+ A; ]. F  K
  6. *
      N6 C- K8 A, ?7 ~, r, U/ H
  7. *   This file contains EDMA3 Test code.0 N1 j2 u& ~9 o" b/ [2 j' d; m% V
  8. *6 Z3 i  N7 W; G, H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  C* y% Y# l5 N- A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( v) M6 |+ u! v6 T+ M
  11. *         TO CHANGE.
    ' V: o1 \0 ^8 O4 P3 A( o
  12. *
      e& J! a: r7 h$ `, K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T5 a0 J. \& F) Q2 [
  14. *' A3 e2 w; Z1 K! _* e* P, m! u4 o
  15. * This program is free software; you can redistribute it and/or3 U6 j) g* F+ J% g" o
  16. * modify it under the terms of the GNU General Public License as
    6 w$ m3 ^/ a2 a  [+ ^
  17. * published by the Free Software Foundation version 2.
    " d- k9 W3 M4 a" V) W. @, B
  18. *
    5 |, r$ Y( y# W  k) t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Q4 W* a9 B5 X; ?
  20. * kind, whether express or implied; without even the implied warranty$ Y+ ?1 U# Z) @3 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * N& i- n9 o( U- W" w7 K5 V7 e
  22. * GNU General Public License for more details.( J! m+ L# T4 F3 t  C. b$ t
  23. */, s* [4 A5 z  ?, ~! T- c- @# f

  24. , f; K3 m" k; B8 y. u0 u$ `1 v
  25. #include <linux/module.h>) T% J/ S% C. c) z8 M
  26. #include <linux/init.h>+ ?6 I& e( i2 c; b6 y4 [
  27. #include <linux/errno.h>% _) ^+ d7 V9 X0 z2 e* j
  28. #include <linux/types.h>' h) f& J  w) {" b2 g3 e2 F
  29. #include <linux/interrupt.h>
    2 E: ~5 [% t3 V# {. V
  30. #include <asm/io.h>
    ' |; \. I# ~0 A/ J2 e& h& f
  31. #include <linux/moduleparam.h>
    % e3 C. k9 T, u( ^- S
  32. #include <linux/sysctl.h>  l: P7 i* y, J3 v, n
  33. #include <linux/mm.h>. P# N  ~0 M) r9 Z; W: V0 a
  34. #include <linux/dma-mapping.h>5 R: B0 i7 `  o$ I" p4 g: x
  35. ! g0 N( M9 Q$ U
  36. #include <mach/memory.h>
    8 j# l* I* k+ m" c; e9 [
  37. #include <mach/hardware.h>
    , A$ r! f2 n0 A. [: e( n' y
  38. #include <mach/irqs.h>, J  D$ R, D% d) w
  39. #include <asm/hardware/edma.h>5 N, d; H5 X" \; s& n7 i
  40. " `7 z4 s0 \/ J# t* G8 C' n; `
  41. #undef EDMA3_DEBUG" M- [; K$ c4 q
  42. /*#define EDMA3_DEBUG*/3 R. Z1 V8 h4 M# `5 n/ o
  43. 7 h, Z6 ^3 p. V) @! ~, j9 S9 u& K
  44. #ifdef EDMA3_DEBUG5 b  L4 @8 [. b0 `  w4 X) K1 m* [# s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & ~5 l2 {2 i; a; X- O$ R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Q8 |$ g8 [/ p, C- H' A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), r% z5 z7 v7 b, m% E
  48. #else
    5 D3 S$ Z7 A3 c1 S
  49. #define DMA_PRINTK( x... )
    # }1 b! o6 C8 b+ N6 V/ d0 _& @
  50. #define DMA_FN_IN6 N' M! d0 K4 f/ o& E, i3 \
  51. #define DMA_FN_OUT6 a* o; ?' B  n" t, `9 a. A8 G
  52. #endif
    , x4 z. a8 _4 H
  53. & L  a& |- m, u7 R- A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' `3 K9 @, F) @+ Q! t% J
  55. #define STATIC_SHIFT                3- G  s5 t2 l) f; P- {2 r5 k
  56. #define TCINTEN_SHIFT               20, O! v" C) q# ?6 D
  57. #define ITCINTEN_SHIFT              21
    : S8 x: q6 R9 o: x- k) ~# Q
  58. #define TCCHEN_SHIFT                22/ Z! ?, w: ]: y5 p. H
  59. #define ITCCHEN_SHIFT               23
    7 D& a% I( V, o4 I# @

  60. 0 o' o! k' b( l/ `3 X* Y2 W2 C
  61. static volatile int irqraised1 = 0;
    6 ]4 \/ _7 W4 d& F# G6 H" N
  62. static volatile int irqraised2 = 0;
    ; ?8 |6 ~% e' P
  63. 9 h# G+ b1 a# o% L* R' M/ P" E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" f+ ~" @. E5 w6 E- T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F$ w9 y. N* w0 K, K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J; @' W% i2 |1 a& X

  67. - e/ G2 @  c+ t6 Q% E( l
  68. dma_addr_t dmaphyssrc1 = 0;
    ( r6 a+ X! p" q( g- L' h7 h/ m1 \3 a
  69. dma_addr_t dmaphyssrc2 = 0;
    0 A. s1 F0 L9 L5 Y8 E
  70. dma_addr_t dmaphysdest1 = 0;$ P. B3 L! j& x. M1 n) S  |$ Y5 [# D
  71. dma_addr_t dmaphysdest2 = 0;
    . g7 T* B+ u; O( @9 L9 C1 ^
  72. 0 @' M9 X% l6 N. \
  73. char *dmabufsrc1 = NULL;
    / n: h  m$ M/ D! u
  74. char *dmabufsrc2 = NULL;4 ~# |8 w$ x/ g" o7 H0 E; y7 d$ @/ `$ g
  75. char *dmabufdest1 = NULL;
    : Y: @. Y6 l2 _* I2 o
  76. char *dmabufdest2 = NULL;. ~% |+ Y1 J5 U3 M0 k! l

  77. + H- G5 s  J$ R9 q# t7 C# t
  78. static int acnt = 512;
    2 t( c# D) I6 e
  79. static int bcnt = 8;" P! G5 W2 N& q: P+ \5 }$ f
  80. static int ccnt = 8;8 n/ z7 Q4 g! f5 h9 J

  81. 7 {3 C& `0 u- F
  82. module_param(acnt, int, S_IRUGO);
    ! p- t  t3 p1 c3 }6 f1 k0 i
  83. module_param(bcnt, int, S_IRUGO);
    . R& s( |, f, Y, B0 K, C% f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ [. ^. E- ^( P% b6 j% u) H  N% i; w3 r- R: x+ |2 L, s8 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  m- Y& u7 ~7 }) c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 C' W6 R( }$ ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, x0 s# f  b  v  _2 A, j" a
4 B9 }' X% d+ h- H$ ^# ]4 e
: [( F5 Z# T6 T: V- T7 F8 v4 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 17:06 , Processed in 0.038547 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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