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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 \) a+ P, O4 t8 V% R
  1. [code]EDMA sample test application% y# j/ M# j9 w0 R0 f' v1 M/ `8 y
  2. /*
    / p' H8 z8 h! b5 q
  3. * edma_test.c
    : c6 y3 E- z: d5 E- c8 @4 B6 E
  4. *- w0 R) I- O  d' D$ \8 m* o
  5. * brief  EDMA3 Test Application; A, a& T0 x8 p- x2 M/ ~; d
  6. *
    ) @$ G* y6 B; l6 b5 X4 Z! t+ q
  7. *   This file contains EDMA3 Test code.
    5 D6 G) Q# T2 b2 \
  8. *
      {5 t3 I* a9 O4 y+ E* F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 W2 m7 ]- ^1 K0 V- T# `; d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. h1 t" I( O5 M1 l# l' d
  11. *         TO CHANGE.
    4 {  y+ O, l8 X
  12. *
    / }. ^$ o; E- H! A% n8 n# Y! x& X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - Z- r/ d. ^: x% W3 X
  14. *. x+ S2 ]. R4 {& r
  15. * This program is free software; you can redistribute it and/or
    , f0 k3 j: g8 T0 f& D
  16. * modify it under the terms of the GNU General Public License as; F  P5 A4 V# N; [% o
  17. * published by the Free Software Foundation version 2.; {$ ?. v# I1 @% j% j9 w- {
  18. *
    0 `( p/ i" e7 {7 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) T% \, t+ a" [$ _
  20. * kind, whether express or implied; without even the implied warranty
    $ R6 e! S8 C, L  J* X# V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # W' D2 f" N5 X0 C
  22. * GNU General Public License for more details.# b8 D9 @  B2 o+ h9 U& Y
  23. */& [7 G8 `2 q! Z5 k
  24. ; b* [% r% x! C$ g8 B
  25. #include <linux/module.h>9 ?& r* a0 a% Q
  26. #include <linux/init.h>6 N* e0 ?1 t6 \
  27. #include <linux/errno.h>
    " A9 h+ k7 T% Z- x6 K) r' r
  28. #include <linux/types.h>
    ) L- z: Y4 c+ s7 s, b, j. B
  29. #include <linux/interrupt.h>/ `5 O- Y+ y% n
  30. #include <asm/io.h># R+ q' _( q7 y1 Q7 ]
  31. #include <linux/moduleparam.h>/ D: d# O# R! ?) ?$ v  T/ U
  32. #include <linux/sysctl.h>
    3 K; c3 i" y* S: O+ w1 v
  33. #include <linux/mm.h>3 R( b+ g! S: q1 F" ~- [. A! i. B
  34. #include <linux/dma-mapping.h># L0 c2 ?/ D( i) E7 {

  35. ' t' F$ }  j+ C: m
  36. #include <mach/memory.h>
    , x1 x5 L( q& @
  37. #include <mach/hardware.h>/ r  m/ _0 k4 S
  38. #include <mach/irqs.h>
    4 z  e  A9 N- s/ y
  39. #include <asm/hardware/edma.h>
    7 K& x0 S% N+ @, h
  40. , I8 H3 [& q9 }! c
  41. #undef EDMA3_DEBUG$ z3 U8 K8 R" m4 y  p- I
  42. /*#define EDMA3_DEBUG*/$ |  T% D- @" f* |5 f$ u

  43. 8 `9 y( s5 X, q4 }* m# r( z
  44. #ifdef EDMA3_DEBUG3 R# H+ y9 Y+ P% c. m$ U8 Z& l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & u8 s9 k3 H) D& i: L; ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % T* [! K$ g1 d+ G7 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 b) I9 ^" a" |$ Y+ W5 i
  48. #else6 C: {# _: L% f. h- I
  49. #define DMA_PRINTK( x... )
    # x! h2 ], p9 L3 [  V
  50. #define DMA_FN_IN5 F/ n, q0 r) K6 L- G
  51. #define DMA_FN_OUT$ E7 c9 g" k4 ^1 J
  52. #endif
    - ]/ b) }9 d( n! p- z

  53. . I, I% x0 a& Q: w7 t1 z* |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 {  i( a* P- r* v' H
  55. #define STATIC_SHIFT                3
    ' @4 x5 v6 X- p% a
  56. #define TCINTEN_SHIFT               20/ D$ Z8 g' R; U: Z4 i
  57. #define ITCINTEN_SHIFT              21
    % Z8 K: X3 x; }, \- ^! Y
  58. #define TCCHEN_SHIFT                22
    6 r# ?2 c  B0 X) Z! Q' O# n
  59. #define ITCCHEN_SHIFT               23
    3 c8 n  d# H- |* G/ N# s. G* u. j
  60. ' X+ n) O8 V- ^: I
  61. static volatile int irqraised1 = 0;
    1 j  G- ?. l* J6 G* T# u
  62. static volatile int irqraised2 = 0;% P3 J9 G' _+ a0 I1 `1 z. \
  63. 7 c5 i9 R- N- D& Z/ ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" B+ s. `" h% Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : L0 ~2 q: V; l+ b" e; f* [. J+ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( |% I. {: ?6 Q% `% ^7 j1 @! n
  67. " _9 a7 q8 {( E% E% [0 r
  68. dma_addr_t dmaphyssrc1 = 0;9 Z: w& V! t8 Y% N4 P
  69. dma_addr_t dmaphyssrc2 = 0;
    # t* l6 u% n# I5 @; R: f4 I3 P
  70. dma_addr_t dmaphysdest1 = 0;
    3 t2 U  n, }( D9 F& u7 o* T& d: F
  71. dma_addr_t dmaphysdest2 = 0;9 M! z/ y# M. C- U7 J4 x
  72.   f$ J9 r! m5 F8 N# {% G2 Y: S! M
  73. char *dmabufsrc1 = NULL;1 `2 c& H# b4 ^( H. l) v
  74. char *dmabufsrc2 = NULL;. E) r' e" g( F, w  Q' ?
  75. char *dmabufdest1 = NULL;  n  U! O# @) F8 t3 A
  76. char *dmabufdest2 = NULL;3 z! p1 L: |) \5 T

  77. : Y+ e0 ^$ h% {3 @, q0 s' R1 a
  78. static int acnt = 512;5 ]3 l9 B2 o0 u5 F
  79. static int bcnt = 8;/ ]  X  C) {1 X  z6 Z
  80. static int ccnt = 8;
    / D4 R0 A. u3 \2 q, s3 w
  81. ! u" H0 j2 g% V9 `
  82. module_param(acnt, int, S_IRUGO);1 l8 n: t, i6 z4 x; p  _
  83. module_param(bcnt, int, S_IRUGO);
    + [) I/ X9 J% Y3 s4 C2 Z) x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! D, e* ~% H, t9 G1 U/ L/ |" @6 W5 Q! k2 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) b/ ^8 f' C, k7 E6 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z! V$ W( p( t8 y' h3 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" m  V3 D! @8 ~2 W" M6 F
6 Z8 m$ F4 v* h( z) h4 D" b/ W- S& |& \# t1 `3 F! s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 03:21 , Processed in 0.036041 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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