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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & I: C4 ^' w0 D0 W" v3 `; h) N
  1. [code]EDMA sample test application  R- I3 Y) A* f3 K; i- Z) Y
  2. /*
    9 G6 V1 W. R- L8 p, i& u: m
  3. * edma_test.c9 H' o& |& K+ S5 p) E0 L
  4. *
    0 |. z+ B3 o  t  a2 v1 t# I
  5. * brief  EDMA3 Test Application  L) C. e& q0 ]  q+ [
  6. ** c' @+ ?7 \4 b; m
  7. *   This file contains EDMA3 Test code.4 x) J1 b0 H$ G: H2 e
  8. *' i+ F+ W2 G) b$ s! G' w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% C2 {0 G4 I/ A4 _8 W; ~9 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Z' g" W0 k  t9 K; ~
  11. *         TO CHANGE.
    - T% T* W8 O7 i) N; }9 \, D" G; _. d  o
  12. *
    5 D/ f6 \/ g! t& E2 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 H# K: N5 \* I( _# z. U
  14. *
    6 }5 K4 `, V5 _8 `
  15. * This program is free software; you can redistribute it and/or1 ^+ H0 o; q1 \5 V6 [( n1 P# T- }
  16. * modify it under the terms of the GNU General Public License as
    ' h$ X" R# Y* Z* }( h
  17. * published by the Free Software Foundation version 2.3 S/ ^9 s8 H. q
  18. *- T8 Z, C4 ?: y# W( ?8 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      L) r2 f' f0 C$ v8 Y
  20. * kind, whether express or implied; without even the implied warranty- ^+ w* v# Q4 q" s, f  C: `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ p3 u( S) D/ x# o- j& S
  22. * GNU General Public License for more details.
    / q) v3 {! r5 ]! B" _6 B) t  f
  23. */
    # a( l2 I$ G3 p
  24. " x7 U- U' D/ T4 n
  25. #include <linux/module.h>
    5 c$ u1 D6 D& u9 P& v1 b% B
  26. #include <linux/init.h>, B- |) |' d/ B; M2 g7 z
  27. #include <linux/errno.h>
    ! g/ ^) C" T2 }, l" J& W
  28. #include <linux/types.h>" l. [, l! h: n0 |/ c$ z: y
  29. #include <linux/interrupt.h># A/ x4 f' R2 M' u* Y9 L/ p
  30. #include <asm/io.h>
    2 o2 @$ m0 {0 S  s, }; W. j
  31. #include <linux/moduleparam.h>: s- L; R+ `; L) x* m
  32. #include <linux/sysctl.h>
    * X: o& }0 f( }
  33. #include <linux/mm.h>
    6 J5 w2 h6 K6 O7 s
  34. #include <linux/dma-mapping.h>5 A3 H2 ?" s$ a1 Q2 y* R) t0 X
  35. 5 B; {( u. F' Y  i* l5 v" u
  36. #include <mach/memory.h>* G! {3 Z' w& r* N
  37. #include <mach/hardware.h>9 O6 D4 w/ V3 b7 o& R! R7 ?
  38. #include <mach/irqs.h>7 k: @8 Z0 L' J0 }  A2 d3 C
  39. #include <asm/hardware/edma.h>
    # `4 C* {8 d$ h  l3 F# Z

  40. + D7 `, H6 T# y) C& I. d
  41. #undef EDMA3_DEBUG# l* _6 `0 e0 I+ ], d+ `# s' W
  42. /*#define EDMA3_DEBUG*/
    , ~& B: q9 c$ M4 }" N6 _2 ~

  43.   D4 p; z4 Y2 }5 X: x
  44. #ifdef EDMA3_DEBUG
    ; `) G, z- a8 C) c) n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 Q( [: k# E, D* y7 [: d6 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) R, O& ^+ D. a; {, I; w& m* n- A: M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 W# A9 `, ^# A1 H) _0 G* U
  48. #else4 y" M5 L  L, y  ]/ @
  49. #define DMA_PRINTK( x... )
    / M; `% m+ T* t- t% |$ Y8 n/ G
  50. #define DMA_FN_IN6 `1 l2 z1 T, N3 `' {+ {
  51. #define DMA_FN_OUT0 n9 E; d. x; [! ~; E" c5 H
  52. #endif; t& q$ V. J" L3 A  P- Z5 V
  53.   {$ d8 G  @  Z8 p# z! |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / e- u) l6 b" Q
  55. #define STATIC_SHIFT                3
    6 a% V7 U" P& _  }
  56. #define TCINTEN_SHIFT               20; u- Q* O/ t' r2 A. i  k, D# T. S
  57. #define ITCINTEN_SHIFT              21, t2 P. o4 n" M
  58. #define TCCHEN_SHIFT                22
    7 Q* H+ O2 I+ I: }& }; D& S, j
  59. #define ITCCHEN_SHIFT               23, K, Z# O' R% G3 Z
  60. 6 m+ N* `, a0 _0 ?9 J4 \
  61. static volatile int irqraised1 = 0;
    " P; M) E! H  F) J7 V/ R. ]
  62. static volatile int irqraised2 = 0;
    % y( g' i! E6 U- [- T
  63. / W. b* f- x; b- X  H* W7 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n% Z7 _1 M# r5 @/ U' c) S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u+ I. B! N8 a& O5 V' e4 D9 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m2 g5 e* G/ u: Y

  67. 7 J/ e% s5 Q- u7 G, s. J5 ~
  68. dma_addr_t dmaphyssrc1 = 0;' X; G. a/ H4 ?7 G
  69. dma_addr_t dmaphyssrc2 = 0;
    , s7 k2 V. o, w8 v
  70. dma_addr_t dmaphysdest1 = 0;
    + N- w6 J+ q1 q7 y" D
  71. dma_addr_t dmaphysdest2 = 0;9 I  z' J3 {7 z& v+ ?$ n
  72. ( `4 k' e* M% ?
  73. char *dmabufsrc1 = NULL;, W. R7 |* Z3 c+ `( i. o/ i# w
  74. char *dmabufsrc2 = NULL;
    2 }1 d% Y9 M& x/ m( e* |' X
  75. char *dmabufdest1 = NULL;2 A0 C2 c4 H! k5 L! s
  76. char *dmabufdest2 = NULL;4 O2 P2 O$ `# f7 U" Q$ k. M9 D! b
  77. $ X, ~; C& m( r7 \7 y
  78. static int acnt = 512;
    : k1 g1 I4 ~2 H; {
  79. static int bcnt = 8;
    - E, k0 t7 W  K" e4 Z
  80. static int ccnt = 8;
    0 ^' @5 I. E( i6 O) K3 P' t

  81. . Q/ ~6 ?! r6 }" M6 D, `
  82. module_param(acnt, int, S_IRUGO);0 D! l9 z' k8 f- u# |% j
  83. module_param(bcnt, int, S_IRUGO);  F4 D" ^6 s4 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' s% M, B& k5 Z  V

! A7 [7 B% n( {# R! Q3 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 h9 X2 {+ h0 A6 }8 \5 j8 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% {/ x4 V6 c( t0 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# }% F4 \5 D7 g# h1 y1 q* Q  y

! K! e+ l9 h. P& y- x
3 a7 O- i; u1 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-10 02:00 , Processed in 0.040462 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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