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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: s" ]. C6 `# U0 m( g
  1. [code]EDMA sample test application
    3 V! j! Y+ j, k
  2. /*  F' R) R5 v9 U5 q0 `8 q& I& W
  3. * edma_test.c$ a3 `  N5 Q5 [2 m3 J
  4. *; c( G- ^& G+ o+ @  Z
  5. * brief  EDMA3 Test Application
    5 O: F- j# z' m! W8 S5 b
  6. *. {3 ^1 S$ Z% x& R: G
  7. *   This file contains EDMA3 Test code.& n3 q* |% T5 w/ X: L  }$ _
  8. *
    ! D, u4 J7 S5 b8 i7 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 Z! X* J4 E- b6 e4 s& H( ^3 f9 K, v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ c# p3 d0 ~; b# a* Q
  11. *         TO CHANGE.
    8 ~2 p: _6 w5 [: c2 p" Y4 X+ ~4 s4 t
  12. *) M6 S/ F2 O& X+ h( R" P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 x3 r. t* ~0 s& s
  14. *
    3 T4 n" _8 ~- c/ R0 V% l% w( r
  15. * This program is free software; you can redistribute it and/or! s! R6 i9 A8 v2 E
  16. * modify it under the terms of the GNU General Public License as
    : a3 d! x: Z. B' M! R
  17. * published by the Free Software Foundation version 2.3 Z' I# O$ I7 _/ \6 L1 H) O
  18. *
    ; p$ L+ M4 `2 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' A% n& |3 g. l/ d- e
  20. * kind, whether express or implied; without even the implied warranty
    ; V8 f0 m; e! x' O4 A, P/ p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% z9 v+ ~/ ^' d, m1 h+ B9 T( l
  22. * GNU General Public License for more details.2 t( W7 r, X  E# i3 s
  23. */2 l9 J! i' \/ L5 @  _
  24. ! I2 B/ F& ^/ y
  25. #include <linux/module.h>
    , s6 I0 `6 U2 L+ ?* J
  26. #include <linux/init.h>& w- ^  N2 t9 g3 L* y0 b. A
  27. #include <linux/errno.h>
    ! s: K) ~8 {8 V3 Y7 w1 S
  28. #include <linux/types.h>
    * f3 n1 X& V8 C5 G3 _
  29. #include <linux/interrupt.h>, S! C& a' \9 [/ E' G- b6 |- h9 y
  30. #include <asm/io.h>
    + Z2 v, E: M! L" u
  31. #include <linux/moduleparam.h>
    % j% e3 e# ?$ f+ A. Y, ~+ X$ X
  32. #include <linux/sysctl.h>7 \% X& K2 B( a5 S  F
  33. #include <linux/mm.h>
    ( M5 S0 F9 B- p& }6 C
  34. #include <linux/dma-mapping.h>6 x- j, A+ |2 L% a: O7 T

  35. ) P3 W: a6 F% Z% ~' z: n1 y8 Z+ Q
  36. #include <mach/memory.h>
    5 C( @; |2 q3 d) ~
  37. #include <mach/hardware.h>
    6 Z; G: c% s& Z* }6 q. V
  38. #include <mach/irqs.h>
    ( H3 s. O1 Y8 s/ @1 W# g( f
  39. #include <asm/hardware/edma.h>& ]' n9 d1 a8 e9 m$ m

  40. 3 m, V) u! T) t1 i# e
  41. #undef EDMA3_DEBUG
    # \; K7 u! Z7 u: Y+ Q
  42. /*#define EDMA3_DEBUG*/
    ! J0 v" u7 }! j* A+ I
  43. 5 J( t; f2 K1 P! a* C  p* h0 j
  44. #ifdef EDMA3_DEBUG& \" M) C4 g- G+ L# d# I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , j2 u; L, Q" \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      j& [/ g( L0 S) q$ k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 _* d: F$ G. a
  48. #else
    1 y; t, v- @7 Q6 g* P3 v9 N
  49. #define DMA_PRINTK( x... )! u/ ?* x; E1 D+ g) h
  50. #define DMA_FN_IN, q: o7 X6 S7 u: p; h5 Q9 I
  51. #define DMA_FN_OUT
    4 N* D7 V, a2 d
  52. #endif
    + D9 M: |% U: M+ T4 }1 A1 H! t- q
  53. . x9 c$ Q% B2 g; b3 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* P0 v1 j- Y/ p5 O  Q. @
  55. #define STATIC_SHIFT                3& u4 s, A8 Q3 J% z+ Q* {/ G
  56. #define TCINTEN_SHIFT               20
    # k- V5 ^, A* |, Q* \; K0 q
  57. #define ITCINTEN_SHIFT              21- n: X. p) [# T7 c% a9 k1 }
  58. #define TCCHEN_SHIFT                22: T% w. E) F" A6 M) V8 x% _
  59. #define ITCCHEN_SHIFT               23
    ' e& _2 T+ v2 S/ C' H6 O( q

  60. " d; I) z# S0 h( O5 E! w8 M0 j1 Y
  61. static volatile int irqraised1 = 0;6 m5 T% i+ S5 U3 W1 F# ^+ `
  62. static volatile int irqraised2 = 0;  i' Q& C7 j& x( j+ Z

  63. + |. w* o3 U2 f8 c9 A3 n- s; D# `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G; z# x$ G5 i, L, |7 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      g, t. `* S6 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {/ F; t' G. m2 a

  67. ; z" Y3 r$ ~' A: V& t6 j! H
  68. dma_addr_t dmaphyssrc1 = 0;9 Y) v3 W( v/ y. h0 c/ M
  69. dma_addr_t dmaphyssrc2 = 0;3 `' ?( `. C- ?$ T# c6 X2 G
  70. dma_addr_t dmaphysdest1 = 0;) V. R3 f% H  f. |- F4 n  J7 p
  71. dma_addr_t dmaphysdest2 = 0;
    % _( }  j# N, W  v" _

  72. ) G. N+ z/ _/ q! l3 m9 L6 x4 D
  73. char *dmabufsrc1 = NULL;
    7 O% A  [- G1 N6 O1 U
  74. char *dmabufsrc2 = NULL;. A1 ~# s! a6 [* Q
  75. char *dmabufdest1 = NULL;
    3 V8 I' m' D; ^3 A
  76. char *dmabufdest2 = NULL;, n0 V' \1 X" r# R' u3 x. P8 X
  77. 2 r* ?! s' w+ G
  78. static int acnt = 512;) X9 E. k2 l+ j* ]# \) h/ L
  79. static int bcnt = 8;% c% l9 ^8 o# P
  80. static int ccnt = 8;; S4 r& P3 P8 |

  81. 1 a, o1 \$ f& s4 M
  82. module_param(acnt, int, S_IRUGO);
    7 E4 Y0 H- e0 s- U
  83. module_param(bcnt, int, S_IRUGO);- A! e3 ^1 W, k4 v* x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ i) [1 D* \* h+ H( z- S: B1 f
" A, ^/ y/ j# ^0 n. J' T+ Z) n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* k# T6 M# G3 y% m; xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j8 s% W4 d* V7 q. T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 c3 X. w  V( Z' i, S4 Q' a2 C0 l% B% E' m, E
1 f( ]0 }6 L2 e  C# U$ S# q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 06:54 , Processed in 0.047003 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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