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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  Y5 H7 ?' ~  @, {  ?3 [$ q, A
  1. [code]EDMA sample test application
    + C, B# t8 U, Q( V+ z" p
  2. /*1 _6 b2 r9 i4 C6 _* x
  3. * edma_test.c
    # m* O% Q' f% {- H& T  U
  4. */ T8 _. M2 d; x2 D/ |# J
  5. * brief  EDMA3 Test Application
    3 D! e0 E6 ^7 s5 y4 d
  6. *- q* M! F3 L! f& F* d9 ?5 Y8 ~
  7. *   This file contains EDMA3 Test code.; p4 E# h( Q' H9 I
  8. *& K4 i$ R; u6 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 ]5 X. x+ B0 g. I& H) C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 F* K! G" t/ ^. U" @- _3 k
  11. *         TO CHANGE.* ^/ s9 H( Q) u: u
  12. *" P' ~, e6 I4 R9 |. ]' l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " s. L5 E* a+ N# N, b/ n
  14. *0 |; N$ y7 R" Q1 @0 q
  15. * This program is free software; you can redistribute it and/or$ T. d+ U- w* z# m& M" V
  16. * modify it under the terms of the GNU General Public License as
    $ w+ v1 f+ [# w. ^  Y( z
  17. * published by the Free Software Foundation version 2.
      r3 p- y4 y. H# S; v! C
  18. *( x6 m" E- G0 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . }. \3 R" {% F0 b+ ?  ^5 {
  20. * kind, whether express or implied; without even the implied warranty) F5 A' G6 v/ K7 Y; s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 D' v+ [) R3 h; ~3 [+ d) `* V7 t
  22. * GNU General Public License for more details.7 H) ?0 E. d1 e# C( \# h# i
  23. */" g& z5 F: D+ e3 T6 g4 o  {8 N

  24. / B* q2 a0 a- a
  25. #include <linux/module.h>8 Q& f6 a- a1 d1 m
  26. #include <linux/init.h>
      v& _5 M4 }2 t* ~
  27. #include <linux/errno.h>) G5 D3 c0 m* d' X
  28. #include <linux/types.h>1 M& X( [7 u' ~2 G' [) `
  29. #include <linux/interrupt.h>1 n- b2 i9 ?* f; c3 @( M
  30. #include <asm/io.h>
    - h  g9 z& G: c/ l1 _, [" a+ X; L
  31. #include <linux/moduleparam.h>
    ; }6 @0 z6 }- l! U
  32. #include <linux/sysctl.h>& p" i. c8 d& x/ |& |3 n
  33. #include <linux/mm.h>
    ! s" _- F$ a" A: W8 M0 R
  34. #include <linux/dma-mapping.h>5 g: R5 s3 F4 r1 F* t& U

  35. ; E) A/ ]) s/ o: s1 _
  36. #include <mach/memory.h>" W7 t6 j+ w. B8 K4 c+ {
  37. #include <mach/hardware.h>
    ! \$ Q2 L. H. t5 g2 D; V
  38. #include <mach/irqs.h>
    7 Y0 G" P, N# x
  39. #include <asm/hardware/edma.h>& X& \6 N6 R7 G$ Y0 K& W9 B
  40. % n  T0 ]: P* S
  41. #undef EDMA3_DEBUG
    # [) C6 U/ [. Z/ l2 \' a
  42. /*#define EDMA3_DEBUG*/* a* o2 g4 L! U% u6 e
  43. 7 u3 I# r2 O, P% ~
  44. #ifdef EDMA3_DEBUG
    5 a, Y# `  J  A, t" m$ L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & j: x* x/ g; O6 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , @6 s0 j! v) `$ S9 h( B+ J! }9 a( S  I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * v2 p$ A7 z" U; n1 ?
  48. #else
    0 _# F& K3 Q) J* T2 {
  49. #define DMA_PRINTK( x... )
    - ?* o7 A. b" _7 \& q) N  {2 I
  50. #define DMA_FN_IN
    - c0 X- p- {  ]
  51. #define DMA_FN_OUT5 Z9 e! |% ^" a, q# `% v
  52. #endif
    1 k, Z- R6 L" U, n, C3 ?

  53. + d" ^8 p" Y9 ]5 E/ Q1 e) k+ p0 O6 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), I% W9 Y9 a- G3 |: w6 _' M" U) `
  55. #define STATIC_SHIFT                3# e5 f$ u7 X4 J! L7 F: L& F
  56. #define TCINTEN_SHIFT               200 `' \2 q) r) ~1 m* P2 f% m
  57. #define ITCINTEN_SHIFT              21" }. H1 _8 f& r! |! M5 t
  58. #define TCCHEN_SHIFT                22
    ( M2 j% _: T4 I" V4 \  X/ o
  59. #define ITCCHEN_SHIFT               23
    & E( b2 N' p; h6 `9 n. x

  60. * v0 y! A6 {# f% h( _
  61. static volatile int irqraised1 = 0;7 m/ J; ^3 j  S" S, ]
  62. static volatile int irqraised2 = 0;
    + E9 l9 ]. b$ u( z! H' D/ t
  63. ( V3 J7 w- ~) c1 P; |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 z- K; `: P' T  R' h7 S& k, D! w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' I& g0 h4 G* e- @* k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# x  c, _2 y9 E9 d8 m% t

  67. $ Q* J5 p: |( S& a
  68. dma_addr_t dmaphyssrc1 = 0;- t) T6 I8 W0 @4 Q6 h& u8 W
  69. dma_addr_t dmaphyssrc2 = 0;9 u; Z( g  [! x8 @# s, P: V+ U
  70. dma_addr_t dmaphysdest1 = 0;3 I( Z6 n8 l0 m" D/ F# O
  71. dma_addr_t dmaphysdest2 = 0;% m7 ~; H- A. c# D$ n; K5 l
  72. 2 P: a# J$ f" K. i" W) _
  73. char *dmabufsrc1 = NULL;% i# N  q& N* z; J: X
  74. char *dmabufsrc2 = NULL;$ H) s8 b# u- B' X' D
  75. char *dmabufdest1 = NULL;
    6 \: W9 P: g1 v) B9 Y; g" ~. M3 d
  76. char *dmabufdest2 = NULL;# f. U. D4 Y  }
  77. , P3 F; X$ m+ y( ]! C
  78. static int acnt = 512;
    & L$ w' X6 A9 y+ h+ O
  79. static int bcnt = 8;8 P, y8 r2 n0 V$ ?
  80. static int ccnt = 8;
    ) r3 \0 @5 |7 l! e& O8 \
  81. : D+ n6 j. ]0 a. J4 [
  82. module_param(acnt, int, S_IRUGO);: \* s  T" b% D9 G* a0 S# z
  83. module_param(bcnt, int, S_IRUGO);- z) X' l! ]$ y- I$ Z1 `9 \. ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# M& M* B. Q' z1 T
5 a! v8 ]: t7 [9 [% Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  ^. [2 |) [4 d1 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Y4 \/ B% }6 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 `! W) W" R. ^: l4 P0 \7 W2 U$ m; C# T2 M% i
! e- r7 }7 S% P' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-2 05:22 , Processed in 0.036594 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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