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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 z& s3 i* _/ w3 l- `% }$ _% {$ C
  1. [code]EDMA sample test application
    ( V& f- b/ J3 A* |1 A: q# K
  2. /*' l4 V, J4 w8 E
  3. * edma_test.c( P+ K0 V" b) U" Q3 V& D) ~
  4. *, g4 x) F# m: y: n& L
  5. * brief  EDMA3 Test Application! y. M  D# h8 p' ], V
  6. *
    + j. E' m) {4 @9 W8 T
  7. *   This file contains EDMA3 Test code.
    1 C  _% E1 c; v4 C& A3 }9 M. p  ~
  8. *
    . T  E( q/ `7 [$ f5 s- z) i) G' w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 r# E  L' E! f6 w0 O  X0 l/ \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - G. Q) ]/ x2 O9 ]5 k7 k
  11. *         TO CHANGE.
    2 X9 N( t% j0 ?# K8 [
  12. *2 [4 R0 G& z* i. p% X1 x$ i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( D+ {1 ~* k4 S7 d* H
  14. *8 }) Z' |) z! Y2 X- y
  15. * This program is free software; you can redistribute it and/or; Z, h  }) ]! t, q. H" Z5 a
  16. * modify it under the terms of the GNU General Public License as
    * [) }( q1 y! Y, f! G& u5 n) b; y2 x
  17. * published by the Free Software Foundation version 2.  p2 j* o0 g( D+ O8 x
  18. *
    & v$ [2 l6 N1 p& q0 r, f. W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. O. n1 X- R' F, S  y3 Z! Q
  20. * kind, whether express or implied; without even the implied warranty* p6 U" R- W4 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " ~+ p# e! _/ U, u
  22. * GNU General Public License for more details.) Z# F, T: @7 C' u* r, g2 V/ [
  23. */
    0 u; p( O- l$ V. ^7 a
  24. 0 x2 N6 e' `7 a; \
  25. #include <linux/module.h>1 H8 X/ ^) p; q" w6 k- w0 m7 R
  26. #include <linux/init.h>" V3 @6 ^. J  i- x
  27. #include <linux/errno.h>
    7 D7 p5 R4 x+ U% b' D
  28. #include <linux/types.h>
    - Q5 I8 |1 G, u6 ~2 a
  29. #include <linux/interrupt.h>
    , S0 C8 d3 R4 }! P; z  ?+ [  K& z+ G
  30. #include <asm/io.h>
    ; k. b1 ]( k: \. f  K" i
  31. #include <linux/moduleparam.h>
    , u$ U# ~( u% S' V  H  z$ m
  32. #include <linux/sysctl.h>0 @# ?# h2 p( C8 I
  33. #include <linux/mm.h>9 a' h. X7 S" b
  34. #include <linux/dma-mapping.h>' Y  A4 ]" |# Q* x3 e) X; r5 U

  35. ) `* t$ M" h3 r  m7 E" H8 ?
  36. #include <mach/memory.h>2 [4 O+ @6 k$ z& I2 a5 D$ q' g
  37. #include <mach/hardware.h>' z& d, b" v6 `# P
  38. #include <mach/irqs.h>+ Z8 j" X; d1 Z7 _
  39. #include <asm/hardware/edma.h>
    3 {' Q. P$ p( \. H" X9 F6 @
  40. - M" w$ `. i$ }& t9 ?
  41. #undef EDMA3_DEBUG
    ( A3 {+ b7 ^/ S% b/ B1 S
  42. /*#define EDMA3_DEBUG*// U# [7 o" k; z$ Q/ f6 }
  43. " H. o. m1 D$ Z# {0 O
  44. #ifdef EDMA3_DEBUG8 r/ b9 N$ v) j8 e: ]0 o5 j' x* N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 n. d, }$ M, o. o, `* X) ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 G  Y+ ~9 c. Q5 \# X' H0 r  f5 o& ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 [2 h/ Q$ M3 w9 T9 N$ t: l) M
  48. #else# Z. O; L; @# S" l5 G
  49. #define DMA_PRINTK( x... )
    ! p1 l1 v* P) N, @: `
  50. #define DMA_FN_IN
    1 k' W" Z2 t' o/ J; b2 O, s0 {
  51. #define DMA_FN_OUT& W. d, B2 V3 I% G; O0 G
  52. #endif1 M, \3 E. M! E# a9 `2 k% l
  53. - Q, l3 S4 B- M- a8 f$ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 ]- M. H- x6 T% H+ e
  55. #define STATIC_SHIFT                3" [$ `; d6 y" b: W) j7 {
  56. #define TCINTEN_SHIFT               203 {& ^4 x/ G# d% s8 D2 e0 G
  57. #define ITCINTEN_SHIFT              21
    9 `1 A+ ^& |0 m5 J
  58. #define TCCHEN_SHIFT                22" M1 y2 V' h) ~: m
  59. #define ITCCHEN_SHIFT               23
    4 w* ?; n6 S6 n* j  `0 j

  60. 0 |4 s/ V- p* d% z' O
  61. static volatile int irqraised1 = 0;. B. m+ T8 L& \, k9 ~. `
  62. static volatile int irqraised2 = 0;
    ; [4 c* X) o: K  v3 P

  63. , C6 [* H: C: c$ z2 w& T9 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 x/ s: Y# F2 n0 r( }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ^$ M* i* o% L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# C6 Z: k" F8 V9 L, E6 v" [
  67. 5 l$ t6 K* `0 k; x. E
  68. dma_addr_t dmaphyssrc1 = 0;4 |* B# o/ w& ^/ l4 B
  69. dma_addr_t dmaphyssrc2 = 0;  q  ?) r  R5 Y1 c
  70. dma_addr_t dmaphysdest1 = 0;
    6 a7 {( v6 {- E* T; t/ W# F' w
  71. dma_addr_t dmaphysdest2 = 0;# y% \8 k) @- ?+ R6 w- i

  72. 7 H: [( ]. \+ g- O6 I
  73. char *dmabufsrc1 = NULL;
    ! t9 U! x( M2 Z) f" v, G
  74. char *dmabufsrc2 = NULL;
    . ~1 J) `+ r6 v9 i! d9 K2 |
  75. char *dmabufdest1 = NULL;, i7 t' w& S8 ]6 r5 \6 b
  76. char *dmabufdest2 = NULL;
    ; \6 d8 _% Q+ w+ b/ p6 x( f$ S

  77. 8 a7 a- }  S/ I+ \! l8 j
  78. static int acnt = 512;5 C" |5 g! E2 A, B' {7 [8 R
  79. static int bcnt = 8;
    # a1 C, V  z! J  c
  80. static int ccnt = 8;( u) |* N, p! e5 {& q# K
  81. ; C$ D  ~) r4 D& s$ @) r8 r
  82. module_param(acnt, int, S_IRUGO);+ a) b- H" {( a( e, d+ [. c
  83. module_param(bcnt, int, S_IRUGO);
    ( x" d# H1 K& e4 R7 v8 z! }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 ], W- c) t+ j* a# {7 U/ f
$ L9 Z$ e+ t" Y0 z' X3 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ ?+ R0 y; j3 q8 z$ m, U% l" A  narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ^4 l$ N- I. \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: H1 F& [4 A  a* r/ W5 ^( @6 r- c$ G/ W- p7 @
3 k3 e/ K. ?6 b8 M8 Z8 t3 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-20 17:57 , Processed in 0.040466 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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