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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n4 a/ G* y; v% K- ]8 [+ j; P
  1. [code]EDMA sample test application
    6 t; A& g; ]! b
  2. /*
    # f- M$ j6 I" a
  3. * edma_test.c3 r) }+ I  I, [* A, s$ _
  4. *! R6 T3 I# h% k8 G
  5. * brief  EDMA3 Test Application
    4 y4 t  `5 N3 k- ~: x8 }
  6. *" k1 c' ?* S& k; \- J
  7. *   This file contains EDMA3 Test code.0 q' O& s5 X# z) v" A( Q) o3 @$ C
  8. *) V+ J+ \4 E! P! ]+ _3 h$ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      w) ]$ a- }. j* U; [: Z+ ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 y7 @- ?; }: ]- Q2 k1 }
  11. *         TO CHANGE.
    ; X5 a% b. ?# }
  12. ** Q$ Q$ B$ D! }5 q) j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( A# G" D* ?+ Y( e8 n7 v
  14. *
    3 {: X: X8 E$ l5 T% {3 x  Q
  15. * This program is free software; you can redistribute it and/or& @. F/ K6 Q2 |% X& V3 P
  16. * modify it under the terms of the GNU General Public License as9 e+ i8 X8 r, O+ w; z5 x
  17. * published by the Free Software Foundation version 2.1 B' w7 T7 Y/ {9 [/ P  ], z
  18. *: l- F: r. G; K2 ~5 M  L6 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. K/ Y3 P0 b( x5 F) S" @
  20. * kind, whether express or implied; without even the implied warranty) n; a8 K; q5 Z. f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& l0 z6 h& {, k* D+ e
  22. * GNU General Public License for more details., n  C  Y* E. V" {' a! R7 L' q
  23. */
    ( H& ~3 @% F% _5 t# I- q' r

  24. ! o! W9 w! x4 D, m% i3 f
  25. #include <linux/module.h>
    * a2 W' N6 i; a, n
  26. #include <linux/init.h>" a; A; _) X% S6 k# K
  27. #include <linux/errno.h>
    ) C% A7 r' B3 S. T& N. H
  28. #include <linux/types.h>
    1 W) u! T  q9 T+ w
  29. #include <linux/interrupt.h>
    9 N' K% y  M7 b0 J( s2 W
  30. #include <asm/io.h>+ g3 |8 [6 z$ K7 o0 I
  31. #include <linux/moduleparam.h>
    4 ^3 m$ k# i' [* e
  32. #include <linux/sysctl.h>
    / J; K- G" F4 G- V
  33. #include <linux/mm.h>
    & p( {+ R9 t1 J8 i) J/ }& e
  34. #include <linux/dma-mapping.h>
    % D/ J2 z' `, o! ~6 R  x! m8 l* X
  35. : A* Q* H9 P8 L8 _
  36. #include <mach/memory.h>
    ! c( O/ ?! V6 U5 v; |: t
  37. #include <mach/hardware.h>. F. V0 j. Q$ D1 n0 P; m, x) t
  38. #include <mach/irqs.h>
    0 B. l0 W2 F. L
  39. #include <asm/hardware/edma.h>% H: R, B+ n' s" O9 Y' a

  40. $ ~) s% Y: D8 H7 z; l
  41. #undef EDMA3_DEBUG
    0 h2 J+ A- i, s
  42. /*#define EDMA3_DEBUG*/
    - N- O6 m7 a- I0 B, N" a2 ?1 g

  43. , Z3 [: V* `& H7 A, I" j' w6 N
  44. #ifdef EDMA3_DEBUG
    5 n9 f8 N9 p& u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( o7 W. q& g' o& h% \9 t* d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; i: b; A5 [! v9 z' a$ p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ d5 C( O2 \) m$ T9 G
  48. #else' d) b* ?' h0 D3 x  b+ K
  49. #define DMA_PRINTK( x... )
    / S. t/ }- y! ]
  50. #define DMA_FN_IN
    5 z5 J% J" P" M3 s8 A
  51. #define DMA_FN_OUT
    + S' L/ O) y' w2 B' o1 m: m8 k
  52. #endif( ?0 G0 w2 l1 F' g* r. Z" z
  53. ! s- F: ^9 v# Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% |+ O2 \* i  M, h8 L5 s/ n) r$ ~
  55. #define STATIC_SHIFT                3
    : r( H9 ?7 R% t0 S; F
  56. #define TCINTEN_SHIFT               20
    / V9 ~" T$ m5 n  G6 k
  57. #define ITCINTEN_SHIFT              21
      K9 x. b. r+ ^% U* d
  58. #define TCCHEN_SHIFT                229 q; G" r  [# ^. M
  59. #define ITCCHEN_SHIFT               23# x* w; }" O9 W& ~0 V
  60. ' t- ]$ z! P& _4 c2 |
  61. static volatile int irqraised1 = 0;
    2 `3 J, K  ?8 P# X* k" U) g8 p) R
  62. static volatile int irqraised2 = 0;
    % \( I$ ]: ~# e2 _
  63. , B* _6 _+ q3 a5 \' q  P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?. w, {% b$ v" s8 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 c% o& i9 h) @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {" u( [( D3 ~! a, o" q

  67. 8 ]3 k1 n9 E2 A: f2 E
  68. dma_addr_t dmaphyssrc1 = 0;
    3 L. m, z  S0 [. ^0 O  `* Z
  69. dma_addr_t dmaphyssrc2 = 0;2 R5 s2 ^6 N5 N7 X) ]
  70. dma_addr_t dmaphysdest1 = 0;
    ' v& g; Z( e8 p- {6 Z/ r
  71. dma_addr_t dmaphysdest2 = 0;. {+ K  M* I+ @2 S6 u7 A
  72. , D' c2 t* F  O7 x7 `( ]
  73. char *dmabufsrc1 = NULL;
    $ P: [3 `( ^$ S3 z' n
  74. char *dmabufsrc2 = NULL;1 V5 ]! |9 x. A( y; \
  75. char *dmabufdest1 = NULL;( K2 |+ z8 y% }& i* J. Y% e; q$ d
  76. char *dmabufdest2 = NULL;* z3 @! b2 Z5 K+ x7 E& i% ~

  77. 2 D% y& Q6 v* `3 A! Z. e
  78. static int acnt = 512;. q8 B* }7 H; M
  79. static int bcnt = 8;- c/ n+ g, F5 Z  _9 \/ Q
  80. static int ccnt = 8;
    " ^5 \9 r1 a5 q. y7 ?

  81. 5 v2 B$ j# |( l* u# l0 @
  82. module_param(acnt, int, S_IRUGO);
    . }4 w4 a. a1 V$ ?2 m/ q: v+ t
  83. module_param(bcnt, int, S_IRUGO);8 n7 G9 E1 V/ \, O! R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! k$ F6 v; I9 l, q# W$ ]# ?4 m- P
3 Z% H( e/ q' o6 s0 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* v  N  D8 ^- m1 @6 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ R) J) F7 b( s2 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 O, N9 V8 N) I7 e8 k
& W% J2 `" B8 |

0 S- I+ u* e3 R# S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 20:34 , Processed in 0.040000 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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