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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - S8 N5 ~! l0 I) |1 |. H; [3 ^& J
  1. [code]EDMA sample test application
    ) t- \0 X- \  Z$ h7 u+ _  S$ _
  2. /*( y; l, e) J7 A/ l4 c- P, `
  3. * edma_test.c. b5 m* {: n% \
  4. *
    ( D: s4 v- g# d5 x" [; }! x+ U0 x
  5. * brief  EDMA3 Test Application
    8 F4 @& e( z+ z+ s) T% E/ U" p7 A
  6. *
    ( v; L1 k9 S" {2 I1 K
  7. *   This file contains EDMA3 Test code.; N: B1 t, v) D0 h- z3 D9 O
  8. *" t, W" o$ P: V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# L% f$ X6 P8 q" H9 ]6 n# y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Y: s* J' k- p: |, O) n" l3 n0 S4 X/ {
  11. *         TO CHANGE.
    ' a1 b  ^; a- M1 f4 a0 e* |, A
  12. *
    8 N$ A( H% Q0 u( P: ?9 Q1 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ {% D$ Z3 L# i
  14. ** I# N) a. B% i( b# y( M5 {7 f- h: ]% x
  15. * This program is free software; you can redistribute it and/or" n. X' P( U/ U: n& D6 \) P
  16. * modify it under the terms of the GNU General Public License as" f* w7 J" a. d) o* v& g) l0 c
  17. * published by the Free Software Foundation version 2.
    ; v0 S3 c9 p0 }8 l
  18. *
    ' t/ Q: V' ?8 J2 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # T% {' x: C( a- Z2 \
  20. * kind, whether express or implied; without even the implied warranty6 s0 x7 o: R- @: c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' M! S; Q: J6 u+ d! R; P) L$ e4 ?
  22. * GNU General Public License for more details.
      Q' D/ t, H  j' S# k1 I5 X
  23. */
    & p0 w! l% W: _! Y. L0 |
  24. 4 M" ~  o$ q5 a3 a: g
  25. #include <linux/module.h>
    % n% n. z% B* _9 P: |7 E# ?7 J
  26. #include <linux/init.h>
    * V( r: A3 t3 x4 Z( B
  27. #include <linux/errno.h>
    & O* u# M" X% Q3 U! q1 L
  28. #include <linux/types.h>
    $ q$ w" ]1 _) E
  29. #include <linux/interrupt.h>  [' g9 b% u# x: K% O& g% B
  30. #include <asm/io.h>4 ~" ^. V$ X+ l6 `7 q
  31. #include <linux/moduleparam.h>
    0 Q1 O/ s+ W$ f6 a# N3 l
  32. #include <linux/sysctl.h>' p, Q. r, N9 t: e4 @( |1 b: a
  33. #include <linux/mm.h>2 ?! G' c: q* S2 f4 z% A* u5 x
  34. #include <linux/dma-mapping.h>4 o9 C& W5 |) B) C7 u7 j4 u( l& f
  35. 6 N' c* A# E$ n# t( T
  36. #include <mach/memory.h>4 a! u; g7 P% f& p# U
  37. #include <mach/hardware.h>
    * Q- _& E+ A4 t  H. D! M) x- a1 H
  38. #include <mach/irqs.h>
    # s, }  `, u6 y9 S
  39. #include <asm/hardware/edma.h>
    / t/ C& Z6 a  b$ p: _7 f

  40.   O" S; N+ k0 f6 ^
  41. #undef EDMA3_DEBUG
    9 A1 Y7 G. f/ k5 ^/ r
  42. /*#define EDMA3_DEBUG*/
    , ]* i3 t- r6 ]! ]6 q) N

  43. 2 e2 P( h4 j- @& @% F' Z( b$ Y, V
  44. #ifdef EDMA3_DEBUG
    " H9 t6 `, ~- v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- w1 C* x5 q5 A5 }- m2 E9 j) d2 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / A! @! K' w0 r$ O5 v! X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 W( r! R# U2 f8 E' B
  48. #else6 z+ \: k9 F9 O- k" p
  49. #define DMA_PRINTK( x... )
    : c0 G. J. l6 M5 q1 x3 Y
  50. #define DMA_FN_IN
    1 U  H8 x, V/ P7 Z5 ~' [
  51. #define DMA_FN_OUT
    # x5 G: |' f0 R7 p, \
  52. #endif
    & N) f8 C: a: ^; |8 Q6 N
  53. % d' p: N0 I7 h6 d7 Q+ j$ j, t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , i  A2 o, k6 v, L, D9 y/ i
  55. #define STATIC_SHIFT                3
    : c/ R/ L1 `7 F6 M  M) r: L# s
  56. #define TCINTEN_SHIFT               20- ]3 ^1 M. M( A7 x
  57. #define ITCINTEN_SHIFT              21
    ! S9 ^6 Q! R4 H, @8 G
  58. #define TCCHEN_SHIFT                22% Q, ^) x; e0 i
  59. #define ITCCHEN_SHIFT               23/ I5 T0 p) v# w! E, P; u7 }% i
  60. : ~) q0 m$ ?& _8 P) u
  61. static volatile int irqraised1 = 0;8 `' H: p& r+ K8 P" g, ~8 G
  62. static volatile int irqraised2 = 0;
    - Z. ^0 N3 C5 u: c6 j
  63. : ]2 k/ R& A3 _& y4 V# k' {: E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . s/ ]: S& n9 z$ [7 C( \. m  |  b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : n4 f( ?# y8 l; T" X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: C7 D$ W# V( S  R3 P" r- U: E

  67. + |6 H% S0 Q6 _, I+ l
  68. dma_addr_t dmaphyssrc1 = 0;
    4 Y. w- L: v. W& B; m; \  V& Q
  69. dma_addr_t dmaphyssrc2 = 0;7 \4 Y& H& X0 U- ~: w
  70. dma_addr_t dmaphysdest1 = 0;
    % ]0 S8 c0 r; r1 E& |. @
  71. dma_addr_t dmaphysdest2 = 0;3 [. D& i+ ^' }; X4 X

  72. + D4 l# z) {4 x' a' [
  73. char *dmabufsrc1 = NULL;4 Q4 i: B! l* O0 o, O
  74. char *dmabufsrc2 = NULL;& L5 Q) B# ?+ M, i! ^
  75. char *dmabufdest1 = NULL;/ ?6 W9 I7 g" K( U% ^
  76. char *dmabufdest2 = NULL;
    7 a% D  K5 r+ G: j
  77. 1 P7 G% C$ k% U2 d/ x" ]- C  N
  78. static int acnt = 512;5 ]# V4 ?( x8 k% s' Z0 B
  79. static int bcnt = 8;5 m" W0 U4 `: E, |0 v
  80. static int ccnt = 8;
    # g7 v: |+ ~. P: C
  81. / e0 U( ^4 U3 k( R9 `0 ?/ r" t; j
  82. module_param(acnt, int, S_IRUGO);
    8 `4 A8 ^' o$ G% @% K6 s
  83. module_param(bcnt, int, S_IRUGO);
    ; M5 y& g/ T6 X) ~1 p  o; C: u$ p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) h& i1 b+ l6 v! y4 G7 |& t
- o2 l, u8 u$ d- U: Y# h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B% T" z% A0 D" w: Darm-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 G* ]/ t+ J/ a3 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% x* d# [. c( k7 o4 D& |% r) p$ }8 c, D( J
! F: v" s4 I! r/ _* Z" D; F, \( {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 19:14 , Processed in 0.036934 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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