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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. U! P+ C& P1 I1 A! y  ~
  1. [code]EDMA sample test application
    7 V& O/ x0 y1 Y: b1 r
  2. /*
    5 b8 Q" c) d* ~0 u
  3. * edma_test.c6 v: A3 T; D) G
  4. *2 a8 e% `; m) [5 S
  5. * brief  EDMA3 Test Application
    8 U2 u0 b7 B/ {# e. z' R
  6. *
    ' I& ]. ], ^1 o/ p1 d
  7. *   This file contains EDMA3 Test code.
    - ~; @' M' \/ z+ g0 }3 L
  8. *# G0 g- K5 H: `. k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" n9 R, B, e' _7 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! d  K4 W3 l5 u
  11. *         TO CHANGE.  ~2 h: v+ R# X7 q/ Y, J
  12. *
    9 R  _9 S& w4 x9 \, \6 I+ [6 V* y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ i( Z! K& m3 o* ~3 y+ Y1 |
  14. *9 T% q( b+ L- x# }' m: y: b
  15. * This program is free software; you can redistribute it and/or  g) u8 Q- v1 {% j3 @0 v. j* q3 t
  16. * modify it under the terms of the GNU General Public License as9 F# I% u( d$ R) F1 t& X$ Q; B& @, F
  17. * published by the Free Software Foundation version 2.% ~. ^7 b  N( Q6 T5 }' t8 G& G
  18. */ B" ]2 N& ^5 P  i; `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& @* X) \8 X$ Z1 m
  20. * kind, whether express or implied; without even the implied warranty
    ! [& `, ?$ `" M) A# @1 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, G+ _' ~# g/ D, K4 r
  22. * GNU General Public License for more details.
    ! n; P; f. A. f
  23. */
    ! o; Y3 }! r8 ]" V& T7 ?! v! X
  24. : `3 f; ?  h4 ~+ P
  25. #include <linux/module.h>+ X7 u7 |  [- V) B& g4 L0 T8 K
  26. #include <linux/init.h>9 s& ^/ {7 b- d8 y
  27. #include <linux/errno.h>
    $ o& ?( a; E; [! H/ ?
  28. #include <linux/types.h>
    . R6 M, S) @2 ^  ], D
  29. #include <linux/interrupt.h>
    $ |' J  q; m& T, ~) [
  30. #include <asm/io.h>5 r; S% ~8 A& _; V& G1 a: P3 c
  31. #include <linux/moduleparam.h>
    - M5 K' h1 H. ~! z
  32. #include <linux/sysctl.h>$ m4 o- n2 }1 K( S1 }
  33. #include <linux/mm.h>
    # A+ X( u$ T5 b. |6 H. V1 O0 |
  34. #include <linux/dma-mapping.h>
    6 |9 ]9 R3 m" o* r4 [- w
  35.   a+ R  A( C/ p$ S* E: c. C
  36. #include <mach/memory.h>
    % ~' O2 E; b" b% j8 p. c! S
  37. #include <mach/hardware.h>
    1 a8 a: F. _! g( @0 w! b
  38. #include <mach/irqs.h>, u( |; P0 ?9 l7 d1 l9 \; n5 K
  39. #include <asm/hardware/edma.h>9 Z0 N$ E6 u6 ^! c( Y+ i5 ]

  40. - t% U  x. F1 c  i* }: ^6 o
  41. #undef EDMA3_DEBUG
    - L/ s4 h8 l- E
  42. /*#define EDMA3_DEBUG*/
    3 R! Y, r  S$ I
  43. $ q& X% }$ f2 G+ y1 F
  44. #ifdef EDMA3_DEBUG( |2 p) u" _8 r3 d& T5 Q! l. {- h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . C! R5 J* y' y! |4 r. ?! N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + W( D- W9 u, N+ L3 w4 G' v- i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 T9 b- l  F" \
  48. #else
    , a- E' m: z( G1 s
  49. #define DMA_PRINTK( x... )
    % Z, k& E. \( k
  50. #define DMA_FN_IN9 w4 C  x3 }9 r
  51. #define DMA_FN_OUT7 I  v/ D8 w0 s2 D( U9 |0 t9 |( \
  52. #endif
    1 w* L" R$ T8 }
  53. / Q+ V4 Q& l  ^) ]1 C5 s1 Q( ~5 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 H( }" X9 j. B0 a( ^- V- ^
  55. #define STATIC_SHIFT                3  k+ F2 q; }& b- L; u$ @
  56. #define TCINTEN_SHIFT               20, o5 x% _; U4 }$ ~0 E
  57. #define ITCINTEN_SHIFT              21
    0 w- p+ k* w3 O& o
  58. #define TCCHEN_SHIFT                229 }+ I" k) Y; G0 `
  59. #define ITCCHEN_SHIFT               23
    " q# ]9 v, k: [2 r$ e  Z+ G) ^
  60. : e& E( m0 a9 S! L
  61. static volatile int irqraised1 = 0;+ \- V) ^% G% G9 ]
  62. static volatile int irqraised2 = 0;
    0 ?' f7 m( T/ |) b

  63. - }1 v7 ?9 |4 u; t+ W# |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 f% Z8 H" x+ K% w: V# ~6 ]0 r2 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . U; e+ C2 f0 [2 G' K9 f! P8 q+ ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 O5 M/ a6 f) C  n
  67. 4 O2 e7 J$ G% v) O4 P
  68. dma_addr_t dmaphyssrc1 = 0;; A" K5 d  M" n6 J2 \
  69. dma_addr_t dmaphyssrc2 = 0;% P1 i" v' z% i2 w1 ~/ H9 ?% ?$ `
  70. dma_addr_t dmaphysdest1 = 0;
    , H3 e8 z. g" r/ |' ?
  71. dma_addr_t dmaphysdest2 = 0;
    ; y" j8 s9 P) W7 A5 C. N0 c" }
  72. 0 p* t$ f6 m; z6 g
  73. char *dmabufsrc1 = NULL;
    + I: M' {* z% r0 r" t% H
  74. char *dmabufsrc2 = NULL;
    * w7 T/ o% U! a+ f) m& L8 T2 [  H
  75. char *dmabufdest1 = NULL;& M( h- h( D. n+ R
  76. char *dmabufdest2 = NULL;
    . b4 c% Y5 ]& g4 q5 M
  77. , X' Y, {) Q/ Q" Q2 ^8 B
  78. static int acnt = 512;# F+ t+ V; n) c9 i
  79. static int bcnt = 8;2 ^( e% M4 T& N3 n& H
  80. static int ccnt = 8;- ~' c- e0 R9 H2 D: Q+ m6 `
  81. % H5 f/ Q3 p1 [5 h0 l
  82. module_param(acnt, int, S_IRUGO);
    1 V. R6 B  [4 E( O' U
  83. module_param(bcnt, int, S_IRUGO);$ }% s. C$ b' P' J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; ]$ a: s7 E% i8 I( l6 r9 o( ]# n8 [1 |2 F7 j* _6 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ R, _$ v: N8 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! f: @; S% n) G1 c# f* g3 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& |$ Y  Z  H7 H! }# F8 H) L# }

2 L0 W9 d" ^9 U$ c; F+ P( I2 e* [. O7 U/ ~' L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 06:37 , Processed in 0.037697 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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