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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: T$ x/ j/ |) t* n: M
  1. [code]EDMA sample test application8 ^  m0 z: ?" p5 h' j" H
  2. /*! V/ z0 s* t6 d7 q
  3. * edma_test.c
    ; Y( i5 \: q4 q" l9 c4 c
  4. *! P6 B3 m7 x, s* E! E1 a( S" K
  5. * brief  EDMA3 Test Application
    5 U8 f% d& _- Q# b( b
  6. *2 S7 k0 k5 B* D6 z0 B3 R
  7. *   This file contains EDMA3 Test code.4 h8 j% f9 a) g4 Y  p
  8. *' S3 ~$ _" \& Z6 }% U3 h3 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: A, a( C$ P' I# H! x: B( i$ k% u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , o2 ]; b- l' ^5 `) Y6 i
  11. *         TO CHANGE.: u, |3 P/ C% M! U4 l
  12. ** d% P, L, y0 N* d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) L% W( _! L  Y$ ?* r$ \) ?
  14. *. m' ]  V: ]2 w( _7 v$ x* _
  15. * This program is free software; you can redistribute it and/or2 r& E2 J5 J+ q* L
  16. * modify it under the terms of the GNU General Public License as
    6 S8 L7 @. E, u6 o8 K* U( l
  17. * published by the Free Software Foundation version 2.
    3 n3 j$ y' N- O* R2 j
  18. *
    4 E9 @: g3 y% ?1 s3 p& w2 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " o: p; |2 }$ d8 K2 p  L1 M: i! U
  20. * kind, whether express or implied; without even the implied warranty  J% y! a( N5 P5 m8 w/ }8 E8 [; x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 C3 ]6 `) I; `0 _3 k) u
  22. * GNU General Public License for more details.
    ) j" {$ b* O" |# `
  23. */
    7 }* B4 a6 Y; g) S" Q1 O; `6 k
  24. 8 s# ]  D" f" X" q3 n
  25. #include <linux/module.h>
    8 s! u9 i. @& E7 V  ]
  26. #include <linux/init.h>
    6 ~- ?  r3 d6 z* @
  27. #include <linux/errno.h>/ Y/ V# K& v2 |9 e% R. I. i- o
  28. #include <linux/types.h>4 k; Y3 E$ B1 H! [3 Q
  29. #include <linux/interrupt.h>
    , @  b' h+ @! ^$ c- d4 D
  30. #include <asm/io.h>( {" k2 r* y0 r$ s1 q
  31. #include <linux/moduleparam.h>* Q' c6 P0 ], [8 P" n% O6 @1 |( F- K
  32. #include <linux/sysctl.h>/ c6 q( I7 F) Y; R1 t& L; b
  33. #include <linux/mm.h>7 y( [( E7 r% n& H
  34. #include <linux/dma-mapping.h>( _8 x: l0 c7 [. ^
  35. " i; _$ O. s+ d! p$ q3 ]: i4 v
  36. #include <mach/memory.h>8 N1 L0 g- y$ a; v
  37. #include <mach/hardware.h>. b0 m6 C0 d- E1 ]
  38. #include <mach/irqs.h>
    0 `4 N: p$ H; M3 O$ x8 J
  39. #include <asm/hardware/edma.h>$ ~2 Z: i  n& k( R6 E$ V* T

  40. 7 I) A9 V3 v4 z
  41. #undef EDMA3_DEBUG
    8 t" E9 q4 p% ~0 Y% B) y
  42. /*#define EDMA3_DEBUG*/
    9 I8 A, I4 `4 |# B  R% }9 Y1 o
  43. ( R3 e1 |6 o' N
  44. #ifdef EDMA3_DEBUG5 Z9 g( S1 D9 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): D* p0 n8 ^! r  v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* F/ C! S8 M1 [$ c+ C5 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : u7 |" ^+ X8 e, D( V
  48. #else. t/ X3 b/ b. H* B* H
  49. #define DMA_PRINTK( x... )
    . r3 Z+ G4 ?% `# U1 q
  50. #define DMA_FN_IN
    : z6 W) F" P2 M7 K
  51. #define DMA_FN_OUT" Z! s! M$ X. d6 ~) P
  52. #endif
    0 ~) p+ `3 t* K$ T8 }# R, A( W" T0 ?

  53. & ~) N! R' o0 v0 {% S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- ^, g/ m, o, g8 U. t) ?
  55. #define STATIC_SHIFT                3
    6 r$ l/ [: b+ |
  56. #define TCINTEN_SHIFT               20
    # X# c5 G; ?0 E1 h& Y
  57. #define ITCINTEN_SHIFT              21
    0 @+ ~9 G% Y8 a6 [, Y& d
  58. #define TCCHEN_SHIFT                22$ ?  {1 h& f$ l! ^3 ?* B
  59. #define ITCCHEN_SHIFT               23& w: Z3 i, x9 _: q: ]
  60. " O  T  d7 Q: @( G) D9 k9 Y' F
  61. static volatile int irqraised1 = 0;
    9 c" P" c  u8 a0 q
  62. static volatile int irqraised2 = 0;* }% A3 h( {0 B; ^

  63. 7 s" k% X' o6 j/ ]- ?: l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q, n: H0 @: z! y0 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ^- Y0 D* H- T0 I; c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + j! `2 ~8 ]) a9 N$ `

  67. 0 a7 ]' O- i& {+ {% X9 u; ~! R+ r
  68. dma_addr_t dmaphyssrc1 = 0;
    2 _1 K. b! }6 L4 S
  69. dma_addr_t dmaphyssrc2 = 0;
    & |* Z' O& k" z. v# u# }
  70. dma_addr_t dmaphysdest1 = 0;
    % M0 _3 b5 C& f2 c3 K! f
  71. dma_addr_t dmaphysdest2 = 0;, s: Z" k, r* I% V3 G7 ], y

  72. & x6 p8 G' m7 C. e( E8 y
  73. char *dmabufsrc1 = NULL;
    8 J+ ?, S3 N3 Q3 V% m8 J6 A
  74. char *dmabufsrc2 = NULL;
      t+ m( O/ H) H2 |2 T& e
  75. char *dmabufdest1 = NULL;5 A# [8 s  Z0 ]
  76. char *dmabufdest2 = NULL;/ c% w+ k/ X2 Y. w

  77. ) E! w- p+ _7 u7 J# K0 q9 N
  78. static int acnt = 512;
    * Y1 Y0 U* f5 o( G# d
  79. static int bcnt = 8;8 q8 }- v) p  j' s' w( E0 v9 g
  80. static int ccnt = 8;
    2 w& w- ^7 x7 V4 D: ^

  81. ( c9 l4 U3 F" r1 L% Y7 V5 I8 v
  82. module_param(acnt, int, S_IRUGO);9 r9 ]3 ?1 _) e7 S: L- j5 a
  83. module_param(bcnt, int, S_IRUGO);& e- x. F" S' O- d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! S) u" P, @2 P9 ]) N! w  {0 i/ g, R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, i( o$ t% V( Y$ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g1 H2 ~3 J7 h0 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( n# S! Z' R" ~. _9 E* k, f$ p3 J( e
9 g, l  b3 V' u/ L6 d
& v1 w: |7 k' V$ L0 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 11:09 , Processed in 0.038316 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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