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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & V. }5 L2 b( {+ g0 r+ H
  1. [code]EDMA sample test application/ c' h" n( t1 \  z+ O
  2. /*( w- G3 }/ `% \
  3. * edma_test.c
    6 h" a* l7 z8 \
  4. *% C2 [- q/ k3 T5 @, c" c
  5. * brief  EDMA3 Test Application. r- i: m1 h* s: e
  6. *
    & I* X! M" n0 a1 G: P( T
  7. *   This file contains EDMA3 Test code.
    ( q/ X* f8 K, L2 R- y  C4 d) t
  8. *6 g2 J+ O# u. m) Z: l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - k' ~4 r$ H; j8 N6 v, X1 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . g9 z" Y1 b' c$ s2 m" N$ |
  11. *         TO CHANGE.
    2 o: s, d, O! m
  12. *
    2 w/ M# L  R+ m  n; E, I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 U, [& u& l* N9 d
  14. *
    + s3 k) i% P( g) n
  15. * This program is free software; you can redistribute it and/or9 B' F0 P* t) E# x5 _  z
  16. * modify it under the terms of the GNU General Public License as
    * e4 ?. x; j9 ^1 X" z1 e
  17. * published by the Free Software Foundation version 2.0 m  G  |/ A# R. D; b# @/ n
  18. *
    $ _$ P$ L3 T3 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* s* L$ ~7 W' I# i  A6 S9 S" K
  20. * kind, whether express or implied; without even the implied warranty
    # e* I- s  n4 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% [/ s, t, _' w' _1 P) |& ]
  22. * GNU General Public License for more details.( i1 E4 C/ ?; j# X1 B
  23. */
    + ^4 b7 V$ q5 I* q& x

  24. / M4 [: g+ n3 o; \
  25. #include <linux/module.h>  a; x4 X1 g3 V6 p! ^& w; E' V. e6 o1 L
  26. #include <linux/init.h>
    4 D; ^6 `3 `" O/ n" F: o5 B' w
  27. #include <linux/errno.h>2 g* A7 Q$ O8 g4 y# S5 b
  28. #include <linux/types.h>! C6 Z/ _8 h( u8 m  _4 G4 W/ T
  29. #include <linux/interrupt.h>" K; u: q1 G! Y8 e9 d
  30. #include <asm/io.h>
    7 L9 N9 k1 g9 \7 A  V; V9 E; J3 H
  31. #include <linux/moduleparam.h>7 E( T' _2 W% r4 S2 D
  32. #include <linux/sysctl.h>
    % C2 H# g1 R$ ~, E. g) ~
  33. #include <linux/mm.h>
    3 w5 R( d: s6 l  g" Y, n* ^4 p
  34. #include <linux/dma-mapping.h>5 T3 y9 [/ f+ t
  35. - B2 g1 \- j9 L  I
  36. #include <mach/memory.h>- V+ Z; u9 w" {  A6 z7 x5 d
  37. #include <mach/hardware.h>
    # r$ t& T1 M$ k2 s: z5 J) g
  38. #include <mach/irqs.h>3 {8 \5 w: a9 C4 v
  39. #include <asm/hardware/edma.h>
    # F  L1 P, M* d+ Y9 k
  40. + _' W/ R: F* B' x8 d0 g' ]
  41. #undef EDMA3_DEBUG1 |7 P' K/ a+ p
  42. /*#define EDMA3_DEBUG*/$ S0 v1 t& m- k8 t

  43. $ f4 j$ D9 v/ `- L5 @+ y
  44. #ifdef EDMA3_DEBUG
    ; S, {$ Z( g4 {8 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 @* E( v( v" @0 K! y/ R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # A/ C: q& t" Q, o* q0 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 z- B9 |7 S% c5 h& k) e2 [
  48. #else
    0 M1 P  X8 n, |4 Y. j* `2 E
  49. #define DMA_PRINTK( x... )5 |+ o1 k+ f2 G5 F. h2 u
  50. #define DMA_FN_IN
    0 R  q5 a9 o  j' Q& j, l4 z: `
  51. #define DMA_FN_OUT
    * b7 ]+ T- Z# v' k( @
  52. #endif. g% u; V4 D; s  l1 V8 N8 T5 p

  53. 0 E" M5 S) ]7 ]& q+ N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), L$ n4 n' H3 k0 J
  55. #define STATIC_SHIFT                31 _) q2 M  W5 a3 h! {
  56. #define TCINTEN_SHIFT               207 d5 O- y5 x* K0 p
  57. #define ITCINTEN_SHIFT              21% {2 K5 h8 O, ~0 ~: i
  58. #define TCCHEN_SHIFT                220 d4 K! B, m" Z. I2 U; K
  59. #define ITCCHEN_SHIFT               23
    7 h$ E6 k9 v/ t" M! o& \
  60. 2 m, G- |* X+ ]
  61. static volatile int irqraised1 = 0;0 z5 g1 N* @! Q) t  ?( |
  62. static volatile int irqraised2 = 0;
    3 E' [: t# n, x; H3 r( o) j% Y

  63. ) ~/ I. D5 t/ ^( F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 K% _  m' h2 o; n% p/ ]. i3 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' g/ F1 g7 i( n7 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y. F& d; a* V

  67.   w8 y5 p, \. N
  68. dma_addr_t dmaphyssrc1 = 0;3 X! J# ?3 F4 W  O. @& P+ o
  69. dma_addr_t dmaphyssrc2 = 0;; |8 x& D! Q6 [1 }: v8 G+ D) ~9 F
  70. dma_addr_t dmaphysdest1 = 0;1 ^/ Q$ x( H9 W$ F
  71. dma_addr_t dmaphysdest2 = 0;
    3 V- c; q: \1 y4 w/ C4 U1 a
  72. % `" X) M, S( A; Z0 q8 C4 S
  73. char *dmabufsrc1 = NULL;
    ' O2 T' r) t- M2 p' _
  74. char *dmabufsrc2 = NULL;) i6 x7 ~. B6 i! P. m
  75. char *dmabufdest1 = NULL;
    + J% d$ F6 I+ a: M: I: E, o0 ]4 u: R
  76. char *dmabufdest2 = NULL;
    9 @/ ^& \0 W% o% B/ w4 C! I; k
  77. * G" S) k3 ?4 |
  78. static int acnt = 512;* s2 o; x: j% v: Y* Q3 e
  79. static int bcnt = 8;
    0 g& H; N9 R, L' s  G) T& `
  80. static int ccnt = 8;: P) b: R) K6 ?8 D2 Z  o3 _

  81. & e5 w7 ^0 D" a( T
  82. module_param(acnt, int, S_IRUGO);" a; y0 D& Z) P$ v3 ^; o" h1 k
  83. module_param(bcnt, int, S_IRUGO);
    ( Q' @7 s$ o  D/ r* R( C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 |8 B! t* L2 j1 F6 E+ l

4 D* o' x8 q8 n' q9 {8 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' {% h: j3 h' ^$ F) ?! |0 ?3 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 i8 E1 C# N, e( ^) h9 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 L8 I0 A' e3 E
1 ], ]+ r" L! c/ U' F3 ^

$ ?" {3 b8 S# n( x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 02:34 , Processed in 0.045108 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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