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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / ^2 u, ?8 q6 V7 ~
  1. [code]EDMA sample test application
    1 ^$ S4 j8 Z6 S% R
  2. /*0 o; G& i8 V& M. E
  3. * edma_test.c& `+ e$ k( m  x4 Q3 R8 [' c
  4. *
    7 Z; L8 Y  ?2 N& Y% ]% l
  5. * brief  EDMA3 Test Application7 X0 T2 P" G4 U: I; L7 Y
  6. *' Y- S/ E  y0 O2 l% g# E
  7. *   This file contains EDMA3 Test code.
    " }' h4 P# v, l7 f! Y( V
  8. *; e7 P3 G+ e8 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  I% h% w% j& U" P* }0 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 m- ~: r" H6 l0 J- U9 ]
  11. *         TO CHANGE.
    0 u, l4 k) ]* ~' o- S
  12. *
    ! }3 h+ F/ b- U4 [0 b6 O3 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: x5 M% z# l; |* e! |
  14. */ c8 R5 J  r( m( }
  15. * This program is free software; you can redistribute it and/or
      |- o5 R" U; r, R  L: i
  16. * modify it under the terms of the GNU General Public License as* d3 y3 b8 C) M
  17. * published by the Free Software Foundation version 2., a% x2 S* e. c: X0 b- ^6 [5 W
  18. *
    ! f. E5 U7 [! z0 I! A6 _' q- Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 {$ z& L: [8 Z, U& `6 B( i
  20. * kind, whether express or implied; without even the implied warranty& M1 b; N; v' A2 j1 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% ~5 V: {% w0 [# A" }# O3 v  a) `+ K
  22. * GNU General Public License for more details.8 x* {& M8 Y8 R  I9 s0 }
  23. */
    9 d0 E* M1 p4 b3 H, I$ }
  24. 4 S) c* `1 F2 r2 v( a: b" Y1 r
  25. #include <linux/module.h>
      A+ }' f' w5 ]: w. V/ W
  26. #include <linux/init.h>5 {% L8 K8 A5 D; U* R5 K
  27. #include <linux/errno.h>
    # C- I/ B. n3 k, G/ O5 O
  28. #include <linux/types.h>
    . h2 L1 r0 I, D6 R# j
  29. #include <linux/interrupt.h>
    2 ^5 W7 o$ ?. o6 L
  30. #include <asm/io.h>
    + a7 n- @( M% {4 r- z0 ?4 Z$ @
  31. #include <linux/moduleparam.h>
    - D# S, D/ f0 ~: Z: V6 K
  32. #include <linux/sysctl.h>3 d/ ^# P6 Q' ^" {, ~
  33. #include <linux/mm.h>
    7 g! @3 i9 V2 ]/ }! K
  34. #include <linux/dma-mapping.h>
    , j# x& T- a& Y9 b( n

  35. % s" w: _# _5 N. W! i' G/ |
  36. #include <mach/memory.h>
    % f2 E3 C+ d- U! G+ \# [
  37. #include <mach/hardware.h>
    6 n, J& d& a4 @1 L9 b
  38. #include <mach/irqs.h>
    ' n. O. u0 n4 g7 e1 g) q
  39. #include <asm/hardware/edma.h>, c$ k& g+ G# s; X

  40. 6 @4 S% u, f: R6 b$ I
  41. #undef EDMA3_DEBUG6 d" \/ X  ]8 f- U9 F! Y& v
  42. /*#define EDMA3_DEBUG*/0 F7 s3 n& D$ X0 Z+ B% d1 k, w& N

  43. / Q5 B1 r) t3 b, _
  44. #ifdef EDMA3_DEBUG
    & |% p) K- ?1 o! r' W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # V. n9 @' i' r5 X$ J8 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 Z$ ]6 w  C# o& C+ m* X; Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 ~4 C" d! _! B& a7 n: k2 @( v
  48. #else
    / |. v" M$ g/ S6 `, V
  49. #define DMA_PRINTK( x... )
    & C& b' ~4 W! s
  50. #define DMA_FN_IN
    - x# S  ?, p8 `( e7 l5 q
  51. #define DMA_FN_OUT# \* m3 _, u( e7 U- R
  52. #endif/ g( m6 f) T7 v( H( p/ r# b

  53. % A/ [1 s0 u& G9 P$ A$ f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 G" z' M) Y) Z& T2 W
  55. #define STATIC_SHIFT                3* v' q" B' _( R* H" L  Z; K7 d! W
  56. #define TCINTEN_SHIFT               20
    ! r- e2 p: |6 B% ~$ K
  57. #define ITCINTEN_SHIFT              219 y: g/ D6 u, c, `8 C
  58. #define TCCHEN_SHIFT                22+ H2 E8 s3 S. }4 {, t
  59. #define ITCCHEN_SHIFT               23
    # k, n/ G' D  J. S

  60. ( _; [( r! ]4 R
  61. static volatile int irqraised1 = 0;
    / _& n# j( k8 ~& N* W7 u
  62. static volatile int irqraised2 = 0;: w: D; n0 y4 _! d1 c; V+ W8 {9 n
  63. ) ^) l9 {4 m1 s# n, w5 x4 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " K, n) h% B/ }. X; c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 v4 U: x+ o( B2 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [. ?# G& m; N0 H! @

  67. 8 c0 b/ D' R* T, Y+ k8 l0 Z+ T
  68. dma_addr_t dmaphyssrc1 = 0;) c: ]( b$ B/ k2 S) w% ~/ N  [; W# K
  69. dma_addr_t dmaphyssrc2 = 0;( f/ Z, p/ O5 \/ C6 y; x, {
  70. dma_addr_t dmaphysdest1 = 0;5 ]1 t/ }" c9 x4 ~- m$ e
  71. dma_addr_t dmaphysdest2 = 0;+ g2 W- n! R# A3 M. g1 L6 a
  72. 5 a& Q# B+ W5 T- S! h
  73. char *dmabufsrc1 = NULL;
    ) D) F- S+ r7 s# ^1 {( h
  74. char *dmabufsrc2 = NULL;
    + {: `  g6 `: n
  75. char *dmabufdest1 = NULL;
    / c1 j+ r: g- K. M5 V( a- ^
  76. char *dmabufdest2 = NULL;0 P( t: e: N9 v8 ?' u
  77. # @/ d6 X3 T) j9 W# C
  78. static int acnt = 512;
      z2 N1 M0 J5 H( g
  79. static int bcnt = 8;2 p6 X( A; p9 a& d' p% W
  80. static int ccnt = 8;
    3 W# M3 H/ t) x$ H+ j5 }# B+ R# A6 \7 {

  81. / M  ]' V% e- d+ v
  82. module_param(acnt, int, S_IRUGO);* e6 j% m: _, g2 v. l* }
  83. module_param(bcnt, int, S_IRUGO);
    9 `& L. ~% K  s& F6 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 W% \  U& I" u) P2 D. p) `8 @6 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* J  S0 v/ w0 `) Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" t2 Z- n. v# j. S5 Y' O0 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ d8 A' c# P6 W9 F
" f8 x: O% K9 R* J
, u6 w# Q0 E5 O, n7 t* k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 13:22 , Processed in 0.041524 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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