OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 B1 I( T' p  H% B4 T. E
  1. [code]EDMA sample test application
    , u5 z# i" I+ s7 x: r4 L5 f
  2. /*
    # h: O# k( t' V( v& q" e
  3. * edma_test.c
    + {; T( C% Q: J3 Q- C; H
  4. *
    ; V9 H$ H, q  ~' O7 ]/ H; W2 |
  5. * brief  EDMA3 Test Application  @) {7 J4 W; B& y$ E% C+ }
  6. *' C7 p7 s" C( b+ s6 W: I2 x7 y
  7. *   This file contains EDMA3 Test code./ T7 `5 d' p; j6 z( \( l- F
  8. *
    / i1 {$ \+ r/ Y; q7 x: @; {1 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 K1 O0 T. _# }' |' F4 G) e; p1 e1 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B. v" E1 t$ U/ V
  11. *         TO CHANGE.
    + _, y' ]2 s1 {8 L+ k( t
  12. *
    " p+ J2 p. x8 [7 Y' r# ?1 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 t' p9 J$ U, X. w4 C" P; c  c
  14. *
    ( Q% G2 @% l0 a* y6 J
  15. * This program is free software; you can redistribute it and/or
    ' G+ L1 `* T9 f) e7 p3 z, p3 J9 t
  16. * modify it under the terms of the GNU General Public License as
    % H* q8 F; \9 J0 d, n
  17. * published by the Free Software Foundation version 2.
    + @0 e5 T- D" a$ `* t
  18. *  R  S: {/ S0 E9 w9 }9 y+ ~/ K. q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & Y6 z2 g0 f$ I, }& L0 T
  20. * kind, whether express or implied; without even the implied warranty
    , Q  M2 ^+ G% T; ]" R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . s& P2 [* ^; v, z
  22. * GNU General Public License for more details.8 z1 O, }- ]/ ^
  23. */% [6 O7 W, L8 X& d, A

  24. % Z7 ]/ Y1 ?; z& k! @- d
  25. #include <linux/module.h>0 U0 p+ L' \+ \% c, Q
  26. #include <linux/init.h>9 r8 ?: ^' x+ H" o9 y) M2 z1 v
  27. #include <linux/errno.h>
      S/ d. m/ U! U" ]5 Y& H) B  ]
  28. #include <linux/types.h>  T* R, j( v4 ]2 q, w+ D* ?
  29. #include <linux/interrupt.h>
    ; {; w6 j+ ]! \* m
  30. #include <asm/io.h>
    + C, E6 ?9 i" O% @" d3 e* R! i" |
  31. #include <linux/moduleparam.h>
    & w3 e6 P7 I  i- s! [
  32. #include <linux/sysctl.h>! P$ c: e8 w9 [5 h- t' \
  33. #include <linux/mm.h>
    : o  S9 |5 o3 h: P( C8 _# o" G
  34. #include <linux/dma-mapping.h>$ `& d6 e" S) k9 _
  35. 6 s9 c0 H9 w* K/ V* o2 d
  36. #include <mach/memory.h>, C9 N0 d; _# z# C9 t
  37. #include <mach/hardware.h>6 ]5 Z- e4 O) t1 D* T
  38. #include <mach/irqs.h>& Q) U4 j9 P' O: H3 j) m, [
  39. #include <asm/hardware/edma.h>, _3 K3 ^  @6 f- f

  40. * e0 O. `; B9 ?8 c
  41. #undef EDMA3_DEBUG
    9 H; x1 V2 i* i( ]
  42. /*#define EDMA3_DEBUG*/
    % m" j: a) r8 k$ T  S0 J8 b' Q# `
  43.   v- e( [0 Z6 V3 n. J0 q% m  Z
  44. #ifdef EDMA3_DEBUG
    , \  z9 x; n  s, O" K) A$ C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : d9 I/ h7 v# F7 E4 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" q2 ^) w9 c9 D; J5 x% D& o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & h8 z* K9 [' Z6 O) B
  48. #else5 Z& t4 u; N4 e6 H5 \7 z4 `
  49. #define DMA_PRINTK( x... )# q3 \5 A" v' X! y1 Y* Q
  50. #define DMA_FN_IN0 _  U0 A* Z3 b3 N" N% N* {
  51. #define DMA_FN_OUT1 T+ E! S8 ~+ A, v& |/ E
  52. #endif
    2 e' q4 {$ E9 @( {

  53. ' R: s6 A; G6 Y0 K, J! [; w7 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + N1 t* z8 t4 c( s2 T/ I5 z
  55. #define STATIC_SHIFT                3! T& t! b3 A0 s$ T( R+ V
  56. #define TCINTEN_SHIFT               207 t# D1 N7 k2 x- N
  57. #define ITCINTEN_SHIFT              210 G$ r3 J2 B4 y
  58. #define TCCHEN_SHIFT                22) T; a  F; \% ?4 i4 E7 i
  59. #define ITCCHEN_SHIFT               23
    ( V$ }7 G; T. e' L4 \6 x
  60. 4 o0 b: ]1 |# O% X5 K# G
  61. static volatile int irqraised1 = 0;6 E& i; e" T; R/ p/ Z% g, C
  62. static volatile int irqraised2 = 0;
    + H- K8 X0 z2 p0 h  ^8 F6 t" e

  63. " P9 w) y8 ?: E2 W9 t) b4 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 z' X9 H, |1 a7 U- q% q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x: y8 J3 ^: p2 q' |, E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 K% q2 \8 g8 O! p7 I' [
  67. 6 n: u4 C$ A' R3 p+ ^
  68. dma_addr_t dmaphyssrc1 = 0;* }7 }6 f; J" F4 Q9 ~3 v& ]4 c, L
  69. dma_addr_t dmaphyssrc2 = 0;9 i. _: b( B1 R- i6 j
  70. dma_addr_t dmaphysdest1 = 0;
    " j; l7 a* M  M; ]0 Z5 W5 J, _. n0 P
  71. dma_addr_t dmaphysdest2 = 0;7 L; X% E; I0 O1 f6 x$ b% |; |4 O

  72. $ v; g/ n- F! r  @$ ?; r  A% I
  73. char *dmabufsrc1 = NULL;
    1 y; \7 W" P# P5 K
  74. char *dmabufsrc2 = NULL;
    / m. q. ^. {( ^. }. W4 \  d# m
  75. char *dmabufdest1 = NULL;. B" {1 t! }0 w6 f
  76. char *dmabufdest2 = NULL;+ q7 r4 Z1 w2 p
  77. ! v  g3 r, Q. V" L3 m, k8 G1 {
  78. static int acnt = 512;5 U+ l' q0 L' M. g9 D$ A2 E
  79. static int bcnt = 8;* g% C. d+ w2 d8 @, v, B
  80. static int ccnt = 8;
    2 O3 e, \" C$ }, j  S+ ~
  81. ( L0 J. B- b6 k8 }8 k
  82. module_param(acnt, int, S_IRUGO);6 i# h* m2 ]' }, j+ }" y8 P
  83. module_param(bcnt, int, S_IRUGO);
    . k2 W- x  A% p! `  _; c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; |  w5 t+ W. X; a& f+ }/ a( S4 z" z* H& ]/ @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 V" o) \+ d# u( Y8 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 R/ F- r' J& `2 {1 N+ }% }7 Q; k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! [7 C' B3 m" D9 p4 c6 B" U
" |( d* A1 @& i
) w; s7 @# q- d& q/ U" w& O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-3 05:13 , Processed in 0.038927 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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