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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U5 a. f: U$ m! l
  1. [code]EDMA sample test application* |. G9 G9 @# J
  2. /*
    ! m( @( @4 B4 a: b& z0 Z, e
  3. * edma_test.c) \7 Y. j( ^0 p2 ?3 ~# N
  4. *
    5 a% {* j5 m- [7 ?
  5. * brief  EDMA3 Test Application' v* A  g- p* {! @' r! r
  6. *5 _6 v; g% h6 U7 n& P5 F9 M/ M
  7. *   This file contains EDMA3 Test code.9 A% C- G! n9 S8 ?
  8. *, |& l; c. U$ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - i4 g  Z8 r1 t& Z# l& {" I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ s; o5 `* d% T4 u4 v1 O/ n, ]& U! f
  11. *         TO CHANGE.# @" T0 i1 d; b
  12. *
    2 A' _: R3 _" F+ n/ ?1 m& J8 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. q, _  i- ~8 {9 Q; v* {
  14. *
    % [, _7 u4 x' p: A! R
  15. * This program is free software; you can redistribute it and/or
    # v% j' q8 L- H) L2 u: d
  16. * modify it under the terms of the GNU General Public License as
    ) `" C7 c5 ~& x+ n* \# A* c: v6 Y
  17. * published by the Free Software Foundation version 2.
    1 h/ c# ^- G3 Q: h0 T! d! C
  18. *, _( _/ b+ F8 J  c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ }: d2 H8 P. q: q3 p
  20. * kind, whether express or implied; without even the implied warranty
    ; M6 n  F& M0 f8 Y' @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 C3 \3 V0 V4 b+ q, ]5 W
  22. * GNU General Public License for more details.1 J6 U" k; f6 [' n
  23. */
    ! b0 [( G3 W/ y  S" a! M8 \
  24. 9 ~# t( X8 q7 k+ J- K4 F
  25. #include <linux/module.h>
    & }2 l! l. n/ d* t6 E2 B3 u; `2 }
  26. #include <linux/init.h>! g7 ]; E& q4 M2 r% x2 o2 Y& `
  27. #include <linux/errno.h>, Z7 {7 F; q" H9 J
  28. #include <linux/types.h>5 y" }2 W  {  r, m" Z, u
  29. #include <linux/interrupt.h>
    9 ?7 O2 J5 j* A8 k  R3 j
  30. #include <asm/io.h>
    # i9 M0 O' t1 S/ K
  31. #include <linux/moduleparam.h>
      n- f7 M1 v& V
  32. #include <linux/sysctl.h>
    4 H6 @1 K% s/ C  Y4 S0 C6 J
  33. #include <linux/mm.h>
    2 {9 O( X) |0 m4 g6 a9 p$ d
  34. #include <linux/dma-mapping.h># j, L! |' _4 V. z
  35. $ r8 t1 B, ^, i- I, r
  36. #include <mach/memory.h>" s) }" n2 y8 g) j+ m
  37. #include <mach/hardware.h>* S8 U( o' F7 ]# P
  38. #include <mach/irqs.h>
    5 \0 {& a6 G; u, J4 F' {5 V
  39. #include <asm/hardware/edma.h>) R. O# Q* e" \) D) q6 o

  40. - T5 E/ W! y9 b( a' Y
  41. #undef EDMA3_DEBUG6 i# ?9 G& P3 B7 ]8 L& S. g& s
  42. /*#define EDMA3_DEBUG*/
    1 H' }$ Y( N) z* q' ]3 H
  43. 5 C( ~/ s& {9 K. Z! f0 x  }
  44. #ifdef EDMA3_DEBUG
    # O. ^- R% `( c, X9 ~& G; ]9 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; B' D+ K" j9 Y3 `8 k6 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# W& N7 r% r: v' a" `7 d. G; D5 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- B1 @" F  Y0 ]! i
  48. #else9 h! A* }" j& m; H" \( k3 a
  49. #define DMA_PRINTK( x... )+ a, S7 @; V( S" t: p* a# }9 j
  50. #define DMA_FN_IN# r3 f( R! i8 |: B8 X  s. C
  51. #define DMA_FN_OUT
    2 x0 K: u; C1 I# ?8 h7 ~! U
  52. #endif& _7 e' x: x% e4 W
  53. ' J4 V. n+ j* A: y# x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% q9 q' m) k. R" F: z4 `1 {: Q
  55. #define STATIC_SHIFT                3
    " Y" q6 D$ I) |2 p
  56. #define TCINTEN_SHIFT               20
    * e( ?, F6 F& C4 d9 K; h2 z
  57. #define ITCINTEN_SHIFT              213 e% t7 a% c4 D  M1 h4 Y, i* d
  58. #define TCCHEN_SHIFT                22
    2 f( ~: g1 d+ [8 K6 r2 w& k
  59. #define ITCCHEN_SHIFT               232 k1 |) G( V* q" ^9 k' G

  60. % s/ T; q7 Y  D5 L, ?+ x
  61. static volatile int irqraised1 = 0;/ {1 L/ D; ~* [  t: e* o( A
  62. static volatile int irqraised2 = 0;8 s/ m( R8 ?/ g0 b4 Y7 T
  63. 0 D2 L8 E5 q4 C) b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]% s  ]8 b3 Q2 ~$ r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Z/ \/ m# t8 ~. M  E5 X$ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w+ o5 Q( r; w  k

  67. ( O) \+ Z6 J4 [) k4 V1 d
  68. dma_addr_t dmaphyssrc1 = 0;
    # G; M( |: z6 n) B1 R- y* v6 m
  69. dma_addr_t dmaphyssrc2 = 0;6 V0 X+ c( e7 w. T7 ~0 l/ ^' z
  70. dma_addr_t dmaphysdest1 = 0;7 ~5 @0 Z; a' j0 T+ @, L
  71. dma_addr_t dmaphysdest2 = 0;& ~" i4 y. i! O7 f7 W" U: I  m: U

  72. , m( x, M  q4 @1 `
  73. char *dmabufsrc1 = NULL;
    3 j5 I1 z% ~. ^& C& H
  74. char *dmabufsrc2 = NULL;' w+ W" X9 W( c: }
  75. char *dmabufdest1 = NULL;
    % ^5 F# k; N. m0 t9 S
  76. char *dmabufdest2 = NULL;- G- Y* o% j. u- W9 ?
  77. 9 T8 W. H6 x# `
  78. static int acnt = 512;1 M4 W* @: ?: l7 v0 |" R* W7 \/ A
  79. static int bcnt = 8;+ S) _4 `, h2 b/ W
  80. static int ccnt = 8;0 ^4 ^! r, J- [+ V

  81. 9 s( Y% ~7 T3 S* |- B3 F7 v2 [
  82. module_param(acnt, int, S_IRUGO);
    2 p+ B  B8 f, \
  83. module_param(bcnt, int, S_IRUGO);
    ' b8 r1 d2 k; s& Q, t% v6 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, I8 r4 Q, F# U/ Z, W9 n" E' g/ H0 p$ V8 T
, Q) r5 ~- \  k( n% X- M4 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 u* }2 Q6 k; W) R4 `! Y% garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [/ t9 F! A: E7 }/ n! _& x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 n0 S8 p+ h/ C. W6 s
% W  C1 g$ A' [/ H8 B7 A5 V9 }5 G; b" W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 08:47 , Processed in 0.038002 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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