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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- d% f( m1 ]8 G% H
  1. [code]EDMA sample test application
    % M6 v$ o$ K/ R$ ^
  2. /*
    % ?1 a- O9 \8 w, j! ~- m& j
  3. * edma_test.c6 K3 f6 T' y% [$ s1 p) f2 R0 v. o
  4. *
    & k9 y- [; w/ o# Z1 \* Y
  5. * brief  EDMA3 Test Application
    $ G- f" Z! ?! `! T6 P3 G/ S/ s
  6. *
    4 P- i" E. ?$ F
  7. *   This file contains EDMA3 Test code.. |& O) w# n8 v$ m9 _
  8. *9 R; E4 ^1 f- N! ?/ z( t! K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 h% Z$ |& t- ~% S+ k, M& a( X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' h2 O, Y8 f) e/ C, D7 m" t
  11. *         TO CHANGE.& Z/ Q; A$ c" e1 p7 T
  12. *
    " m  B. z9 r. p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  T( e( ?, Q+ o& L
  14. *' ?$ R; ~$ m9 {, M" o
  15. * This program is free software; you can redistribute it and/or
    ( {6 ~5 @0 A8 o. O- l6 G2 m
  16. * modify it under the terms of the GNU General Public License as
      e- @6 k9 z: @
  17. * published by the Free Software Foundation version 2.$ Y/ h. E$ `" s! [$ R3 h
  18. *
    ; F7 K! E+ i8 `! [9 d8 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ _# g) Q& E3 V  p5 d
  20. * kind, whether express or implied; without even the implied warranty/ j5 a5 J; n- O+ f% h7 P/ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . E7 a9 a8 t: W9 j- Y# D1 N
  22. * GNU General Public License for more details.
    , o7 R# z' @- P8 e
  23. */
    ; _( \, \2 `9 |# r4 \: {
  24. 1 l& w0 v' V: m( l  t
  25. #include <linux/module.h>5 z5 ^2 {0 ]/ d7 v1 [5 M: j, ]
  26. #include <linux/init.h>
    $ H9 R& |( }& U/ G/ v# f
  27. #include <linux/errno.h>  R8 P( t1 j5 J
  28. #include <linux/types.h>; l+ x% z  S5 Y3 n1 D4 _: q! V. X2 f
  29. #include <linux/interrupt.h>
    4 a. l7 g' j  R- p3 u: H
  30. #include <asm/io.h>
    $ B* U6 i, {( |# |8 k
  31. #include <linux/moduleparam.h>; A  {/ G9 }2 H3 r3 _) s
  32. #include <linux/sysctl.h>: d3 j8 w2 O" _* s
  33. #include <linux/mm.h>5 {9 U0 `( y7 `' s! k
  34. #include <linux/dma-mapping.h>7 W- g% i& K& j2 ^* s6 E/ v3 o' n  @

  35. " q7 V( t7 T9 K! p% T  i2 B4 Z
  36. #include <mach/memory.h>
    ! S3 q* I4 k- T
  37. #include <mach/hardware.h>0 V+ k! q3 M6 m0 E9 d
  38. #include <mach/irqs.h>1 q7 N( [/ u, g( }! _
  39. #include <asm/hardware/edma.h>" {( t; g+ |* r' @% V
  40. ( z! I0 M% ~. E; X$ G% l7 P$ z# |
  41. #undef EDMA3_DEBUG- n7 Z! d" T' J4 V& L3 \) U
  42. /*#define EDMA3_DEBUG*/3 R2 R: Z, L6 _4 I

  43. - U1 W* d1 f! l$ i( \
  44. #ifdef EDMA3_DEBUG
    ' W8 V9 O8 }1 c/ d1 |9 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! \/ J9 K' h9 r0 q1 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : M- y! c1 h1 i: V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ j) z0 e; v1 M5 `, O; l/ [
  48. #else2 L/ j5 }* }9 U" u& w
  49. #define DMA_PRINTK( x... )7 ~9 O# b4 N: A" N+ y1 p3 B7 m
  50. #define DMA_FN_IN7 o% h2 f* S. W6 k% u
  51. #define DMA_FN_OUT9 Y9 W" U- L/ {7 P. h" P: o( x( E/ P
  52. #endif: M# H. t- z5 m

  53. 4 k" h# M! I+ e9 t& @0 \: i# I- n% ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + g9 m: X; u6 n- D8 k
  55. #define STATIC_SHIFT                32 q9 ~  q0 M, v" n% d; b: g
  56. #define TCINTEN_SHIFT               20
    : \2 Z* ?; p7 O0 r( u
  57. #define ITCINTEN_SHIFT              211 l- x8 g% k- O7 M+ t: f( d
  58. #define TCCHEN_SHIFT                222 i6 ]& R  ~! |% r9 G
  59. #define ITCCHEN_SHIFT               236 F! r! k0 @2 L  C
  60. ! J5 J: b9 `/ m$ w) e5 h
  61. static volatile int irqraised1 = 0;
    3 ^  B8 p# q' R8 g
  62. static volatile int irqraised2 = 0;
    : K; `, N4 X2 ?8 R
  63. % Q$ f8 v$ w% n! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 N& q" X' C; x6 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T6 J  S5 L, t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^8 G( _5 [. ]+ d; `) g* h) s
  67. 2 {6 @$ ]+ T" o6 k
  68. dma_addr_t dmaphyssrc1 = 0;+ f3 G0 W* Y# S" P3 j/ B1 b& U
  69. dma_addr_t dmaphyssrc2 = 0;
    ( K2 J( f# e# T; [# q, E) Q7 d5 D
  70. dma_addr_t dmaphysdest1 = 0;2 ~: ?7 L2 [# H4 @1 t) ~/ i5 M
  71. dma_addr_t dmaphysdest2 = 0;
    * e9 @# ]# x" @0 F$ I, f# E. E

  72. 1 a- t7 y, {  ~+ \  U
  73. char *dmabufsrc1 = NULL;
    . j$ r; {! k1 e- v" ]7 s$ d8 r/ d
  74. char *dmabufsrc2 = NULL;
    - L4 m& i, m: z
  75. char *dmabufdest1 = NULL;
    . g- ?; V; `4 K) a7 r
  76. char *dmabufdest2 = NULL;& }" H/ v% B8 x; c2 A2 h

  77. * d' J& k1 [  y( i3 A
  78. static int acnt = 512;
    5 N. I7 A5 a4 o
  79. static int bcnt = 8;
    8 J  s; r& r) g
  80. static int ccnt = 8;
    . x. O7 [1 p$ w
  81. 0 l  ]% [+ Z) [8 h
  82. module_param(acnt, int, S_IRUGO);
    1 {$ q& K! o* W. ]
  83. module_param(bcnt, int, S_IRUGO);
    7 P, M1 ]( W% n. `3 ]$ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 P2 T/ R( J; [  c/ E
- m5 t7 h5 F$ @; J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 M  G  U1 O. k0 Z: x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 N, f1 A" c  ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Q3 R$ z& ^9 a) V% x
% L$ w) r6 J0 v' W# i2 A. J

7 e7 }: E& h9 _1 z9 b# \5 p$ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 13:14 , Processed in 0.038520 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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