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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 I, [$ }$ s6 x/ Z" o
  1. [code]EDMA sample test application5 l+ X! {3 t* l* i& {
  2. /*
    8 k4 k/ t1 n8 B( t. `
  3. * edma_test.c& M% y4 ]- S* i' @/ H) h. E4 L
  4. *
    : j) E# `1 I) D: A) a1 \( N
  5. * brief  EDMA3 Test Application
    2 o3 I" E9 m5 o# E
  6. *
    7 D5 E- ~! T  ?, F
  7. *   This file contains EDMA3 Test code.
    ) N* C6 j) n& h5 H
  8. *
    0 g" ]) r8 p) C: B5 a* K$ T8 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 j) p' |9 g, d3 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% e8 H4 X( x# H* L8 Y7 L) A4 c
  11. *         TO CHANGE.
    " [7 e2 R: N5 j2 f5 l. ?- d. K
  12. *3 _2 M7 k& }$ ^( B1 L5 p; l6 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # s# [8 o5 R* v; m
  14. *
    8 Q: K+ O4 ?2 w9 M
  15. * This program is free software; you can redistribute it and/or
    7 E* K. H! }& G8 _0 p
  16. * modify it under the terms of the GNU General Public License as
    7 `2 |4 b. B% ?  [' y6 X
  17. * published by the Free Software Foundation version 2.+ y9 e3 o4 U) N! N, m
  18. *
    + s5 n. l) S, K' H8 {2 ?7 B9 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( p  E( _+ D, w8 I2 _" V( Z& O
  20. * kind, whether express or implied; without even the implied warranty; B. V, E1 P4 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ M' `& c, B, ]) P
  22. * GNU General Public License for more details.
    $ L+ D  ]( J' m4 m0 ~
  23. */
    0 K% `$ E" s( P6 m$ k
  24. 3 |! n7 G) V7 m' B5 q
  25. #include <linux/module.h>
    - w0 H" p- h: v: _- A1 T
  26. #include <linux/init.h>9 j0 v/ v5 ?, c# T; B6 ^
  27. #include <linux/errno.h>
    % r" s, A3 ^* w% F
  28. #include <linux/types.h>
    / m. t, y5 X8 ~3 Z) t
  29. #include <linux/interrupt.h>: m# t1 g; a2 M! `6 }
  30. #include <asm/io.h>
    1 m' T8 M7 H8 M* l5 C% O
  31. #include <linux/moduleparam.h>
    + q0 I6 k; g4 l
  32. #include <linux/sysctl.h>
    # q; g7 w. r7 ~1 L7 y
  33. #include <linux/mm.h>
    / f3 j8 |7 [( C/ D& C1 C
  34. #include <linux/dma-mapping.h>7 C: k, a, `9 F/ C
  35. 9 |& E, n- f$ C
  36. #include <mach/memory.h>& L( T) R* q/ |
  37. #include <mach/hardware.h>
    % C; a1 F# u8 r7 f/ b
  38. #include <mach/irqs.h>
      a9 Y5 p+ m4 C# l: Z$ M1 M% {
  39. #include <asm/hardware/edma.h>. L: b' A2 t" s$ O7 Y' u* r8 ^
  40. ' I8 D( _1 ~3 [- z/ F
  41. #undef EDMA3_DEBUG& j# I2 J) C! a# h+ c5 ?5 v
  42. /*#define EDMA3_DEBUG*/. E9 E- ^1 e, n

  43. 8 Y- n5 b% O" y3 \, _
  44. #ifdef EDMA3_DEBUG
    " G7 ~& N! Q) U. V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 s' @0 V" J" q, ~/ z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + L, n/ v% x# G! A" s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! w3 u3 s& j7 M2 Q2 N/ Q
  48. #else
    2 }4 |  Y! K( f
  49. #define DMA_PRINTK( x... )  G  ]. @% @7 L) x; Z( V+ a
  50. #define DMA_FN_IN  `& q! j$ I3 T5 w4 c8 x
  51. #define DMA_FN_OUT
    3 Q  D% W! O' D! N& q# x% T. Q  \
  52. #endif
    ' K- @- P/ A% m/ l
  53. 9 S  t  d, L' n/ ]9 M% w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ m: O, G1 D$ {3 b* C
  55. #define STATIC_SHIFT                3
    ; d4 A* P5 s$ _0 y
  56. #define TCINTEN_SHIFT               20& g: H2 p" }$ o+ p+ E
  57. #define ITCINTEN_SHIFT              21! D$ Z7 s5 M+ \0 p
  58. #define TCCHEN_SHIFT                223 F: A. z% A- m
  59. #define ITCCHEN_SHIFT               23
    ' |5 H* l0 y' Q+ [5 X+ }

  60. ( ^9 Y2 g7 ?( p9 x' |
  61. static volatile int irqraised1 = 0;; f8 N  V3 L6 p) r/ _9 g& \
  62. static volatile int irqraised2 = 0;
    1 z9 _5 L: @# _0 t

  63. 7 @! X& w& }# q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 V" ], D+ i/ U( \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 A$ P( G% E+ G, U9 q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  d) t: O% l; J% `& [* R
  67. # f# }/ D9 Y- d$ v; s( E( i/ @
  68. dma_addr_t dmaphyssrc1 = 0;" S$ }& H% ~( j5 B5 e% t8 V
  69. dma_addr_t dmaphyssrc2 = 0;! E- `# l0 k& }) X6 f$ w0 ?  d" J
  70. dma_addr_t dmaphysdest1 = 0;6 a& h0 G3 V8 g$ n7 c4 {6 T/ k& L2 p
  71. dma_addr_t dmaphysdest2 = 0;
    0 n0 B; i6 }; _: z2 o) e
  72. & f+ a2 t  `( u# P; k3 K
  73. char *dmabufsrc1 = NULL;
    # K0 x: N8 ~) [3 F8 U0 D1 g$ t) j
  74. char *dmabufsrc2 = NULL;
    1 \) q& d& O) k: n2 h7 C! X
  75. char *dmabufdest1 = NULL;
    " C: Z0 a. C  u
  76. char *dmabufdest2 = NULL;
    4 i: b; i: E, T- @& t

  77. : w! P* a  {6 `0 Z
  78. static int acnt = 512;1 R1 c/ b% \  t- |3 Y* L
  79. static int bcnt = 8;
    : i: c4 A4 z& z& Y! L
  80. static int ccnt = 8;
    : Z) Q  k8 i0 j5 l' M

  81. ) O2 a- H1 U2 b& h- ?
  82. module_param(acnt, int, S_IRUGO);. ^2 c3 r& U  j  D& _
  83. module_param(bcnt, int, S_IRUGO);! h: A* A# ^+ G" E  m$ _, u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 p0 T/ D4 v3 \8 Z( b6 E7 d
0 r2 K6 o% E: m6 }' r5 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, u% G) y" K0 a- o# M& W5 y$ T1 C4 x
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) \& v( v+ N0 Q: F, W& b# {1 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 d' s  X8 H+ x: n" L9 `3 S- Z7 m

5 \, k/ d, n' T5 A* U( `, l1 H- }  E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 14:39 , Processed in 0.040908 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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