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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + C+ B$ ^% \& R
  1. [code]EDMA sample test application
    8 H& {6 ~" Z" C. U6 A8 C: n2 L
  2. /*
    2 }: F* F# `" p. D
  3. * edma_test.c
    % \; n, Z3 L3 Y. K& J
  4. *6 O* `( J% n1 |- B
  5. * brief  EDMA3 Test Application* E9 G' _! S7 v$ }- O, c: @
  6. *4 w! e6 \+ U, U3 w
  7. *   This file contains EDMA3 Test code.
    " G+ u8 C& n6 L" [; N
  8. *$ l$ W: l- H5 c' y1 Q3 N$ @) B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ^" I1 v& B, e+ _) p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 K+ D; a: Q8 [) ]1 _. ^
  11. *         TO CHANGE.
    1 h3 a% b  h+ v
  12. *
    4 _% Q4 R% J! I9 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ?& R+ _$ ]& ]2 s1 ?$ f
  14. *
    - M/ G6 ~/ }9 i5 _" z
  15. * This program is free software; you can redistribute it and/or8 V( V3 N6 j* {4 k1 b
  16. * modify it under the terms of the GNU General Public License as
    6 x/ d; b3 G9 F. g/ c
  17. * published by the Free Software Foundation version 2.
    6 S( \$ O+ L& z; Z( `$ m! x
  18. *
    / [  i$ p% X" U6 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & k& y: w, D" u! m/ M% w- Q
  20. * kind, whether express or implied; without even the implied warranty7 C9 Y# N7 O# a% k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ c/ `% r% J0 y, X) P$ P
  22. * GNU General Public License for more details.
    ! a1 J- C& c  v8 x; x
  23. */
    ; D8 I1 s' S: U
  24. 3 c4 l8 f+ {9 }! T9 V
  25. #include <linux/module.h>
    $ F# S3 r6 |* }$ R4 o+ D
  26. #include <linux/init.h>% ^' g0 ~" r; B2 L3 n2 s' H) @6 f
  27. #include <linux/errno.h>- [; c. c) _1 `) `7 h
  28. #include <linux/types.h>7 [0 f. ~5 D) u& {* r- Q; l% P
  29. #include <linux/interrupt.h>. ^4 t2 h- G$ [5 n1 N
  30. #include <asm/io.h>
    : m2 ?& p% |: P8 j1 z
  31. #include <linux/moduleparam.h>9 C. d9 l' L2 e9 A! o! @
  32. #include <linux/sysctl.h>4 W; S7 E. b; _( b
  33. #include <linux/mm.h>7 f4 k" n2 y5 m
  34. #include <linux/dma-mapping.h>
    " ^& d9 N( K0 T1 H/ Q# I- g

  35. , S; m* Z3 N/ M% h& j
  36. #include <mach/memory.h>
    ( C$ G4 [$ |5 t3 o8 i, L1 ~6 q
  37. #include <mach/hardware.h>
    8 E1 m! t8 J/ A5 |  Q
  38. #include <mach/irqs.h>
    & M  ]7 S' L8 ~
  39. #include <asm/hardware/edma.h>
    $ v! f7 I  K+ y+ }6 p3 w% P& u

  40. ; O# b1 F, _8 H3 p1 V4 W: x
  41. #undef EDMA3_DEBUG* ^: M, D( {. E9 o
  42. /*#define EDMA3_DEBUG*/' ^' h9 G! v' f0 N2 I, m
  43. 9 D, T& {0 _- U# ~* T0 T# G
  44. #ifdef EDMA3_DEBUG
    2 ~; G- i  R0 Q+ \2 M' W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), X/ _. s# ]3 v4 d. |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % F+ X+ Y/ p% q) q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Z9 A7 Y1 G% z
  48. #else
    & S7 k: ]8 m) }6 u1 F4 G/ b& E, m
  49. #define DMA_PRINTK( x... )0 k: }9 [4 ?" p/ y( }7 R
  50. #define DMA_FN_IN
    ) S+ _0 ^1 r4 X( F& X
  51. #define DMA_FN_OUT0 F1 }1 c4 U( V" I* K' q
  52. #endif; P# [! @1 t/ p+ g- X, q; T
  53. $ F/ n, I) s* o6 j6 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + }5 n0 m8 b  i' C( D3 B' t
  55. #define STATIC_SHIFT                3
    7 W6 D4 F2 L- c
  56. #define TCINTEN_SHIFT               20
      Y, `9 ^* S4 C8 S2 E
  57. #define ITCINTEN_SHIFT              21
    & \: A$ ~9 @6 j, p2 L
  58. #define TCCHEN_SHIFT                22
    0 N* {6 u1 u# C+ y' Y
  59. #define ITCCHEN_SHIFT               23
    0 ~( \5 q6 t7 s6 B
  60. ' o8 D: j9 A0 J" J" L+ r$ m
  61. static volatile int irqraised1 = 0;& d" _& h  ?; x6 y0 W
  62. static volatile int irqraised2 = 0;8 i1 f7 W0 x( I0 H. @" j. [

  63. 9 ^8 \( ]5 R! [3 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! c% r. X0 c1 s& v5 B0 O1 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % }4 D& h0 q8 y6 K8 _; N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 V6 o% L" n4 B* f8 G' z

  67. : R. K5 E/ ]) q- c1 x1 v
  68. dma_addr_t dmaphyssrc1 = 0;
    ; _: S! X( D( o& x
  69. dma_addr_t dmaphyssrc2 = 0;
    ( Y7 H  f- s5 l# K0 Q- |1 Z. P
  70. dma_addr_t dmaphysdest1 = 0;
    3 M; r# o( O4 m0 [* q
  71. dma_addr_t dmaphysdest2 = 0;
    ( C: @; _" Q* O

  72. / O+ G/ f. ]/ J+ b8 Y
  73. char *dmabufsrc1 = NULL;; b6 S, v' p6 Q7 }& d7 {0 ]: D
  74. char *dmabufsrc2 = NULL;
    * S  q) r; Q. e, f+ }# _8 z+ m
  75. char *dmabufdest1 = NULL;7 y7 A4 X; o; T1 ?7 s
  76. char *dmabufdest2 = NULL;( u! z  J2 D  g: r) d3 l- d

  77. % }: g9 W4 f# s' D  c
  78. static int acnt = 512;2 D4 B! v1 I9 T, x  m( C
  79. static int bcnt = 8;8 `( Y) J1 m0 }& p, M
  80. static int ccnt = 8;$ Y4 p  g" d5 k$ R

  81. ! o/ V+ D/ T+ o- y5 m% {4 \- K2 S
  82. module_param(acnt, int, S_IRUGO);( ?6 |9 W6 n* ]' i/ E  A9 g- ]2 D; I
  83. module_param(bcnt, int, S_IRUGO);
    & j4 x- [" j5 ?9 Y; t% Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 [- R- Z5 f3 s9 W# ]: q6 F4 L0 W& Z, h$ M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& s, n; F  s9 z* O4 S8 e# E) A& X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; Q8 m6 r7 `2 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 d7 g7 t- t. g2 P5 W* y% U
7 a# e$ b6 U. S/ e: j3 E

# u  [  K! |& _* s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 10:38 , Processed in 0.035870 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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