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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' ]' {  R4 D: H; ~4 r
  1. [code]EDMA sample test application
    ) v0 ?3 C; E6 S: V8 J
  2. /*# R3 i6 ^0 c- w1 `! J0 N5 `! d( V
  3. * edma_test.c
    ; N; @) y! p4 U/ y; `" p; B
  4. *9 }9 K4 R8 S  |: \% ?/ ?5 D
  5. * brief  EDMA3 Test Application
    1 [. k" b0 A9 C+ o5 K4 r" k
  6. *
    6 M. i8 T3 C6 D- X% T, W/ o
  7. *   This file contains EDMA3 Test code.5 o5 N. q' L* |# h8 l% v4 j
  8. *1 A  J$ b. i% S, j! d7 z8 w. j( f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 i' s7 s! G! p0 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & U( L! R2 o3 A' O7 K
  11. *         TO CHANGE." {/ T( F. `, x0 W; J; B# [
  12. *3 ^% V$ i" X2 H# p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % j" E( z) ?- E
  14. *
    6 ~2 i6 ?: w  ~( _
  15. * This program is free software; you can redistribute it and/or
    ! U+ P2 l& a5 E9 b" J
  16. * modify it under the terms of the GNU General Public License as6 ]( \9 H$ m' q7 Y' B
  17. * published by the Free Software Foundation version 2.
    : n4 b; C2 Z, H$ H6 q% {1 Y% W
  18. *
    . L$ Y0 S; {! @: I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! y. C. ]1 m; p3 b) y
  20. * kind, whether express or implied; without even the implied warranty
    + c. o/ k9 W8 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, Y! U, P. N  h, U3 y8 P7 l2 M% b& p+ l
  22. * GNU General Public License for more details.
    % c, S0 ]  h6 Z
  23. */1 {" b0 Y8 n2 Y. a

  24. 2 v( P3 m& m" H2 u7 r8 n0 O
  25. #include <linux/module.h>
    , m; v4 ]& o: R( J! a
  26. #include <linux/init.h># B$ ?: k2 Z; \3 R6 b5 ?
  27. #include <linux/errno.h>
    / _( K( F1 j9 e. J% s6 J
  28. #include <linux/types.h>
    6 v& t: k7 N; V' c
  29. #include <linux/interrupt.h>
    # S5 x, }6 P1 e5 |
  30. #include <asm/io.h>+ t3 S# q) w& B, H
  31. #include <linux/moduleparam.h>. p4 L/ M" j6 J/ Z5 O8 T  E
  32. #include <linux/sysctl.h>- _; X3 K1 D0 Q2 Y
  33. #include <linux/mm.h>
    8 I3 p- ]8 Q, L: Q4 B3 P+ O; \3 ?
  34. #include <linux/dma-mapping.h>) i4 j( r1 @7 y

  35. ' x5 f# C0 b6 E0 ^# |4 j& b
  36. #include <mach/memory.h>
    . a% e- x1 _3 a$ @8 w$ Z5 C" g
  37. #include <mach/hardware.h>& h, m# b, {* a' ]! y. e4 l
  38. #include <mach/irqs.h>
    ( w3 d6 t/ d4 o! g
  39. #include <asm/hardware/edma.h>2 h0 k+ r2 n7 L4 ^* O
  40. / i5 ^; X7 p; X: ~: m
  41. #undef EDMA3_DEBUG
    ; s6 M0 W4 N( M$ i9 b/ W  G& a
  42. /*#define EDMA3_DEBUG*/. ^" t8 A! v4 h  Y& M+ P

  43. 5 S( c' Y6 Z% D, z7 ~' ?
  44. #ifdef EDMA3_DEBUG
    7 t) X8 U+ y) q7 ^" z, e0 |7 a, l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). y# q' B0 m3 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % c* L' m0 M) p, h1 m. u9 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Y# F. f2 z' A4 F0 Q+ b3 q
  48. #else
    ' i2 ~8 s) R) w  l- @4 _" ^
  49. #define DMA_PRINTK( x... )
    0 U6 v  E- b8 v& }. M; P
  50. #define DMA_FN_IN
    " [" F. v+ v( b& _3 g
  51. #define DMA_FN_OUT1 F4 H  C% }& k+ i2 Z: J5 V5 _, p' y
  52. #endif
    8 f6 V5 l6 s& \3 x

  53. ( j* a# E8 z& u% \, q: q' s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 M. T4 Y0 O. i$ D( m# X
  55. #define STATIC_SHIFT                3  G9 t" u% ~: B: D* C3 M" e
  56. #define TCINTEN_SHIFT               206 X4 a! J# [0 L
  57. #define ITCINTEN_SHIFT              21
    1 B& {" p* f& U0 L
  58. #define TCCHEN_SHIFT                22
    * R2 ~" ^/ T* `2 a6 B, O0 u" Y0 }
  59. #define ITCCHEN_SHIFT               238 k+ ?7 z: v+ P; h
  60.   N9 @' i, `! r5 `+ y6 Z
  61. static volatile int irqraised1 = 0;
    ; O" M. \" Z- R. K0 J( E2 r$ H
  62. static volatile int irqraised2 = 0;
    ' C* J6 B9 V6 D8 z5 y

  63. 4 q( _/ `2 @) k8 x' G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" N$ F) m; n: i0 l- A7 n! N. t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 T  ?' H1 d& c5 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Q0 t* H2 b' Q* I3 P/ f

  67. & _6 Y, s! S, [, U# N1 `
  68. dma_addr_t dmaphyssrc1 = 0;
    3 y% u- ], G6 N$ t3 k
  69. dma_addr_t dmaphyssrc2 = 0;
    9 h. a% j( r6 z
  70. dma_addr_t dmaphysdest1 = 0;6 j) n" \! g6 V: r4 A! a0 _3 ^' J7 r7 ?
  71. dma_addr_t dmaphysdest2 = 0;  b0 f! y0 y) T  a5 j

  72. , {  g5 s" [3 ]) e( F, [1 m# O
  73. char *dmabufsrc1 = NULL;$ m0 X! O& E; q! \; i( W7 X. V
  74. char *dmabufsrc2 = NULL;6 a+ Z' r! R( e" E" H8 C
  75. char *dmabufdest1 = NULL;
    ! L8 n1 H4 |5 c6 ]2 |$ W
  76. char *dmabufdest2 = NULL;
    1 @& Y) }5 l0 E6 T3 n' G
  77. + h0 c9 T" z6 T$ k& A
  78. static int acnt = 512;) k' v4 ~' A0 W5 T3 y1 a0 g) t
  79. static int bcnt = 8;
    . N8 n" g- M, F% K
  80. static int ccnt = 8;
      c; N/ Q, I" m' j; G
  81. / m1 L7 d( P1 f
  82. module_param(acnt, int, S_IRUGO);9 u3 K6 E: B5 U; C
  83. module_param(bcnt, int, S_IRUGO);
    & T2 X- _3 s2 ?; K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- w, R* k; y  |7 Z
: F0 @4 r/ _, E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# S. m! n* _3 w/ `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 y6 Y/ l+ S. \" U* i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T4 D; T) L) q8 A$ n1 `3 g3 v  ]$ L: \" p. L0 O
0 B) A' _5 W. O# b& O; K2 e" O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 04:12 , Processed in 0.051466 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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