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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' E; M, i7 {) i# Z( B
  1. [code]EDMA sample test application
    7 J, r( Z* A# \" c. ?# u
  2. /*
    1 P" P1 t3 q5 Z
  3. * edma_test.c
    , o2 d; {# d$ f* B
  4. *  J. C6 w" Y# |4 x
  5. * brief  EDMA3 Test Application
    ! N1 y/ F  \; w* |
  6. *. \6 V; V" O5 r
  7. *   This file contains EDMA3 Test code.
    % `% ]9 N0 P# \5 W' B" {# |, b$ c
  8. *
    : d6 V6 |: I- H2 m, q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # _0 T1 X% S3 m3 ?. L8 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 E4 L* X/ q. x' o' G" }4 |+ l
  11. *         TO CHANGE.9 W; R2 B+ Q2 y: `
  12. *
    , ]5 w6 h) c. R. q( s9 r) a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& V# X( P$ x& J$ L% d
  14. *
    % ~9 Z2 i- ~- j
  15. * This program is free software; you can redistribute it and/or
    $ B7 e9 g9 f+ \; @1 w, n
  16. * modify it under the terms of the GNU General Public License as
    - }; l6 H( }: C' B: B
  17. * published by the Free Software Foundation version 2.+ z" O3 O  @* `" p8 j" e
  18. *
    & }4 ]  y# J8 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 O5 [! v% O, o$ Y4 e, i  }% F: M
  20. * kind, whether express or implied; without even the implied warranty
    % z4 W; K1 _4 m; ?0 s8 r4 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 G4 q3 y: H" r- y
  22. * GNU General Public License for more details., d' ^: l5 M7 `' N$ U: z
  23. */2 l$ q6 c/ }* X3 s* L/ V9 `5 s
  24. 5 E; q. B, d, \0 ]
  25. #include <linux/module.h>
    5 J8 |3 ]& o) W
  26. #include <linux/init.h>3 g5 `+ P- R" h# c4 y) D$ ?
  27. #include <linux/errno.h>% p% c- Q4 ^" r
  28. #include <linux/types.h>
    6 L. K! m! [, d. P
  29. #include <linux/interrupt.h>5 _1 k) a. D: q% a% b
  30. #include <asm/io.h>) f1 Z$ c% H/ t, l# O: W2 n
  31. #include <linux/moduleparam.h>2 u0 S" A' n6 q; ^
  32. #include <linux/sysctl.h>
    6 G# g+ M8 ?0 q! m" N: R' A
  33. #include <linux/mm.h>
    4 U" N1 J+ a+ o" s* g
  34. #include <linux/dma-mapping.h>4 m- e% s+ {1 Z3 O& D

  35. 8 L2 j% G- W! z1 [7 }2 f
  36. #include <mach/memory.h>( Y. ~6 M  Y6 h. f" _6 d
  37. #include <mach/hardware.h>5 G3 P+ `2 w( i2 P9 Q) a
  38. #include <mach/irqs.h>
    , c9 h. Q8 i, Y) Q7 E; I
  39. #include <asm/hardware/edma.h>
    $ a+ a7 I* Y$ b& K& n' b
  40. ; t9 ?$ {$ J, J
  41. #undef EDMA3_DEBUG# t( P+ O- u0 X' R/ s
  42. /*#define EDMA3_DEBUG*/
    ! C$ V! h, F1 x7 b# Y4 D

  43. 6 n5 s  }+ F7 [- K# Q
  44. #ifdef EDMA3_DEBUG/ q" {; T" y& S: G% h, E# k! ~9 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 F) T  V- s; A* ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # g. |2 c8 ]* s" w/ V: u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ]4 l! |4 v- M& o
  48. #else
    ' a" U  x, F) ?% ^9 H3 w7 H* G4 m
  49. #define DMA_PRINTK( x... )
    & `  K4 b+ h* r7 m! a
  50. #define DMA_FN_IN
    * `/ G1 b9 |4 h" J
  51. #define DMA_FN_OUT% Z4 ~" w6 _9 P  x- e- `9 _
  52. #endif$ z; Y' y3 J" }4 L. H2 ~

  53. 0 R9 S; a1 z8 s; m) B5 y0 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 e8 y. n$ w6 F4 o
  55. #define STATIC_SHIFT                3+ y* R' K5 h# A5 l% D2 x& m
  56. #define TCINTEN_SHIFT               20+ Z. f# A5 v# d7 B% p0 D
  57. #define ITCINTEN_SHIFT              214 a8 F% r1 w) g1 m" F& J3 j
  58. #define TCCHEN_SHIFT                22
    6 P7 `; m3 {! g2 ^; l
  59. #define ITCCHEN_SHIFT               23
    8 f, V- T9 o5 `6 C
  60. 2 i0 t  J! t+ h4 i6 ?& @7 o1 k
  61. static volatile int irqraised1 = 0;# e) X7 n2 f+ m7 t: p! a
  62. static volatile int irqraised2 = 0;
    / ^" K) c! r  Z' Q
  63.   Q& S' D9 h; f: n+ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# z0 [* {: z: v2 l. D$ g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q9 m7 K- k# M+ z! A# v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - E$ x+ v: `* I$ `
  67. 8 O- |6 Z- z9 i: z/ Z, Q% `5 P: {
  68. dma_addr_t dmaphyssrc1 = 0;
      v& k3 O( _. @) S0 v
  69. dma_addr_t dmaphyssrc2 = 0;
    . ^# m3 G* r9 M( D
  70. dma_addr_t dmaphysdest1 = 0;
      s9 t& S1 \7 ^" t
  71. dma_addr_t dmaphysdest2 = 0;
    7 n2 ^' r  V5 w. J* Q" \7 n2 N" X

  72. 0 p# s  r! `: Z' f& l& d' h  @$ d6 u
  73. char *dmabufsrc1 = NULL;. S6 L2 S" s) p9 j0 ?7 a
  74. char *dmabufsrc2 = NULL;' M+ v6 n' P$ L$ U0 P5 ~
  75. char *dmabufdest1 = NULL;5 o- V; Q4 ^7 P/ }1 u: N. X. Q3 G
  76. char *dmabufdest2 = NULL;
    2 c, \6 b- h9 D1 T5 T! D% w
  77. ' J1 D$ t6 H8 c( e' V  d: Z" H2 y' N$ S
  78. static int acnt = 512;
    ! g, x9 }7 j' a
  79. static int bcnt = 8;
    & A$ P( v2 s6 c# A9 j( f5 C
  80. static int ccnt = 8;
    9 `6 H8 X( v9 O7 f6 z7 A% @5 G
  81. 6 I9 ?9 V; c0 G2 J1 J  }' _
  82. module_param(acnt, int, S_IRUGO);/ k/ N/ D- i7 s: z+ `# V4 Q
  83. module_param(bcnt, int, S_IRUGO);
    ) b; S8 i1 ?: J1 N1 S6 S: [% L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! P  D# i2 K( Q) }7 `- n0 \9 \4 B* k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& v$ \+ d, Y' Z2 F: farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ h/ C* Z1 z% Q; ?4 P& ?4 f/ E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( g* F9 d. o  T) v+ }+ k( l/ z% S
: \) z3 q* _9 Y# N! |& \0 Y0 E4 ~

; b) B* S$ l* b& O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 09:07 , Processed in 0.040481 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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