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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 _4 d0 J0 z0 p6 u; D7 l
  1. [code]EDMA sample test application; _2 _7 u+ M2 E9 O  i7 J
  2. /*7 @  [2 h$ A& ~& }4 k0 P5 [, v
  3. * edma_test.c
    ( x( F' h6 Q2 y8 B! i
  4. *
    ! E3 r1 ?8 B/ F& @* S* k5 }6 K
  5. * brief  EDMA3 Test Application9 R- a$ C4 O) s
  6. *7 [8 O- {* `  Q5 M. U
  7. *   This file contains EDMA3 Test code.
    5 Y6 u9 P8 {( i2 k0 `1 u8 n
  8. *
    + |  W8 r# S% f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 s8 c% ~5 X2 {, J& j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' D1 \( i. q, d+ ~9 [. \- l9 }
  11. *         TO CHANGE.
    7 w& n: s; N( e4 U* K
  12. *) E7 p' h! z, C. q0 z7 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  u; I2 P8 j: Q9 ~4 s
  14. *9 i6 U7 U( I/ p6 ]' V% o
  15. * This program is free software; you can redistribute it and/or
    0 ~+ E  i3 _3 W: N; ]% U& o
  16. * modify it under the terms of the GNU General Public License as
    3 N9 s. k0 e/ _, o
  17. * published by the Free Software Foundation version 2.
    * o' R: Y1 |' F8 h, [, M6 `
  18. *9 ^  s" K6 Q5 q/ W: C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ~1 s+ d3 B% R3 h1 w# A7 }- z
  20. * kind, whether express or implied; without even the implied warranty  X. H0 Q& d, V% X4 D& A5 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      r& }1 g4 w- {0 u
  22. * GNU General Public License for more details.
    + T1 G( b8 W+ b6 J( h- f
  23. */5 S# S4 L$ z6 A5 T- R) |2 u
  24. * E. Q1 n* ]1 ^: S
  25. #include <linux/module.h>
    * h* d  J& }; e1 T5 }! k
  26. #include <linux/init.h>+ @/ f" i+ L3 Y$ n
  27. #include <linux/errno.h>& f) L. M! C4 Y) }" b
  28. #include <linux/types.h>
    : b: y( V  t9 [4 G/ T  b
  29. #include <linux/interrupt.h>
    : ]0 w, C- y5 x3 F7 ^- E8 k3 f" C
  30. #include <asm/io.h>! C+ k4 G% _5 }4 m$ n0 Q
  31. #include <linux/moduleparam.h>/ V" r$ n. J0 _  a/ M
  32. #include <linux/sysctl.h>) q+ _* \( c: [3 w6 ^. J
  33. #include <linux/mm.h>4 S6 S. C& i5 M5 }" X$ ~
  34. #include <linux/dma-mapping.h>
    8 R& T- L$ U2 z0 ~: M& l
  35. 9 G3 A$ o0 G" j$ A3 _! k
  36. #include <mach/memory.h>
    ; [: h4 _" \- A1 U5 M9 D4 F2 r
  37. #include <mach/hardware.h>$ G* `) a; f9 Y; Q
  38. #include <mach/irqs.h>( W. J7 P5 \; e  w( [+ C1 B
  39. #include <asm/hardware/edma.h>
    5 Y7 A/ W* x  r. _
  40. - e* ?9 l2 C9 |; F1 W5 v$ D
  41. #undef EDMA3_DEBUG
    , ^4 `- |& I# M( ]2 x3 j, P
  42. /*#define EDMA3_DEBUG*/1 L( E2 {) |' c9 y% K8 d) X
  43. - {2 s- a1 R; L! ^8 L
  44. #ifdef EDMA3_DEBUG3 [+ u3 b& \0 e9 I* J" T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 `0 \3 H" x1 Q. s# z  f/ M+ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 K! u: D% ~( v5 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! F1 q+ ^/ T0 J8 r: M" c' c
  48. #else
    8 J9 ~7 R* c1 i: x' I# S& T0 u
  49. #define DMA_PRINTK( x... )! F! J6 ^2 s5 U) }& P8 k. s
  50. #define DMA_FN_IN
    2 m$ r7 `7 u' ]5 |" k
  51. #define DMA_FN_OUT
    . Q" C) M0 ~. V3 C
  52. #endif' o, B7 e2 u5 n! S
  53. . l% p$ c0 U5 {6 q: L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' L$ O8 f, I. Z9 y9 u0 q( s
  55. #define STATIC_SHIFT                3. K! G3 k: r+ l+ J7 \' a2 d
  56. #define TCINTEN_SHIFT               205 q- w2 x. ]5 X) G% T: {
  57. #define ITCINTEN_SHIFT              21
    , I! Q. e% W" a; X) B) L* y" j
  58. #define TCCHEN_SHIFT                224 B( k/ ]$ I0 r3 _7 K3 I8 X) h
  59. #define ITCCHEN_SHIFT               23+ n4 ~! |% D0 C7 z

  60. % Z! o/ ~( [$ G2 M
  61. static volatile int irqraised1 = 0;
    - w8 L# o1 ?, t. ^7 k5 ~, x
  62. static volatile int irqraised2 = 0;
    7 |: V$ C. M( W6 w0 D& j' b8 }
  63. 2 B  t- A- L( Y- H# B; j  R5 i8 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b6 [8 V# }, a- J) F/ \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# r2 k( T% V" S0 m+ \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 M0 n- ]4 r& T. ~* v$ O8 B

  67. 6 O( J( j/ ^" t3 u. l" B" u
  68. dma_addr_t dmaphyssrc1 = 0;$ ?- ~9 E7 V( p" u" k4 w' z! B
  69. dma_addr_t dmaphyssrc2 = 0;
    , K' {& }2 }  }2 n( i2 q, j  M# [0 x
  70. dma_addr_t dmaphysdest1 = 0;
    1 ?# \' ~- N! t) L. o- o" S6 E
  71. dma_addr_t dmaphysdest2 = 0;( ]7 S# J) d( B( R' d5 k  W

  72. 9 ?5 X3 i. o9 s: j* x5 J: {
  73. char *dmabufsrc1 = NULL;
    1 L8 ^' k3 Z  L3 w  _; M
  74. char *dmabufsrc2 = NULL;# P- {6 w3 I3 E9 h4 H. f1 S
  75. char *dmabufdest1 = NULL;
    $ O4 j1 L: ^/ d( L: Z9 F
  76. char *dmabufdest2 = NULL;
    8 w( R6 ^+ ^- h. c" D/ s- \

  77. 6 `1 x& Z/ \  V) \4 R7 I  S
  78. static int acnt = 512;
    ; O: e- O! U  ?5 d
  79. static int bcnt = 8;
    9 ]: L8 i7 O, v1 }- M
  80. static int ccnt = 8;
    5 W+ U" g3 W) z, H' m

  81. . h$ D) Q; P  J
  82. module_param(acnt, int, S_IRUGO);
    : o6 i) _5 ~6 u$ g4 ^
  83. module_param(bcnt, int, S_IRUGO);
    1 b' Z5 B# ]* n/ x8 q, D9 b  _" c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; c5 \, n: I3 e3 A
5 k6 V1 G8 p& `6 o3 D2 x" r  f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 D8 I4 ]3 D" |: q* U' A1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ~5 k: J* e- O/ B7 f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 M; ?, d9 L. c* f& Z1 `! c
! S1 i& Q# `3 i# a, a8 P$ a" a
# O% M+ k1 q; C, N4 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 22:14 , Processed in 0.040907 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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