OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - ^1 p- J8 B6 d8 _( Z0 t/ a
  1. [code]EDMA sample test application. e+ }8 S3 z, W8 N, a) p* i
  2. /*9 M4 J) ~( z' L5 m
  3. * edma_test.c4 V" g- U4 d  ]' }, d$ ?$ \7 c
  4. *: e0 M# x7 S4 }: K
  5. * brief  EDMA3 Test Application" p: ^4 j7 R' W$ u+ a9 M6 T& @
  6. *# A* L1 J( i5 M' [
  7. *   This file contains EDMA3 Test code.
    * C+ o% T6 s0 e/ E5 L2 M
  8. *
    ( Y  i( o' [) _* Z3 u) n9 d2 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 F! B, Q1 H! C& j( L; c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 t- F4 ]7 B7 l5 W' B
  11. *         TO CHANGE.
    0 ]" d  o+ K( x
  12. *# d9 d1 M7 D6 ]) y( S1 g2 o; H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% _3 J3 {/ x( Q/ p9 a* O. }; H0 M
  14. *, s9 Y6 |% ]5 U9 p- Q
  15. * This program is free software; you can redistribute it and/or& n4 r0 F0 _1 z2 v( T
  16. * modify it under the terms of the GNU General Public License as
    5 I  N& h9 q/ B' z
  17. * published by the Free Software Foundation version 2.! i; G. i8 l( h% o/ ^' u" ]
  18. *
    . j4 m2 E  l& x3 X* L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 p! |1 ?0 K  }5 n9 r, M
  20. * kind, whether express or implied; without even the implied warranty0 h% `8 p5 H7 F$ F) t7 ?* F8 g" g3 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. B( m) p& e: R5 m9 ?2 x
  22. * GNU General Public License for more details.6 ^- \* ^, [; s: z2 T0 t
  23. */
    - k: Q& c0 E4 ?* d) f
  24. * u! ~& @' l5 G8 e1 T/ T
  25. #include <linux/module.h>
    % g5 O  o- C; ^4 d7 W, I8 S8 i
  26. #include <linux/init.h>; ]: h8 b1 |/ e. Q5 o- J
  27. #include <linux/errno.h>
    : }6 f" f( Z3 P
  28. #include <linux/types.h>
    0 r  m: T) @( t* a: R. }
  29. #include <linux/interrupt.h>7 t0 F7 y5 B7 F) P( D4 A* O4 D
  30. #include <asm/io.h>
    ' J) d& T3 ^3 e# |% x1 _8 y" E
  31. #include <linux/moduleparam.h>0 E5 h' q' a$ ?6 g; s
  32. #include <linux/sysctl.h>
    3 M; `8 `5 p2 C" L5 N
  33. #include <linux/mm.h>
    5 f& r* R% K$ `# X! D4 u2 }8 E
  34. #include <linux/dma-mapping.h>8 K' q2 }8 ]) o. i, @+ W

  35. 5 ^2 K3 j" H, Q. i( T. _
  36. #include <mach/memory.h>
    / T1 r* ~3 r% v- B& ]3 ?
  37. #include <mach/hardware.h>
    8 [; C$ I5 a! W  j! t0 d* W9 B
  38. #include <mach/irqs.h>9 }# F1 E: x' P1 R+ t4 ~, W
  39. #include <asm/hardware/edma.h>1 R$ m- R8 b! Q9 t- F5 k

  40. ; [5 \' e5 l. ]: R( f* M+ {
  41. #undef EDMA3_DEBUG
    3 W1 m: M9 l( j, T  q3 |( o
  42. /*#define EDMA3_DEBUG*/
    ; b) x8 ~/ u: |- T0 K/ [1 ]+ E( F* D

  43. # Q* J, `: L$ Y9 H/ A; k
  44. #ifdef EDMA3_DEBUG8 m/ A8 y6 }+ t/ a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # k& `$ D) M$ Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ~7 v/ x% x3 j( A, k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ e6 h7 |2 Q" p2 q
  48. #else- [$ o) [9 I0 S% L2 J
  49. #define DMA_PRINTK( x... )/ d5 k. J, ?) L: _4 p6 X9 L
  50. #define DMA_FN_IN
    * j) p; ]; S0 P3 T
  51. #define DMA_FN_OUT
    & w/ }  _# K. Y9 V' R% u8 J
  52. #endif6 }5 C; S. \  g! M2 ~9 M

  53. 6 Z2 y" g' T! h; h" h; a% [) ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # q0 x! K( j7 u0 E% w% K0 o
  55. #define STATIC_SHIFT                3
    * B" T7 l3 X# X+ o/ D
  56. #define TCINTEN_SHIFT               20
    7 G# g* F2 q, s) q) r( d
  57. #define ITCINTEN_SHIFT              21
    6 J5 t" t; p8 h; A4 z
  58. #define TCCHEN_SHIFT                22
    , L6 U2 D* X& [2 K+ p
  59. #define ITCCHEN_SHIFT               23) L* n$ Z) `- Q( S* E2 H
  60.   E4 [5 [# i- Q
  61. static volatile int irqraised1 = 0;# H2 E( y9 N; U* ^3 W
  62. static volatile int irqraised2 = 0;
      ?  s& M. R; L5 s
  63. 9 n+ z( }2 y3 z' z% t% b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / m% ~- O4 E2 t) C. Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |3 Y! ^8 E3 @5 [* j8 K3 q9 z2 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ~! e9 F1 J7 J) m- P
  67. - {4 `2 `( r' D6 `8 ^0 e) u+ B
  68. dma_addr_t dmaphyssrc1 = 0;) U, U! G2 B+ N9 N/ y' p
  69. dma_addr_t dmaphyssrc2 = 0;
    . b# i" s; _9 j0 U2 O
  70. dma_addr_t dmaphysdest1 = 0;
    ( e' `' D- C2 d3 Q
  71. dma_addr_t dmaphysdest2 = 0;* _7 g/ Y1 s3 D3 u3 ]9 j* f
  72. 4 V# e5 ~! ^/ U5 T  K
  73. char *dmabufsrc1 = NULL;% b0 r8 y5 o/ p! f; S
  74. char *dmabufsrc2 = NULL;
    8 A3 h) w8 V: e
  75. char *dmabufdest1 = NULL;
    & H* M0 I, k$ |+ T7 W1 h
  76. char *dmabufdest2 = NULL;
    # S  H* @; M7 ?6 ?) w# A
  77. % E, X; d$ ~- p$ g' J) D- O
  78. static int acnt = 512;3 k# }: I8 T7 R, G. L: }
  79. static int bcnt = 8;) J5 D, r. p- _; n/ G
  80. static int ccnt = 8;9 P8 T# Y6 f. l4 @4 j, S- ]$ i

  81. ( g* P4 |9 H$ T# ?: W! B7 F4 h
  82. module_param(acnt, int, S_IRUGO);
    - F9 s! M) J3 m# h% e' R
  83. module_param(bcnt, int, S_IRUGO);
    1 V6 @6 l& R' o, R+ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 g3 D9 y+ |; ^6 q% D
5 t9 ?4 y# O5 e6 H( c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  o1 x' E, C4 J' r5 g- ~3 T2 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 K7 B+ |+ P0 K( G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: g* C  @9 d  h4 b9 r! p/ _& q
0 v5 I' G% C" f  ?  `
" O" k' ]4 Q2 t* @+ U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 10:33 , Processed in 0.039500 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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