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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 h5 c2 v" X6 |. i
  1. [code]EDMA sample test application
    / Z5 H3 a% t5 c4 E
  2. /*
    + h: p- S- S9 F4 z
  3. * edma_test.c1 N* ?3 T% Q. F* G+ c
  4. *8 m1 F1 R% O6 e* z! `/ ~2 v
  5. * brief  EDMA3 Test Application3 X- c& w9 v' z
  6. *% O2 g" b; h, P/ \, W3 I
  7. *   This file contains EDMA3 Test code.
    ( o5 T, v7 T4 U6 j  ^
  8. *
    ; p% j# o" q" i8 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( D1 j( l1 d" P" N# g3 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 \4 E( W8 k  R8 f: `! ^. o
  11. *         TO CHANGE.9 B$ D) Q7 Y0 D# L. F; l. l
  12. *
    6 U& T4 c& ]3 z) H1 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 |0 z$ W$ Q% u0 f
  14. *
    1 s* s5 |- Q6 Y
  15. * This program is free software; you can redistribute it and/or- Z- r. k+ I& A( A1 Q
  16. * modify it under the terms of the GNU General Public License as8 t  N- a8 A( Q5 M( G
  17. * published by the Free Software Foundation version 2.
    4 i8 z% m  V. Y( l& A1 h- W; m
  18. *
    ) D' T/ m! T! l9 a  f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , ?4 q: l( Y$ v0 C5 v
  20. * kind, whether express or implied; without even the implied warranty2 _5 c# R& v8 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! l& C2 g6 i9 u, T
  22. * GNU General Public License for more details.& Z9 L. C8 N% b  \
  23. */
    6 w1 y) d$ V5 `! y6 w5 y7 H
  24. : U. M0 o$ b8 d2 z
  25. #include <linux/module.h>6 f7 `* R, w( `: J& ]- _8 o
  26. #include <linux/init.h>& X8 o$ |4 @; t3 w& b) k, T: Z8 }4 s
  27. #include <linux/errno.h>
    4 z5 a3 \6 Z/ i6 u: w
  28. #include <linux/types.h>) [& ^# L0 M5 S, Q3 u* {+ s: a9 W
  29. #include <linux/interrupt.h>2 Z" g* ]3 `+ A! H/ I
  30. #include <asm/io.h>5 Z$ }! G& W5 n, d, B& R" @7 z: I
  31. #include <linux/moduleparam.h>2 j  n3 P( }5 }* l" ~$ d$ D
  32. #include <linux/sysctl.h>
    4 m# e  p$ v) c
  33. #include <linux/mm.h>" X% s' |, y* H5 n0 k! U. A
  34. #include <linux/dma-mapping.h>
    4 T3 e1 Q. ?2 T% r
  35. . G! A9 x% Z/ P& V. j9 q
  36. #include <mach/memory.h>: K+ v! j1 N  k3 o, x5 P( _
  37. #include <mach/hardware.h>9 _; q/ ~! R  t) z1 P
  38. #include <mach/irqs.h>
    ( d/ Z* O$ k) q5 q8 C9 W
  39. #include <asm/hardware/edma.h>
    , `" a0 `4 ?% C: ~/ z: Y, T

  40. 8 V  l9 i3 G, n8 ^! \5 B+ g( T- {
  41. #undef EDMA3_DEBUG
    5 f7 X/ l; x* |
  42. /*#define EDMA3_DEBUG*/! c  j4 o# W0 I

  43. . \5 P  v2 }9 u+ E+ U; G' J! G
  44. #ifdef EDMA3_DEBUG& t" _, G( d) W9 Z* R, S6 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): V. D- j3 I3 [9 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 @) v3 I* a% m5 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # b+ g/ u: x8 {! P
  48. #else3 H' ?9 d3 o* n9 G' g3 l
  49. #define DMA_PRINTK( x... )3 n' G0 \# w. N/ U
  50. #define DMA_FN_IN
    0 A* V" _1 u0 Q) U
  51. #define DMA_FN_OUT7 \8 H5 B" P" X* P, h! i! V' p
  52. #endif
    # j0 `' A: o) G: P( @$ E! L

  53. # b# y- _# C" I0 k9 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' h: o0 q$ h( L
  55. #define STATIC_SHIFT                35 b) y) s1 v% j3 M
  56. #define TCINTEN_SHIFT               20
    . R0 q0 b4 ]5 I0 W- B) f
  57. #define ITCINTEN_SHIFT              21
    8 x; M, x; K: O  ]2 D7 G9 u
  58. #define TCCHEN_SHIFT                225 O3 J( c7 A" q, ?( Y, H
  59. #define ITCCHEN_SHIFT               23* U/ @* ?. |, x! Q7 \7 e4 J3 O4 Z. \
  60. $ D6 N& W, k, ?- k
  61. static volatile int irqraised1 = 0;4 s% P% Q+ `6 Z$ W8 f
  62. static volatile int irqraised2 = 0;
    ( m3 m% o* Z" e  H8 b

  63. % M# i# V, x* O6 O; _9 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Y2 {% l* b5 x( |  z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& S- K% v) f& A! p+ d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # I' V' ]% m1 ^, h+ Z

  67. ) S4 n0 v/ _1 D; |' [- `% b
  68. dma_addr_t dmaphyssrc1 = 0;4 o8 E  b6 h1 |+ p" O! `) W
  69. dma_addr_t dmaphyssrc2 = 0;# T* ?5 {3 [9 ^3 V- r& K: P
  70. dma_addr_t dmaphysdest1 = 0;
    & G* v4 C! E1 A7 a
  71. dma_addr_t dmaphysdest2 = 0;: d! y5 W3 H8 O
  72. 9 w  y' @  z' M8 E' R* I) a
  73. char *dmabufsrc1 = NULL;
      a6 W+ v% y$ u8 g- @9 J# E" y& ?
  74. char *dmabufsrc2 = NULL;- X" O/ a, n9 M9 D& c; A; n1 H
  75. char *dmabufdest1 = NULL;
    ) }( t. ~+ F# ?2 ^- \" U4 z$ K
  76. char *dmabufdest2 = NULL;
      Z, H6 N) H" }/ l' a7 M8 t

  77. 0 Q) {; E2 @/ I7 O+ U1 v
  78. static int acnt = 512;+ w2 |$ {/ l2 @5 D( ?" J! C0 l  W* r
  79. static int bcnt = 8;1 C& ~% k3 z0 f4 B# L% o0 {9 F
  80. static int ccnt = 8;  p- u( ~: F, |% |

  81. - @( W: D3 P7 H. x7 P+ i8 C' ]8 m: [  E
  82. module_param(acnt, int, S_IRUGO);3 L7 l5 f( S1 {5 \1 |2 @" q
  83. module_param(bcnt, int, S_IRUGO);& z  A9 h9 q: t, q8 H, m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# U6 v2 l- a2 `8 @; [+ I) j4 `* i  i3 h5 v: n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ t1 |( l$ I# e* B4 F7 q% {' [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ^+ @# y# w; G" _: U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ]7 T& f  b; n  n( d# U. G, e& ~5 x/ V! E% b
  Q: q0 @5 Q  f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 09:04 , Processed in 0.049584 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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