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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) d2 @8 e$ W, h/ w# h4 v+ j  f% d, D
  1. [code]EDMA sample test application. M  ?9 J% H. j
  2. /*. U0 V! O- W4 D+ \
  3. * edma_test.c# _6 G" i. T5 i, O
  4. *" S2 t( N# ]; x9 L# M
  5. * brief  EDMA3 Test Application
    ! p0 b2 `, c( ^' o: T
  6. *
    5 v( q9 W# d+ f: T2 o# I7 Z
  7. *   This file contains EDMA3 Test code.
    5 E+ y% s4 V: U# k
  8. *! _; ^. R8 a9 b* K4 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 u; M8 H& ~- E$ O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. n: |6 ~, G( S6 \% n4 D
  11. *         TO CHANGE.
    , |3 f8 k( f. y/ T2 {! J
  12. *
    7 M7 N" Z/ Q. x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + V8 i2 R) |7 ~& i7 v) j1 h! B
  14. *  z' H7 o- n# J6 A$ x4 Y5 K
  15. * This program is free software; you can redistribute it and/or& J3 r: S) ]& K" h4 n, p6 l
  16. * modify it under the terms of the GNU General Public License as
    " j/ ?8 _$ [) d  {, B, M/ E
  17. * published by the Free Software Foundation version 2.
    & @" J6 c9 ^+ J: u  [5 Z! i8 h
  18. *
    : t3 H; d6 p1 k# |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 [. ?. q5 e+ l$ y& }+ E
  20. * kind, whether express or implied; without even the implied warranty, B- ~- ]7 ?7 Y( e7 w5 j7 w8 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % F' z# c1 q3 Q% L9 {
  22. * GNU General Public License for more details.
    / Q" e7 E" ^! o# u0 p' G6 a! b
  23. */
    ! G8 o, ^2 p6 f7 b
  24. 6 C6 n7 K3 @. F5 ?; I8 W
  25. #include <linux/module.h>
      G5 B5 {2 G7 ^/ g  Q7 e7 B
  26. #include <linux/init.h>
    0 p, m4 ^! {% r# N
  27. #include <linux/errno.h>
    9 I8 J- p6 {* |: K* G
  28. #include <linux/types.h>( W( n7 l4 d6 L0 J: ]- r6 `2 [
  29. #include <linux/interrupt.h>
    , s; E3 x- E$ T& _7 N, `4 u, H: A/ Z
  30. #include <asm/io.h>2 n0 \/ l- d8 u6 D3 G; U: p) g
  31. #include <linux/moduleparam.h>
    , e8 R% k( q) G; |8 l, [8 @; `3 c
  32. #include <linux/sysctl.h>
    6 Y  y" z; Y2 J; g  G" k
  33. #include <linux/mm.h>" ?! O7 Y) b( q5 k/ O- @
  34. #include <linux/dma-mapping.h>
    ; b$ s# P5 k' H( F; [

  35. " |7 O! y' K8 E& G* [9 d: B. M5 C
  36. #include <mach/memory.h>9 }/ p* L' A! T
  37. #include <mach/hardware.h>
    / Z+ {# K1 ^, i" b& E( J- m
  38. #include <mach/irqs.h>* x, J& _- k$ q/ q. L% ^
  39. #include <asm/hardware/edma.h>5 q- _6 y6 p; l* B
  40. $ N% ?: n4 A. E6 M1 w6 O
  41. #undef EDMA3_DEBUG
    4 Q6 @4 e% `/ d# ?/ J. P
  42. /*#define EDMA3_DEBUG*// ]1 q/ Y9 x8 P# N0 s% k7 A
  43. 6 m. o: ?3 E# o6 p
  44. #ifdef EDMA3_DEBUG
    * u; y8 ]  ~1 F; s  @5 v9 _9 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T! ?4 j7 x- q( a3 Y) j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  ?: _$ [2 n& x# m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 F9 t1 O& b/ `- e  L3 B
  48. #else
    ( ~  \7 W8 s% }: u. X, x
  49. #define DMA_PRINTK( x... )
    $ _% |, `" k9 X" T) S
  50. #define DMA_FN_IN* h9 F* r3 A* ?* G: r) E, N" r" X7 j
  51. #define DMA_FN_OUT5 A3 m9 V6 d3 ]; k/ g5 m# J
  52. #endif
      x: X( g8 z1 ?* h( a

  53. 9 G" l7 w6 D/ X) C7 I9 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* w3 G2 f2 y. _0 Y1 n
  55. #define STATIC_SHIFT                3
    7 [5 `. V- G2 y( r3 Z
  56. #define TCINTEN_SHIFT               20: Q5 T0 I) Q$ }/ m! u; N2 X
  57. #define ITCINTEN_SHIFT              21
    6 Y) q" v0 s! p0 B# W' ^) h
  58. #define TCCHEN_SHIFT                22
    , ^- f+ a/ w" W+ v' e
  59. #define ITCCHEN_SHIFT               23# I' w. w* M7 j4 a$ L( i% O) X1 e

  60. + ?+ k, m! G* q5 H/ A
  61. static volatile int irqraised1 = 0;, T6 p# f/ A5 m
  62. static volatile int irqraised2 = 0;
    $ X) J. }+ J  ]+ ]  O

  63. 9 y5 V; D8 Y; p# u0 P- N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 q; L6 d# e0 ]+ U/ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : u  A: r) G  r. l! [' J/ p& k4 \1 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i. E. Z* m! W) O% `

  67. 0 m4 T6 j6 O1 `% r: H2 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    7 S' F2 @. t( w& D, H& c' x) n. H% I
  69. dma_addr_t dmaphyssrc2 = 0;
    & Z/ K' M, a5 a$ |
  70. dma_addr_t dmaphysdest1 = 0;
    ( ]  e: _- f6 N/ q% Q
  71. dma_addr_t dmaphysdest2 = 0;
    8 C5 o$ j1 j  o. y
  72. * N" v! D+ m4 R8 ~1 D3 k
  73. char *dmabufsrc1 = NULL;
    9 E* y) }/ S( U, X4 _
  74. char *dmabufsrc2 = NULL;
    * `" Q/ e$ F+ S$ g# u$ [
  75. char *dmabufdest1 = NULL;7 @3 x+ g' ^+ G. Q
  76. char *dmabufdest2 = NULL;2 V8 k3 z" f7 u9 J9 {! B% n, {

  77. : _2 Q" [3 d, a
  78. static int acnt = 512;
    % s# `; f1 B8 M- y
  79. static int bcnt = 8;* F4 Y+ ?5 {& o* p
  80. static int ccnt = 8;
    5 S+ v: R& p2 J; f; Y% v& ^
  81. 4 z* N* c! E  O& x, N0 C  k, E
  82. module_param(acnt, int, S_IRUGO);
    ! q. Q1 a& O1 @1 G
  83. module_param(bcnt, int, S_IRUGO);8 X; m9 e5 h: r2 ?; p- i* y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! H- M) {: x$ I3 `7 }- V

! ?- Z7 f! T# e9 D6 T: h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ ]6 Q; t$ H6 n$ V; e- t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 U7 g1 N9 p% z& b  i1 W$ P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: {( F. q5 ^$ O$ H1 X8 m6 Y
( X! b- O& |  G0 u# M* p9 z; F. U
) e* E6 i# H3 s, {. l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 22:27 , Processed in 0.041625 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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