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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, s, m- F- u4 u$ N5 B' m
  1. [code]EDMA sample test application  Q# }: r' X1 R. A: d. n9 k
  2. /*4 q- `0 Q+ Z3 Y) \/ S  e$ ~0 z6 r4 ~
  3. * edma_test.c
    , v. r0 f. w0 _! ~. R
  4. *
    9 f. h; F6 [, `& H: p% J! |! e5 d
  5. * brief  EDMA3 Test Application1 o3 l" R9 Y$ x2 n# N% {4 D* ^, D
  6. *
    & e$ J4 \4 \% y7 D" j" j2 }4 ?0 X5 i
  7. *   This file contains EDMA3 Test code.
    4 l7 ?8 y  h$ B
  8. *
    5 H$ v; f4 A- e4 V, A2 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 i" G$ e, q2 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 C# A+ c; _% c9 v& a+ }
  11. *         TO CHANGE.# k9 Q) ?3 W% ]
  12. *
    4 j2 m6 z; E( w( z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , `6 t! v/ t  W1 ~( {* [% L
  14. *
    & P# ^3 {) I5 H' f6 }
  15. * This program is free software; you can redistribute it and/or
    ; s. X$ t1 y  @" Z% Z- b! v
  16. * modify it under the terms of the GNU General Public License as
    0 q2 g$ S& ~7 s  I
  17. * published by the Free Software Foundation version 2.
    + L6 Z1 ^7 @' O9 x3 ]* o
  18. *
    5 s) s8 J! U6 v% ?9 \' c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 ~/ N' U/ w& ~( w
  20. * kind, whether express or implied; without even the implied warranty
    & f, X1 ?' I0 R* U) i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 }' {6 [1 q% {' k  h
  22. * GNU General Public License for more details.
    ; B) a5 t  X, S+ p( Z: q
  23. */
    : ]8 L8 L) z: X) V$ D6 u

  24. ' c( J+ r1 Q0 x3 n
  25. #include <linux/module.h>
    & h$ i+ @, _4 Z
  26. #include <linux/init.h>, t- u9 t  S# r
  27. #include <linux/errno.h>! t6 P4 ]+ }9 z$ z8 e( ~  j
  28. #include <linux/types.h>' G+ Q) _. n" e* |
  29. #include <linux/interrupt.h>2 n% O* }- F' m4 H/ W: X* Y- e
  30. #include <asm/io.h>5 E2 w& U5 q4 ]2 f2 m5 I3 ^
  31. #include <linux/moduleparam.h>$ `' A/ |- \: j) v) \1 u
  32. #include <linux/sysctl.h>$ G6 n8 b, e* P# h! v, J) u
  33. #include <linux/mm.h>0 D9 B6 O+ J1 x+ }
  34. #include <linux/dma-mapping.h>2 ~3 u% P: }: A2 q4 r; \3 C

  35. * u: z5 |) e* ^
  36. #include <mach/memory.h>$ z% J8 c8 A# X
  37. #include <mach/hardware.h>5 O; y3 p, k$ K: v" d
  38. #include <mach/irqs.h>
    4 A* R& t9 a; c2 t: e  m
  39. #include <asm/hardware/edma.h>% k) M% C9 D! K: E3 I
  40. ' h) [4 w) s& d- q) T3 Z
  41. #undef EDMA3_DEBUG# q! J: d1 ]1 i: x
  42. /*#define EDMA3_DEBUG*/$ [+ {) P! T( `% y7 Q
  43. . g8 c) X1 S/ W# J  ^" ]$ V
  44. #ifdef EDMA3_DEBUG
    + t" ^; r. m, `2 g. n8 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 D8 R. t8 P2 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- [( {. @' ^$ D2 u& k, A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), ^+ n& L* @6 M
  48. #else
    ; q$ ]7 U- {& E- c2 M: j$ J
  49. #define DMA_PRINTK( x... )
    " z! J- D0 F% o& k# V9 ^! _: E
  50. #define DMA_FN_IN
    & e' w- R3 F" j1 P- g/ L0 l3 T( _
  51. #define DMA_FN_OUT, _9 M( [7 _. u: d0 [6 M% _
  52. #endif9 e2 b, J# l+ P& a/ P1 S, X, ~

  53. ! u! G" H, R) J4 V5 Y$ w% j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # ~& E  L4 ~) A2 J
  55. #define STATIC_SHIFT                38 B- M, ?) O( M' e5 Z# O6 m
  56. #define TCINTEN_SHIFT               20) x" G1 i+ u; d9 `. J% G
  57. #define ITCINTEN_SHIFT              21
    ' y( x! m& B$ v7 q8 B$ ?
  58. #define TCCHEN_SHIFT                22
    8 U) s2 a0 s/ K# ?6 n. B
  59. #define ITCCHEN_SHIFT               23& V9 C# s; v" F, O; }2 j  B! F
  60. 5 M+ U- ^, ~2 B9 U1 n/ S9 G0 c4 e* X+ \9 @
  61. static volatile int irqraised1 = 0;
    8 [. U( q' H  h% y- ~7 V
  62. static volatile int irqraised2 = 0;4 H8 B% F/ j) u5 y, C
  63. / w" I5 o- D  s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' J0 c" f% W. }9 ~6 f6 t6 ?/ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' F/ A4 l4 _5 j! R; Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' W& e$ ]% Q5 x8 D' m
  67. * g8 x7 A: I! C5 W' }  C
  68. dma_addr_t dmaphyssrc1 = 0;
    $ f/ O; @2 j( h) k* }
  69. dma_addr_t dmaphyssrc2 = 0;/ h7 |& E+ w% T, _; o' i6 w
  70. dma_addr_t dmaphysdest1 = 0;! ~8 }. L; ^+ @5 ?
  71. dma_addr_t dmaphysdest2 = 0;
    2 u5 ]/ d# u$ g  Z- M# d5 r& t

  72. ' i6 m& l2 L! m* n* }, Z3 A& V& ]
  73. char *dmabufsrc1 = NULL;
    ( E" ~" n7 Z0 r) f
  74. char *dmabufsrc2 = NULL;
    6 l/ }9 [( H# N& q- L0 e- p: W2 J
  75. char *dmabufdest1 = NULL;
    3 K! n% D/ J1 ?/ R# q/ Q( L
  76. char *dmabufdest2 = NULL;
    7 O1 [2 E0 W5 _! w8 u2 u3 P2 S+ A

  77. 3 ~5 \4 x9 f* R4 X* k) J, U
  78. static int acnt = 512;
    ' s2 d# @  H0 ?+ T  \) d) Q8 R
  79. static int bcnt = 8;4 F3 Q3 b. o" ?- o8 V
  80. static int ccnt = 8;9 d* V) F5 Z* g- |7 K
  81. 7 ~, P5 S8 \; `/ X/ D8 _
  82. module_param(acnt, int, S_IRUGO);
    4 \0 Q, C/ l, _# E% A3 z
  83. module_param(bcnt, int, S_IRUGO);$ A: ~. Q4 R' m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& c; n+ Y* W6 v' L; G8 B  }8 \5 m& s& O3 h$ h/ R2 x( G3 G1 j" q! P: w( k1 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 v: j! w, M+ T* Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) U" x" a7 k! Z5 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 Z% @! F$ Z4 P- e
7 E: ~9 X6 |- \) v! U
! \3 D: }- ?5 g: A3 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-21 00:35 , Processed in 0.043267 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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