OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' G0 }5 ~2 z0 B% \- r7 T; d
  1. [code]EDMA sample test application
    ( k' a2 q/ M9 n* e& t
  2. /*/ ~5 ], B' I' ^& I& j' r& o
  3. * edma_test.c. l% F, J0 a- Y, g( E1 L
  4. *
    8 u  I! g, [0 `3 ?) e% B# s* _$ i
  5. * brief  EDMA3 Test Application
    " G- B9 B* s8 Y: D
  6. *' U: Q6 }, m" I' v: o
  7. *   This file contains EDMA3 Test code.
      M% R1 e5 D- s5 f$ {. u
  8. *
    8 q( E+ N+ u( V. c% U5 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 b, Y- y9 f" R7 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # P* ~4 a! G5 D1 ]" y
  11. *         TO CHANGE.' S) _; b, a0 O( d
  12. *; G9 O/ W9 \! G7 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; f- E, x, R- M. P
  14. *
    % w9 x4 p" k: e2 H8 C3 x
  15. * This program is free software; you can redistribute it and/or
    - f$ m3 B+ ?0 v) T
  16. * modify it under the terms of the GNU General Public License as# P/ h; A/ N' `5 L! b
  17. * published by the Free Software Foundation version 2.
    6 G* A" J, P& c+ @
  18. *
    . }, D; n! P" N  m% G$ ?" \, _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 v! I, T- p) b; p$ R5 B2 w0 g" }( m
  20. * kind, whether express or implied; without even the implied warranty
    - g/ r0 ~- v' V2 u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % h  ^! a0 k' o
  22. * GNU General Public License for more details.
    8 ]+ ^+ N+ `8 U- p" c
  23. */
      p" J  H1 ^6 S5 y2 s5 E3 Z

  24. 8 N" |' l+ o3 Y5 j( B( o5 {' C* P
  25. #include <linux/module.h>
    ' p% o. {3 L9 t% ]' j% W$ d. Q, ^
  26. #include <linux/init.h>
    : k6 z  u  [% L& s
  27. #include <linux/errno.h>
    4 A8 t  \- {1 l. Z5 l) X6 U
  28. #include <linux/types.h>2 b! X+ C/ b, g, ^
  29. #include <linux/interrupt.h>
    % I9 P! W3 c4 P- j5 k2 O
  30. #include <asm/io.h>
    & k) n, G3 n  E9 L1 ^
  31. #include <linux/moduleparam.h>
    ( G5 t: ^& m! i3 C3 e
  32. #include <linux/sysctl.h>
    & M0 D. n6 q' y# I! H  a% t
  33. #include <linux/mm.h>6 D5 m+ o/ {/ a4 d  a
  34. #include <linux/dma-mapping.h>3 L" N1 m) \+ o! p8 o! i

  35. 0 n+ ~+ D9 [: b6 I, [/ l6 C
  36. #include <mach/memory.h>- B) i: e" ~3 d! H& L
  37. #include <mach/hardware.h>! f( S7 g; g, |1 }- Q: z3 Y2 G! c
  38. #include <mach/irqs.h>: A, S  N6 |8 w5 ~9 s
  39. #include <asm/hardware/edma.h>
    % b" d! z9 v, k

  40. 3 o4 V6 e) g6 t) B, n
  41. #undef EDMA3_DEBUG( N' W, [# |5 d% j
  42. /*#define EDMA3_DEBUG*/
    - N# h! F; B( D4 t0 h0 X8 R& }
  43. ( O2 m- c7 g9 |" [2 B! Z& t
  44. #ifdef EDMA3_DEBUG( P6 c4 K7 g$ u3 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& x' K* E' A! Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ B) S4 Q  A2 {" \9 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 v% z% W4 R& |$ T, O( J* p! }
  48. #else
    0 m; e4 g* a- `( y' {" R7 m) X. P, H
  49. #define DMA_PRINTK( x... )
    ( g" G" M4 c9 c2 X
  50. #define DMA_FN_IN
    $ W9 A0 ?" {6 L9 F) h, Q
  51. #define DMA_FN_OUT8 z$ @2 E, ~, I
  52. #endif
    : ~3 M  M* k3 z% K9 v& e# f. j' c( |

  53. : G% z* N+ _/ I' ]+ v% n& R+ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; ?" H8 {" R3 o) e1 `0 h- r
  55. #define STATIC_SHIFT                3; i" ?' m! Q' _) I6 |8 X
  56. #define TCINTEN_SHIFT               20# l  \! P6 ~- ]' z: D* _
  57. #define ITCINTEN_SHIFT              21! `1 w+ y1 Z5 }3 a- V
  58. #define TCCHEN_SHIFT                225 o% R: I' f5 V
  59. #define ITCCHEN_SHIFT               23
    3 V( s9 d* ]* _( i4 d! ~
  60. , ~) N! V0 ^1 p3 w: ?
  61. static volatile int irqraised1 = 0;1 x% Z, W6 Q* A
  62. static volatile int irqraised2 = 0;7 \- W+ q6 }4 `, g2 L
  63. # X) q. R7 C& Z4 x/ ^+ ?' B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `0 g) t. i  K$ i! H' ^7 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + S  ?- q( R$ F1 z8 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ z6 i0 O( P" o# ~1 B: d5 J# S5 l
  67. 5 d+ Q3 o* y1 e$ j- L
  68. dma_addr_t dmaphyssrc1 = 0;! a& R( E* R" ]9 V7 [% H% y5 s( |
  69. dma_addr_t dmaphyssrc2 = 0;7 m6 l# @8 _8 r$ V( h: {2 N
  70. dma_addr_t dmaphysdest1 = 0;
    : b/ E. ^2 m5 Z( i: ]) i. f3 a
  71. dma_addr_t dmaphysdest2 = 0;
      P9 ~7 b* X' f$ W9 r4 q

  72. 2 n( F8 |! i, d$ Z
  73. char *dmabufsrc1 = NULL;
    & _/ l" J4 {# R9 m& D) D$ E
  74. char *dmabufsrc2 = NULL;: J( t. V' g2 h) Q4 j# U8 I
  75. char *dmabufdest1 = NULL;
    / P1 y& s# }- v# M1 q
  76. char *dmabufdest2 = NULL;
    8 |( Q5 T  k1 E
  77. & X  F% g. p* r
  78. static int acnt = 512;
    / W5 z% V2 N! \8 Q) `( y$ t9 e5 Z3 A
  79. static int bcnt = 8;
    % Z7 `. C! F$ a, I6 m" F+ P. t: G/ p
  80. static int ccnt = 8;
    " a* L4 s7 T4 j8 I4 e( J

  81. # x0 @1 X# s2 r
  82. module_param(acnt, int, S_IRUGO);1 @6 o1 ?; {& T
  83. module_param(bcnt, int, S_IRUGO);
    7 D9 h7 ]1 a6 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 a1 Y) Z9 D! y$ K) L6 [! o* Y0 M, o/ v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( w* l5 I" @6 }, z; Sarm-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 ]( ~8 U. P* Q. l  o. H* n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) v, m7 y$ ]% g& t: ?! F2 |
6 [5 X/ l5 i( j. s
  \8 X7 ^9 v$ h8 y) {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 08:59 , Processed in 0.037675 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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