OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   ~4 O$ O' g+ n( S7 U2 S
  1. [code]EDMA sample test application5 U8 ?$ b/ z# S( a
  2. /*: Z  }, j! n9 Y' X
  3. * edma_test.c
    1 n1 ], m# l0 n" \8 t
  4. *
    8 U4 {4 M* f2 z8 s7 U- S
  5. * brief  EDMA3 Test Application9 [8 m. ^1 V) a7 v7 Z6 l
  6. *7 G$ q; [1 k  p0 [. P
  7. *   This file contains EDMA3 Test code.
    % O7 s/ M7 E3 M1 u/ a* V
  8. *
    8 W+ c9 `/ t# n8 l- V8 ^2 V& `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " l$ y, g7 P: j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 F# i$ a  m+ k
  11. *         TO CHANGE.; }% V: {2 M/ }) H/ n+ |
  12. *
    ) R, X% E9 x3 [/ `0 R; j( ^) ]  y3 Z# p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 i7 n) v* r  z! |  u% X1 D9 U
  14. *
    + f6 a* c( q. D  Q
  15. * This program is free software; you can redistribute it and/or
    & u9 h8 h' z( z) p9 i! K: M* u% H
  16. * modify it under the terms of the GNU General Public License as
    ! H9 j" v, I9 \" T
  17. * published by the Free Software Foundation version 2.! h: D4 p  f/ D/ f6 o
  18. *8 X5 \( j+ }. L; V2 ]( G# @% r9 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 F# \" \( @1 q0 y( o
  20. * kind, whether express or implied; without even the implied warranty9 H9 c3 K1 O: _+ A6 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 {, F# _5 R8 y5 }2 M
  22. * GNU General Public License for more details.4 }  N$ I2 u9 h
  23. */$ [, ?( p# O  \* l( ~

  24. ( P$ k4 |# d, C% i2 }
  25. #include <linux/module.h>7 [5 x/ s' r: ]" n- v9 H+ ]9 G+ y
  26. #include <linux/init.h>5 Q7 G" n( ^% c6 X
  27. #include <linux/errno.h>
    0 Y1 R5 R7 \0 }
  28. #include <linux/types.h>
    5 M/ S9 i, n9 W/ U, b# v7 o
  29. #include <linux/interrupt.h>
    6 r1 _9 i" O: |! o. H) I
  30. #include <asm/io.h>
    7 q' D" H' \. v& C8 L
  31. #include <linux/moduleparam.h>5 T4 A+ B. H3 Q
  32. #include <linux/sysctl.h>
    ! }, ?. a2 n& e
  33. #include <linux/mm.h>
    % |1 J8 Q2 B# b3 l. M6 X( `6 }4 y. _3 d
  34. #include <linux/dma-mapping.h>
    # w* t, f; @- V  f7 Y: }  y

  35. $ W$ ~# J- p2 }* ^9 d7 l
  36. #include <mach/memory.h>% j! h" z' P, a4 [
  37. #include <mach/hardware.h>
    * y% r8 T4 u+ g: p
  38. #include <mach/irqs.h>
    2 L. N5 I. J3 a/ g, t9 A1 N  _
  39. #include <asm/hardware/edma.h>
    + u  A9 v* Y" e' O+ `4 Y8 w& [
  40. ! N/ u2 H# |* W1 h
  41. #undef EDMA3_DEBUG9 x5 m- f. w2 g  A/ C% c/ g
  42. /*#define EDMA3_DEBUG*/
    8 T! X1 V  z( m, G5 O

  43. 0 a8 x# D' M( x, H
  44. #ifdef EDMA3_DEBUG
    8 m9 [" i$ G: p. G8 Q: Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N# y! {3 ^. V8 R2 ^9 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) Q/ r  ^. A/ t6 l- W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ]% ^, t$ N8 \- \
  48. #else; ?# l  }: I1 C
  49. #define DMA_PRINTK( x... )
    3 @) v* |0 V7 ]/ I
  50. #define DMA_FN_IN6 `9 Y8 M. B! s! Q% P, L
  51. #define DMA_FN_OUT9 U- r4 |1 q) u0 I
  52. #endif
    # `. U) @7 Y; U# o. U, S- Z; Y+ F

  53. * X- h% I; n8 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  W9 d: [7 U2 L* X0 t9 n% B  k
  55. #define STATIC_SHIFT                3
    + Y; V, Z! ]1 M% ^) R- A% a
  56. #define TCINTEN_SHIFT               20
    2 ]1 V' V5 D9 K' N, Y
  57. #define ITCINTEN_SHIFT              21( ?! e5 P" A) ^& h$ B
  58. #define TCCHEN_SHIFT                22: \3 J8 q* N% _4 h' {' H
  59. #define ITCCHEN_SHIFT               236 ~/ E0 A) V; P0 Z. R- W
  60. 9 \; w! t% ~% h9 Q
  61. static volatile int irqraised1 = 0;
    ! U% |7 _4 i/ w4 `% T- z6 R# A
  62. static volatile int irqraised2 = 0;
    & M; m6 C$ U9 Y

  63. . E6 ~$ x9 ]0 k& S) ?3 x" |( J) M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : m5 M6 h; `3 h- Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! O# C" ?4 _7 }- p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! u5 J$ J, T7 e% T

  67. 9 b; q0 ?0 ~7 O# Y+ k: y
  68. dma_addr_t dmaphyssrc1 = 0;
    ' j% f! f. J$ F1 o
  69. dma_addr_t dmaphyssrc2 = 0;
    ; Q! \% w/ e, j. O8 l. n. D9 W
  70. dma_addr_t dmaphysdest1 = 0;
    ) }' H% d  U5 C
  71. dma_addr_t dmaphysdest2 = 0;; B& u9 |- `. o) V

  72. 9 N3 ?0 ~8 x) j3 U
  73. char *dmabufsrc1 = NULL;
    5 |9 J- p  Q- ~; l0 N+ u% M5 N+ {
  74. char *dmabufsrc2 = NULL;
    8 u) o+ m/ Z2 s3 U' u
  75. char *dmabufdest1 = NULL;9 z! `7 H) T/ y3 ]7 x
  76. char *dmabufdest2 = NULL;1 ?( U' t: a5 p3 ^" {

  77. , x! F# w$ X: j  ^* z1 i2 r
  78. static int acnt = 512;
    # ^+ U! c+ N4 R! F
  79. static int bcnt = 8;! @* D0 M( I. b5 A
  80. static int ccnt = 8;
    - v; M3 u2 c/ a8 j

  81. 6 `. d" }4 F+ s- s% e
  82. module_param(acnt, int, S_IRUGO);! }( t& [0 q' i& U4 m# I! i! H1 L
  83. module_param(bcnt, int, S_IRUGO);
    / O7 H) L8 E3 M3 A. M% h- |# e9 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; Q: r. h. z" ^6 f
/ B$ V( Z( Z2 i' H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% I! A% o! A8 ]' ?) {
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& a: `$ X, v: b! w( H! S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; m1 S# f! q) c, l
) O. G2 f) ~; C, w& G: ~; `

6 r: ~) H) ~# x! A; O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-13 07:01 , Processed in 0.038116 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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