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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - j( G' S$ G& w! J+ a
  1. [code]EDMA sample test application
    8 ]) t: E, d* e& A% Q8 A
  2. /*& V3 A7 W; [4 c* V; b
  3. * edma_test.c4 F4 V: d; }) B, ?" @1 d
  4. */ n! i' S' ]  X3 T) y( z
  5. * brief  EDMA3 Test Application2 n7 L/ P: R9 F' N( c+ Y
  6. *
    ! Z8 w2 N( X7 ~1 ?+ ]+ _
  7. *   This file contains EDMA3 Test code.8 Z7 r' M$ m! @. {
  8. *
    , g) l0 L  {2 v  i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% S8 [( X: I" M- S6 s" R4 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( C( O5 R7 c7 R3 ?. m6 y
  11. *         TO CHANGE.
    & u* v, j1 F- i+ k0 b  [$ d5 i
  12. *
    4 t5 U2 t2 Y# X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % }: j# q! j) i! H! [. O1 g. y
  14. *$ X! u: A1 q  z* B+ ?3 H1 {
  15. * This program is free software; you can redistribute it and/or
    " `1 T2 O' L8 H* ^) O
  16. * modify it under the terms of the GNU General Public License as5 t1 ~/ N( P) s, C9 A
  17. * published by the Free Software Foundation version 2.
    , A9 A4 k( V. _+ z4 j
  18. *
    % p5 e$ I( [) U$ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  h  R0 \. }* p2 t' e
  20. * kind, whether express or implied; without even the implied warranty/ `1 E3 @& t2 h1 r- }" e$ A+ O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # r' x; j, l' Y# w
  22. * GNU General Public License for more details.
    # a6 l2 v- z9 j3 ?$ s, K
  23. */: `' Y. F. d% R

  24. , H0 _  H8 F6 o7 J/ r
  25. #include <linux/module.h>: y0 M- J; q; j% @+ l* `5 ]
  26. #include <linux/init.h>7 {# J& a1 K1 H: d3 |' J+ d
  27. #include <linux/errno.h>/ Y' r# s. Q5 a) T1 j2 Z
  28. #include <linux/types.h>2 Q. n0 ]5 u* [+ B& K8 T
  29. #include <linux/interrupt.h>
    , a9 I/ O! @! F
  30. #include <asm/io.h>
    ' M3 }2 t( B: A9 M) [' \) ]& \
  31. #include <linux/moduleparam.h>' ^. }) u+ a1 F
  32. #include <linux/sysctl.h>
    3 O$ }: e3 K7 }9 Z' l+ F
  33. #include <linux/mm.h># }3 w0 ?7 X3 \- ]
  34. #include <linux/dma-mapping.h>
    8 e  t( b- o. _  |0 n
  35. ( ~2 c( r# J% F. U; H9 V" j
  36. #include <mach/memory.h>7 D8 t8 F7 Y6 V) H- S4 s
  37. #include <mach/hardware.h>/ @! Q8 s0 B- ~, C2 x- _1 B
  38. #include <mach/irqs.h>9 M2 @, l0 l2 j, u$ @* X7 [
  39. #include <asm/hardware/edma.h>0 |3 D$ u2 y: |$ C# [

  40. , F6 a1 f; s0 q. b+ Z% X7 Q* z8 q0 C
  41. #undef EDMA3_DEBUG
    % \7 t6 o0 s5 F( q0 @: ?  \
  42. /*#define EDMA3_DEBUG*/
    4 A- E$ P* k8 H0 y! [

  43. 3 ^% M% w5 Q  k) ~4 Y. P" C$ m
  44. #ifdef EDMA3_DEBUG* A. r' @6 W: ]+ R/ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : y2 \+ o+ [3 e* V* i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) V/ R0 A' U! @1 Q) c* t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 ?" v! u) m9 d
  48. #else4 D/ R% c- e1 q
  49. #define DMA_PRINTK( x... )( T2 N( l" |/ N2 \7 D7 l
  50. #define DMA_FN_IN$ Z( V9 e8 `- l1 @7 m
  51. #define DMA_FN_OUT& E9 h( D' N6 C, Z+ \+ S0 Q; b( M
  52. #endif
    ; r3 w7 [& l# U* v& v- r

  53. 9 g# |. W% l. y( v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 N* V: T# `& Y$ }& {; X" F* D' M- r5 Z
  55. #define STATIC_SHIFT                3" O7 O. f6 G: Q1 Q
  56. #define TCINTEN_SHIFT               20+ N# O7 ]$ ^- `+ d
  57. #define ITCINTEN_SHIFT              21) X. X6 j7 X- B3 J1 R
  58. #define TCCHEN_SHIFT                220 s# x9 \" F' J1 s- u, }
  59. #define ITCCHEN_SHIFT               23
    , a) r* @# V9 e$ O

  60. ; J$ W: b- u* T9 S+ }# P+ N
  61. static volatile int irqraised1 = 0;
    $ W7 c: j; z, U9 J0 `5 L
  62. static volatile int irqraised2 = 0;8 h& i. S) @" ^5 M+ x  d
  63.   K% W# \4 r. @+ g( ~+ y+ t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 K& P$ F4 O" \4 v% w7 g, h. z% \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 n8 z  C- @7 B* \3 t. t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. {$ v3 _; u# w

  67. & k  {6 n4 Y" @, D* `& i7 @( w
  68. dma_addr_t dmaphyssrc1 = 0;
    ' M: Q, C0 {1 v3 K" f
  69. dma_addr_t dmaphyssrc2 = 0;& ^- D5 {6 _. H* f
  70. dma_addr_t dmaphysdest1 = 0;
    * A7 O1 k! ~) W! y& @
  71. dma_addr_t dmaphysdest2 = 0;# ^: t7 P  n" c* B  N0 s

  72. " N/ D6 _+ }+ H/ m2 R, o0 B
  73. char *dmabufsrc1 = NULL;
    3 R6 V: y) H' b! Q
  74. char *dmabufsrc2 = NULL;
    . N0 j! h, k+ ]' q6 T9 e9 `
  75. char *dmabufdest1 = NULL;7 O4 l2 u8 |# b- v* X( C" T- E
  76. char *dmabufdest2 = NULL;2 R# F! e9 g( K  @0 p" Z
  77. , {! k/ e% D- N) E9 |
  78. static int acnt = 512;
    & l/ Z7 q8 P8 c7 s- S
  79. static int bcnt = 8;
    & c0 m7 b& a' Q& M# C
  80. static int ccnt = 8;) L5 `* z" D% u1 x

  81. & H" v6 Q7 T7 g- ^; Z  B( }
  82. module_param(acnt, int, S_IRUGO);
    : X! p5 Z& m/ r8 B0 |" h. U
  83. module_param(bcnt, int, S_IRUGO);
    1 e6 E1 Y4 _" ]5 ^! d! M& J) J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 j- v# q- [, P! L( t" B& H

1 n1 T! n1 u3 ]. x! K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ g# l. e( O8 ^+ o2 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) L$ a2 S. Z: n8 k! {% I+ Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ [3 x/ i! a4 x, p8 D

9 S/ p4 s, A8 k, ?+ A) p
  C# o& f' C/ F+ F0 h& u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 23:32 , Processed in 0.043752 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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