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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ h) r4 q+ Y, I
  1. [code]EDMA sample test application: W' A* J' T8 A; y4 i) t0 w( I
  2. /*
    # `" c8 t; @+ h. l( N- i+ Q
  3. * edma_test.c
    3 ?: V6 n" r& a3 @8 n
  4. *
    7 E! I) w9 \- ]6 }  l. q
  5. * brief  EDMA3 Test Application, `: K# E9 G2 g$ i
  6. *4 `% z' t3 j6 P( A. i0 u4 k
  7. *   This file contains EDMA3 Test code.
    / q" ^( n" b: }- z: q3 h* z+ d7 ]
  8. *% l8 j; M4 M# t( u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! |7 s8 n4 h' }. ?& |6 c; P4 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 f9 q; N3 P: m; A1 x
  11. *         TO CHANGE.
    : `2 f0 u& \! b
  12. ** U8 q; M9 C; D0 p$ w5 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f& [  }0 h; k  B6 \6 U
  14. *' _2 `/ O( e; z! r5 w- _/ E
  15. * This program is free software; you can redistribute it and/or
    * A; i2 @+ I# E% ~
  16. * modify it under the terms of the GNU General Public License as4 w8 }! F( _' k8 I
  17. * published by the Free Software Foundation version 2.
    & n& U) }# q- v* I
  18. *  i9 l7 A  [1 n: A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ s+ ~/ ]2 e4 r
  20. * kind, whether express or implied; without even the implied warranty
    8 u# W) d0 G- Q  `; e! E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. i5 N. N  @" q* }1 W" C1 V8 l" m
  22. * GNU General Public License for more details./ C: i# {9 E! D( i; ~5 z) `# H
  23. */
    + p( S/ Q+ ~. [, w  d# M/ E# k, q

  24. * M$ o$ d) M# o: T  Q
  25. #include <linux/module.h>/ H- v0 @/ W! B! G
  26. #include <linux/init.h>
    % M9 _+ D6 y, q, Q8 X! S
  27. #include <linux/errno.h>
    . W9 U9 O8 j. z' I
  28. #include <linux/types.h>' \9 w* E; Y4 s9 Q1 U. \% ^
  29. #include <linux/interrupt.h>
    5 b# A, e% y) [0 G: L& K) a
  30. #include <asm/io.h>
    $ J$ j2 ^) x1 q) L7 ~" U- Z
  31. #include <linux/moduleparam.h>" Y6 ^/ s5 p$ p9 Z3 ?7 e5 z& s
  32. #include <linux/sysctl.h>
    3 Y$ i2 N; Q: N" t  b
  33. #include <linux/mm.h>) Z& ]( X' o4 o$ t9 V! r
  34. #include <linux/dma-mapping.h>' J  K( u9 }- G% d) w2 D) {

  35. 6 K; h; d: N8 M! {/ Y1 ]* D
  36. #include <mach/memory.h>& }' p+ v2 i1 a& I2 R
  37. #include <mach/hardware.h>
    - \' h% z$ O8 ]) O
  38. #include <mach/irqs.h>
    . ]) }0 q, {' [- E
  39. #include <asm/hardware/edma.h>0 a4 A; q3 G& O" h4 a% c# P

  40. $ \# q0 @$ n4 E3 V  p5 g* G
  41. #undef EDMA3_DEBUG
    8 u; G2 P. {% j  L7 P
  42. /*#define EDMA3_DEBUG*/8 a6 s. V+ z3 X
  43. 9 ]; c, g& ?  j% y
  44. #ifdef EDMA3_DEBUG
    & G9 C% h! Z& ]; f" s; m0 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 F% L  X2 W) q5 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + S% W. E( O8 g1 Z3 ^7 r; X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 i/ F7 e# B6 Y
  48. #else2 a8 p7 {& a( y+ c0 b7 ~
  49. #define DMA_PRINTK( x... )
    ' t. d2 ~/ x0 l4 i! y
  50. #define DMA_FN_IN
    ) f3 ~& }6 P$ F5 l5 a
  51. #define DMA_FN_OUT
    ) I  i1 m) l3 ]7 J9 Z: a* }
  52. #endif$ K) w( x2 Y  I/ R8 S

  53. $ }6 I: C! U0 H6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ q  z$ v6 w5 ^0 }2 H6 Y
  55. #define STATIC_SHIFT                3
    - l" d+ H4 m) r* {9 `
  56. #define TCINTEN_SHIFT               204 ?2 o/ _( ]7 C, u. K. b5 N2 ]
  57. #define ITCINTEN_SHIFT              219 G5 `3 U8 J2 {. o- X
  58. #define TCCHEN_SHIFT                222 H) ^9 j' \( Z. j* E6 e% W
  59. #define ITCCHEN_SHIFT               239 I/ P$ [( I2 x* V5 n

  60. : V0 k8 v  y/ l6 i+ z
  61. static volatile int irqraised1 = 0;. R( A, e& D9 d" H# ~' N( O" F
  62. static volatile int irqraised2 = 0;0 H. q' P$ y; Q0 l
  63. % H2 U: g$ ^' c0 p8 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _7 N$ I  Q* Y; i4 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      G8 e: M  d( h0 A+ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L7 F6 n3 ~. r: v4 u- c
  67. ) }" r  |2 K' a( T
  68. dma_addr_t dmaphyssrc1 = 0;# K; r. w7 F  ~4 H
  69. dma_addr_t dmaphyssrc2 = 0;
    - w! m7 I" \' |. U; Y: ^
  70. dma_addr_t dmaphysdest1 = 0;
    $ J* @" U- \, G  o9 d* A
  71. dma_addr_t dmaphysdest2 = 0;3 X9 a. E0 [5 R& {
  72. 8 U! e4 D0 A  p% ]8 t+ |
  73. char *dmabufsrc1 = NULL;' e) |6 b5 ?( a' G
  74. char *dmabufsrc2 = NULL;, j  V) y! ~& Q& A
  75. char *dmabufdest1 = NULL;; V& d' e- j- V5 S, U. i2 y* V
  76. char *dmabufdest2 = NULL;
    2 S$ w) N+ T0 r8 r
  77. / A" c# }  G3 U6 o  b; B& {
  78. static int acnt = 512;
    . k) I; ~0 |" @, c
  79. static int bcnt = 8;
    7 A; f! m, y  \
  80. static int ccnt = 8;
    7 R8 ^4 j9 f. V0 B2 ~1 C  V

  81. $ J9 S" s7 k: @- a# O
  82. module_param(acnt, int, S_IRUGO);
    9 ^7 V+ S' Z8 o* d! c- x
  83. module_param(bcnt, int, S_IRUGO);, V; B* H: t8 I  Q8 Q, {9 h0 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( Q+ _4 y3 P3 C! x; W; Q3 {- N/ V2 g# G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* n% N) R: J+ k! v: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, t/ d$ c. {& m! D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% M. y. q! u, R2 G& J1 H! C

1 q8 o! A9 m2 h" P/ @- ~* v+ a; |0 }- I8 A5 h# G5 T0 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 22:23 , Processed in 0.039256 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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