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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 W8 l7 n& k" @0 I% ?
  1. [code]EDMA sample test application7 Y1 I6 {3 @* `, O( K" t4 I
  2. /*7 p# t' H, F7 t- A) X
  3. * edma_test.c1 j- t# e: [; U
  4. *
    3 D: C6 v, e1 ~
  5. * brief  EDMA3 Test Application
    ; d# Z  l: Q( D
  6. *# d9 S( k' z- K$ ]3 B2 @7 L& l$ E
  7. *   This file contains EDMA3 Test code.5 B$ C& s6 A  z8 q6 ^4 u& A1 B7 q. I
  8. *
    : c& o% V' K% @2 Y* a' ~1 i8 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 |3 t, T9 m5 D. z- b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 z' n" Z$ n7 s- P
  11. *         TO CHANGE.0 [' Q* r. s- g" W
  12. *
    7 P( f- a7 v! v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 N* c$ K; S1 n8 ^2 ]5 u9 U
  14. *
    4 @6 S& W/ [/ S- P
  15. * This program is free software; you can redistribute it and/or
    8 r3 a4 {8 Z" o5 Z/ G* B
  16. * modify it under the terms of the GNU General Public License as  C1 T; N* a2 ~% E2 W7 Y' E
  17. * published by the Free Software Foundation version 2.5 L" z; H$ J  e6 U4 Z
  18. *9 l  K3 ^- `4 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + k1 |& C- V% f3 S, W: x( n
  20. * kind, whether express or implied; without even the implied warranty
    % q- U- t1 L% F4 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ d' K& b/ b6 j( \" ?5 ~& S
  22. * GNU General Public License for more details.
    3 z7 U# ?; Z; D' ]( }2 m$ l
  23. */. H6 q2 l9 Q& C4 Y9 s% V0 _
  24. ( v- ]9 V3 `9 _5 ]: y+ R" v
  25. #include <linux/module.h>
    - [& \3 V5 G" v1 `$ G
  26. #include <linux/init.h>
    / p% J6 b: o( V. p/ k4 }$ n
  27. #include <linux/errno.h>/ R+ ^5 M* Y  v5 F. z) E( }
  28. #include <linux/types.h>2 o$ T4 q$ ~5 r
  29. #include <linux/interrupt.h>* f! Q4 @( ~0 G+ l7 F
  30. #include <asm/io.h>
    0 m" m) A8 S/ I' `: H
  31. #include <linux/moduleparam.h>$ I4 e7 ]# `. E5 P
  32. #include <linux/sysctl.h>5 j, }0 s0 B6 i
  33. #include <linux/mm.h>
    " ]8 r; T9 t0 {1 u/ d; c
  34. #include <linux/dma-mapping.h>1 s* v4 i; H0 |. `1 _

  35. - a$ S. p  L$ M* E/ V
  36. #include <mach/memory.h>. ]& @: c+ q& L5 _- l
  37. #include <mach/hardware.h>5 |( Q$ k) r/ ?; F. H* ~: `0 ~
  38. #include <mach/irqs.h>
    . l: m# N, B1 V" s+ m8 z. U
  39. #include <asm/hardware/edma.h>
    9 ?4 W* A# }% U0 j' V- z1 S
  40. # l" z8 q6 D) }9 A. O3 `5 i$ X& S" L
  41. #undef EDMA3_DEBUG+ G8 f! i  g& J0 p3 A
  42. /*#define EDMA3_DEBUG*/7 v: x" M0 ?  _

  43. / Y3 c5 J5 V1 x+ }
  44. #ifdef EDMA3_DEBUG8 C7 \2 J% B2 t2 I: A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 b; v& S6 J. i  y+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- U9 k/ `% S' K, W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , i* I/ [5 D+ t
  48. #else
    : Q( G8 t1 v" o4 l/ M1 J4 ~; Q* J$ ?
  49. #define DMA_PRINTK( x... )5 D3 M  P/ A# ^' w  K
  50. #define DMA_FN_IN
    ' L$ X: z6 W& V( ^8 ]
  51. #define DMA_FN_OUT
    $ J, I2 q( M5 V% U5 ]
  52. #endif
    2 y0 U4 D' Z  P/ `1 q! h

  53. & L9 w; F/ c8 G: r2 p" a* p4 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 t8 |' Q' S7 W! @
  55. #define STATIC_SHIFT                35 Y, P  P$ T/ x: }
  56. #define TCINTEN_SHIFT               20
    3 p3 K2 N# T5 k# i# ]2 [1 J
  57. #define ITCINTEN_SHIFT              21
    , t! [& l1 X+ ^9 b5 `% M2 T" M
  58. #define TCCHEN_SHIFT                22
    ! _5 }3 L  n; [
  59. #define ITCCHEN_SHIFT               231 t& f& r" S2 b- H8 s* S9 z0 P+ N
  60. ) k- w9 Y7 ]( i# G2 D( l
  61. static volatile int irqraised1 = 0;
    ' O- c( }0 t& w
  62. static volatile int irqraised2 = 0;
    + P3 y: A3 f" W9 A+ |, u
  63. * l9 N& K) A% m7 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @8 Y: b( x) R, T2 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 B. [& F0 _- e, q, t7 |1 |! n4 O. t8 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 B# H( o: a. t0 J7 s) j6 D
  67. & Q( e7 J5 ^2 M; H
  68. dma_addr_t dmaphyssrc1 = 0;3 `9 S6 x- l( d! D  n+ ^" k, F4 R
  69. dma_addr_t dmaphyssrc2 = 0;( u+ R. t/ J, V' a
  70. dma_addr_t dmaphysdest1 = 0;  T" ^1 S- o9 x' R5 V
  71. dma_addr_t dmaphysdest2 = 0;
    $ n$ q0 R- |. [: U  [# ~

  72. 2 e1 B7 _5 W; t
  73. char *dmabufsrc1 = NULL;
      s& h  ?2 e; s9 k# x; k
  74. char *dmabufsrc2 = NULL;0 ^3 f% J9 A6 f% i
  75. char *dmabufdest1 = NULL;" g1 r7 D( h7 h
  76. char *dmabufdest2 = NULL;9 J5 ?$ z  ~7 \; l
  77. 1 {0 g8 D8 ?2 b; G5 M7 F# t- x
  78. static int acnt = 512;
    ' W5 {, D! z( {9 O7 y" H5 u
  79. static int bcnt = 8;# |' Q3 b! q. I/ K+ _$ o4 m
  80. static int ccnt = 8;
    + G  }+ p9 ]" F  A& [% F
  81. 0 }" u- x7 [5 n1 a1 h
  82. module_param(acnt, int, S_IRUGO);
    9 [$ x- d6 D& X2 E* {. s
  83. module_param(bcnt, int, S_IRUGO);1 q. ~) m" ?% j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. g! x# @" s+ w5 v# {, W1 z; ~. S- |) S* Y. `1 |; F! B: S0 O. ], C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 X) t4 D4 w& _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 O, e9 Y4 I& `' T  H: X) n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 |9 x( {8 J+ O5 h- v* d

8 X9 w4 y" V' C
) d3 }4 Y: v) S0 A  S6 S5 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 18:47 , Processed in 0.051757 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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