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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( m: D' m' T2 M; o8 W- b
  1. [code]EDMA sample test application% w- x! _' A1 O( S2 C5 F$ \: [
  2. /*7 q% N' R' h% G( d0 R" d3 J- b- b0 Z$ O
  3. * edma_test.c
    - x9 x" c2 a) O( s- L* k" c5 {6 ^
  4. *
    + _4 E. ~7 ~9 K
  5. * brief  EDMA3 Test Application& T( f3 @- P- u+ F
  6. *2 [' ^3 P) C5 K
  7. *   This file contains EDMA3 Test code.
    , x" B+ H* H' Q8 ?; R2 d
  8. *) ?6 L4 H+ M. x2 g$ n- n% Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: F) s  h* a8 D- B/ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& P) j  t5 |& ]2 M: N* @
  11. *         TO CHANGE.) v4 B: n9 A* X# z5 E2 M  R  E
  12. *
    $ H- _/ D8 A9 O8 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 A5 b6 _& R' u* U
  14. *1 q2 f% i/ w5 T- z  ]6 F
  15. * This program is free software; you can redistribute it and/or
    9 O6 N. K$ t5 i7 }8 j( X/ T' J6 M, J
  16. * modify it under the terms of the GNU General Public License as
    ) E/ P  c' E9 ]7 w! e( s! N
  17. * published by the Free Software Foundation version 2.
    $ \' w4 h  a2 d$ Z/ x
  18. *3 }/ T, ?* P' m- h0 D$ s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  g+ e0 G8 Y1 P& o
  20. * kind, whether express or implied; without even the implied warranty& o1 o( w# o1 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      E, }2 e! U8 g% ?
  22. * GNU General Public License for more details.
    - N" A  [2 d* T  i2 b& z
  23. */
    0 O- M9 j' \; h0 I
  24. 8 N% I; q3 f7 [, c5 R- T! y
  25. #include <linux/module.h>
    3 O# k2 E" b; Z; [. a
  26. #include <linux/init.h>; S# H+ S6 b* [0 E4 h" n; Y, y' v
  27. #include <linux/errno.h>
    6 x8 e6 G4 K% c/ p
  28. #include <linux/types.h>
    . ^  b8 E4 L0 d, J* r6 e
  29. #include <linux/interrupt.h>
    " _4 S% l) s1 Y8 e0 M; O
  30. #include <asm/io.h>. Z& z! p& Q! M* x3 i5 j
  31. #include <linux/moduleparam.h>
    6 H" I* P0 H+ x* F* c$ X2 c
  32. #include <linux/sysctl.h>! |( o* s1 ?4 h& }
  33. #include <linux/mm.h>
    3 _' O) K: @8 }) u
  34. #include <linux/dma-mapping.h>
    " {3 Z$ N0 |/ l6 s  q3 f+ E+ @
  35. * @. s3 e1 Z3 n2 A" u+ ]7 V7 {& |' R
  36. #include <mach/memory.h>( @+ U" J$ D! c
  37. #include <mach/hardware.h>  P( U7 u" r/ D# @. i
  38. #include <mach/irqs.h>9 ^, Q  A2 m7 n6 p
  39. #include <asm/hardware/edma.h>9 h; ?9 S# a* j$ ^
  40. : _8 i0 @( @$ Y1 ~. T
  41. #undef EDMA3_DEBUG: ]4 [$ t' z& L# S
  42. /*#define EDMA3_DEBUG*/* w- s- L1 X& J1 u$ c
  43. 1 `6 y$ h! I" w2 ^& K& U) C" }% Z
  44. #ifdef EDMA3_DEBUG1 d! K, x2 u/ y- p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 D- _& o% [0 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; a2 v' M7 a9 }; l4 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! J1 K' l! _: j: H; r1 f1 q. z
  48. #else0 N7 n5 K2 X9 E# P( `5 e: u
  49. #define DMA_PRINTK( x... )
    5 A' G3 s7 i# Q
  50. #define DMA_FN_IN
    / D, L% p# U% X- Y; m& f- \- k) U% a
  51. #define DMA_FN_OUT
    0 V% P+ z4 I1 A  g( x+ }# H! f7 j
  52. #endif/ R0 u6 \0 G- \. x4 i  j3 g
  53. 6 `8 C6 Y4 H! A7 F# B& \+ w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , T! [  y! z2 d5 x
  55. #define STATIC_SHIFT                3
    ( b0 T9 w) p& i0 M; G
  56. #define TCINTEN_SHIFT               20
    0 x" b' t8 p! K$ `
  57. #define ITCINTEN_SHIFT              21
    $ d% W1 ]4 l3 k1 o  f
  58. #define TCCHEN_SHIFT                22
    2 _1 ^8 K; h" l! D. ]: Y
  59. #define ITCCHEN_SHIFT               23
    0 \  E4 z0 J+ ^. B8 w4 W$ C

  60. 0 i1 T& N2 \& p& j. o! ~
  61. static volatile int irqraised1 = 0;3 u; }3 s% |$ k* H& p4 b6 o0 ?
  62. static volatile int irqraised2 = 0;' E5 w( m4 m1 }; W) N

  63. 3 o% u, u  e% B5 H; V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ^; E' s8 T& h$ F' l- Y  C% f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 O; q! Q  |0 n+ B1 g2 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 `: ?% z/ W" p3 ]1 D

  67. # p) ~3 h; L1 n
  68. dma_addr_t dmaphyssrc1 = 0;7 L6 ~' [4 F, Q+ ~
  69. dma_addr_t dmaphyssrc2 = 0;
    : i7 g' Q5 N8 L; M3 e* G* ?$ m( V- P
  70. dma_addr_t dmaphysdest1 = 0;
    ; E$ D0 p  c& E8 `& n8 K
  71. dma_addr_t dmaphysdest2 = 0;$ X8 ]. i% C$ v6 y

  72. 3 W. \2 N. k- P" Y
  73. char *dmabufsrc1 = NULL;7 V9 F  L: a5 z
  74. char *dmabufsrc2 = NULL;) k" b( `2 H  f- E
  75. char *dmabufdest1 = NULL;
    2 _6 H! V: h+ [# O% S
  76. char *dmabufdest2 = NULL;
    ! u4 C0 D% v) `( R9 P- U! p+ V
  77. ( p4 {4 z! I3 g( X7 W0 c
  78. static int acnt = 512;) d0 W, f! c0 ^
  79. static int bcnt = 8;( H' i- O* ~' O9 y3 @% V
  80. static int ccnt = 8;  p+ Z4 e7 T& ^8 z6 F

  81. 9 X9 U) @2 L6 ~
  82. module_param(acnt, int, S_IRUGO);5 V/ B8 k, p) z1 Y
  83. module_param(bcnt, int, S_IRUGO);
      G7 u0 H. y% N2 K' N$ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" _) G5 _/ i# ]; Y# \
9 f" w; e7 W2 A* F6 Y$ O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 m5 `* ]9 e1 ]: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. x" l. X$ _' v! G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 b  G( ]7 e  Y3 H; v/ w
5 T1 o( }+ q$ q; X0 U6 |

8 c6 X- _) A7 }& B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 20:12 , Processed in 0.040542 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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