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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 [4 @6 L0 H  w: P1 ?
  1. [code]EDMA sample test application
    ! Y- ~/ B* h2 H
  2. /*
    / E, \7 E  y3 P1 f* L
  3. * edma_test.c% ?0 M* y2 H: K. `+ ~  L
  4. *8 K: Q" \6 E3 L7 c# [! j9 t! s' p. u
  5. * brief  EDMA3 Test Application3 `' @, o; L7 D+ o6 Z! F
  6. *
    7 o' A* g$ O1 u6 H) \
  7. *   This file contains EDMA3 Test code.
    " L8 M3 X6 G+ j$ C2 R7 y9 e+ S" g
  8. *
    : r+ `: r( M  H- {% t$ J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 x% H# r* i. O% Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* y. f/ X; V' `  V
  11. *         TO CHANGE.0 p6 B& \9 c4 Q
  12. *
    " S1 y. E8 p& ?' V# E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 l  A& F' S. X: W; g- L  m; [
  14. *
    : n  i# @; b) h( \7 K$ `2 G# W2 m
  15. * This program is free software; you can redistribute it and/or
    ' L& T$ u% M4 [; P! d9 c
  16. * modify it under the terms of the GNU General Public License as
    * V$ s1 C2 C& |, V5 w6 i
  17. * published by the Free Software Foundation version 2.1 F4 A( k+ a) U' y# B/ w
  18. *
    5 {3 r/ {8 f9 v! O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # `, M/ N7 g- o  R2 I" \
  20. * kind, whether express or implied; without even the implied warranty! k. e4 R. t1 P- e, a1 N9 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# Y0 Y3 F, L/ T) m8 K+ K9 c. x
  22. * GNU General Public License for more details.
    0 J7 e1 J, @, A. k
  23. */
    ) K4 o1 p) {3 Z" p# x6 t, y
  24. , Z2 k/ V2 a" l# |
  25. #include <linux/module.h>' K& X  D' e- W! q8 O! f& [
  26. #include <linux/init.h>
    ; G( K8 ?3 T1 w2 l) h
  27. #include <linux/errno.h>8 |8 c8 m$ f9 a. L2 ~
  28. #include <linux/types.h>
    8 f3 t2 k2 a! Y* ]
  29. #include <linux/interrupt.h>
    ( A+ Z. M  I' \; G, T
  30. #include <asm/io.h>  {" a% K* d7 ^, V
  31. #include <linux/moduleparam.h>' E% _$ C7 k" q+ w& P: o
  32. #include <linux/sysctl.h>
    # d1 u) ?$ k: U+ n+ H3 F
  33. #include <linux/mm.h>
      c5 F4 _3 q' ]4 U& y8 o$ k
  34. #include <linux/dma-mapping.h>6 Q- A( e# j0 J! m4 T6 M2 d
  35. + c4 v) X( R0 H( F2 z. z
  36. #include <mach/memory.h>3 W# C# I( z2 d4 ^# B9 [
  37. #include <mach/hardware.h>
    * h3 X, J7 p( x! r% i- g& _
  38. #include <mach/irqs.h>
    # m3 X! I! [8 l0 l) N
  39. #include <asm/hardware/edma.h>  ?7 J; n  C. O3 \5 \

  40. 9 E+ l- v- B. B5 R
  41. #undef EDMA3_DEBUG9 A  T1 e# s2 `6 T
  42. /*#define EDMA3_DEBUG*/
      p% s- k* l4 ^9 T( r8 K8 h( I

  43. " t0 n8 u, I2 V9 v- Z: O, F
  44. #ifdef EDMA3_DEBUG
    & s. ?" g5 ?4 Z! p6 H6 B. C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & y# v- I8 ~1 R+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( z9 X" |! }4 t* Y+ ?- a% |0 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). l) p6 }) Z( l6 L9 w
  48. #else: f& E' H+ }3 y' e
  49. #define DMA_PRINTK( x... )
    ) i' i1 V1 }8 f3 ^$ s
  50. #define DMA_FN_IN
    1 a' ~2 ~! v% C4 |; _4 \) o6 U1 R- E, C
  51. #define DMA_FN_OUT
    + h$ \' d* ~3 p/ D2 g% D' n
  52. #endif
    ) u( m( d1 p! I+ e/ u+ _1 k7 D1 B

  53. . M9 Z9 K! h& v, Z! h: l1 q7 r8 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 l# F. P3 e) ~. F. x* w
  55. #define STATIC_SHIFT                3: h8 y. h! `2 R4 i5 j
  56. #define TCINTEN_SHIFT               20: M( M6 s  M. h% Y
  57. #define ITCINTEN_SHIFT              21& r& n. x0 r5 u! ~6 J
  58. #define TCCHEN_SHIFT                22
    2 @. D$ i& g+ P0 T) g: N0 ^
  59. #define ITCCHEN_SHIFT               23& {0 L( {. J" q7 \, R$ }

  60. 3 m2 D1 N3 Q7 E
  61. static volatile int irqraised1 = 0;6 l8 G" Y4 \( F6 \- B* W  c5 I9 V8 A: G  `
  62. static volatile int irqraised2 = 0;, `$ x( K9 x3 o' }8 Y
  63. # P% n6 G  P. M) w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 |" [% Q' X+ ^" R$ s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D8 u4 f, X1 V. j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B8 L9 n. D, e

  67. ) l$ y6 K/ ~0 j& I+ {/ h$ H8 }8 g
  68. dma_addr_t dmaphyssrc1 = 0;6 R9 |$ o  w) g. t' A  t# G  R
  69. dma_addr_t dmaphyssrc2 = 0;
    , g% C$ K) ?/ \
  70. dma_addr_t dmaphysdest1 = 0;, ~8 g' y4 v8 C, u( H' P6 i
  71. dma_addr_t dmaphysdest2 = 0;" Y* i0 y6 K* w2 [& c6 i
  72. 5 `# s1 @$ f4 n3 D- L
  73. char *dmabufsrc1 = NULL;8 O# H9 u( j. C7 u! Z3 O% ?
  74. char *dmabufsrc2 = NULL;  i1 h! H" o( ~4 {9 V- f
  75. char *dmabufdest1 = NULL;
      D/ C* i$ s0 E( }
  76. char *dmabufdest2 = NULL;
    : `4 S$ U( J6 @3 B) u# _

  77. " G* `3 _/ N) j6 x) e/ H# [( u
  78. static int acnt = 512;6 e( {' ]  J8 A. ~5 f8 P$ C$ H
  79. static int bcnt = 8;- h  {- V! E7 t$ i  u
  80. static int ccnt = 8;
    + K. Z3 e! [/ ^+ I; O

  81. - u2 A  Z% ~' H2 o4 i
  82. module_param(acnt, int, S_IRUGO);
    4 f% I2 B% V$ i2 o' L- z
  83. module_param(bcnt, int, S_IRUGO);7 |4 l  l7 f# A  j0 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ ]3 n9 v7 F5 o; w( W) G+ H; p
- P& e8 b! g7 V, y- A$ x5 U. N% }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. X( u7 o1 e; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' y' x; h( o' Z1 E5 H: ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 T; e& y2 |+ x4 ^  Z1 Q

6 q2 \) v5 J+ Z7 f( @
2 a- d, \; [0 D4 P4 Y4 {6 p% e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-20 04:58 , Processed in 0.038957 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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