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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 c- H: J( h9 k  z0 w- i
  1. [code]EDMA sample test application
    ' I# l1 [9 n( u" l2 b+ O: \( c
  2. /*
    - }9 `2 ]; _5 _# _, R
  3. * edma_test.c
    + Y2 c" ~: E2 T
  4. *
    8 n0 o" \  A1 Y+ s0 l) {
  5. * brief  EDMA3 Test Application( k( V3 p9 B  o8 n
  6. ** ^/ L) s! b& ^
  7. *   This file contains EDMA3 Test code.
    8 M3 a6 w# k9 P/ |
  8. *
    - y1 H8 Q8 _1 M( e' s& }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 p: s& e" U0 ?4 ]9 f! U+ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 \2 R7 u0 v, L# B& y
  11. *         TO CHANGE.: b; h1 I. x  C8 }% S$ H' @% n
  12. ** r0 I: H) e+ v3 \2 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 ~. I: E3 L$ r5 R  {- L) ]7 o/ l
  14. */ \0 J$ S/ R  d! o, X; j8 x
  15. * This program is free software; you can redistribute it and/or
    0 G6 P  y6 Z3 m$ T
  16. * modify it under the terms of the GNU General Public License as
    ( e) T! O2 f9 b/ g+ v4 W# M9 P- L
  17. * published by the Free Software Foundation version 2.
    5 `" @) |8 }3 M4 p0 M& B+ u5 Q% @
  18. *
    ' [1 e0 p1 @# ~  v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  K) `; j+ p1 B* _% F8 k# i  z
  20. * kind, whether express or implied; without even the implied warranty
    ! ~8 R/ {; M. y, P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + b/ m! s& W. P% E
  22. * GNU General Public License for more details.
    7 A6 n: S+ V3 w
  23. */8 X1 K- s+ N3 W+ ]8 `: }0 Y

  24. 6 G. ~/ Q7 F& T6 ]5 J9 E) B
  25. #include <linux/module.h>% G' P" [( K6 B7 L' f2 Z+ ]9 N0 ~- s
  26. #include <linux/init.h>
    , I2 b0 P4 y5 U1 F: u6 N  k
  27. #include <linux/errno.h>3 f8 Y3 [6 ?0 f, J
  28. #include <linux/types.h>, ]. q% P5 y# m$ `; i/ H0 o
  29. #include <linux/interrupt.h>' {% y3 y7 t# U( l' u  a; ?. F& ?
  30. #include <asm/io.h>
    % j0 a6 k5 n8 X* m$ G6 ?
  31. #include <linux/moduleparam.h>
    3 s  S" E* B6 @+ P$ E8 M5 F* R
  32. #include <linux/sysctl.h>
    & D( O; j& _5 M7 y$ @( M5 S1 o
  33. #include <linux/mm.h>! ~+ s+ _$ g2 l0 M8 [
  34. #include <linux/dma-mapping.h>
    ! E. L: o/ Z6 v# m
  35. . q* _- U4 x) \7 h4 z& a
  36. #include <mach/memory.h>0 x- ~/ `. b# B" }
  37. #include <mach/hardware.h>
    6 ?$ _" Q( |5 w5 e1 b2 k
  38. #include <mach/irqs.h>9 j  F7 A: k/ v: U
  39. #include <asm/hardware/edma.h>
    # K$ e) U2 F" w4 Z$ D
  40. 1 P7 P; P( R% T
  41. #undef EDMA3_DEBUG
    ; M3 D7 J8 Z) g) I
  42. /*#define EDMA3_DEBUG*/
    1 W; e# h$ z* @2 t$ E

  43. 5 {: w) s; t" N9 P% E
  44. #ifdef EDMA3_DEBUG
    * u( G* q! _- @- h, }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 A/ [" c- R6 Q' x1 @# H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& i" }+ l4 ~( I  c- M* Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  v3 d  w0 z7 b* \6 M
  48. #else  P5 ~1 N0 l( z5 Z  O, @
  49. #define DMA_PRINTK( x... )' }9 L3 n+ D- ^. ?& e. _5 [% v2 q; U- a, C
  50. #define DMA_FN_IN
    9 F% h9 z  C; [+ V  ?& R
  51. #define DMA_FN_OUT
    6 S; n( e6 x$ n0 \; j( X+ l
  52. #endif
    ( [7 M, L0 ?% s$ h" P$ L& p

  53. 8 t: @3 c0 R. x" u. _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ a4 U- I/ I' l. x
  55. #define STATIC_SHIFT                3
    3 h; j4 j% M, _! q7 f" o2 p6 Z
  56. #define TCINTEN_SHIFT               20
    8 [, z: S) P: D4 \
  57. #define ITCINTEN_SHIFT              21
    , ]7 b" D2 w, v: [" }% b
  58. #define TCCHEN_SHIFT                226 M1 T0 y3 C( t4 `( c
  59. #define ITCCHEN_SHIFT               230 i9 w3 v# X! T# F* T7 I& ^4 s

  60. , `! Q" h7 E  n1 r/ U  s
  61. static volatile int irqraised1 = 0;9 |- u6 k2 U' F" E) E3 V/ j1 n
  62. static volatile int irqraised2 = 0;/ }2 h. \3 Z# J8 ]1 m

  63. - R, J1 ]" |- H, o4 o9 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a- |# L  F$ _1 L# K: d6 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 g4 m4 w4 o' {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' n' ]2 s) d" g+ ~2 z5 o$ ?

  67. - q- q  J1 V/ a; s# w
  68. dma_addr_t dmaphyssrc1 = 0;
    3 F9 I  f2 _8 z/ t, E  o
  69. dma_addr_t dmaphyssrc2 = 0;
    + x9 U# i5 H6 o" e4 n, ]
  70. dma_addr_t dmaphysdest1 = 0;) D$ o9 K1 i4 D1 _! k0 r
  71. dma_addr_t dmaphysdest2 = 0;1 w$ K4 {! S# i7 s6 F2 [& x- ^) k. v

  72. % r4 h, h. U+ w& l5 O+ [: l7 V' t
  73. char *dmabufsrc1 = NULL;5 R1 X8 v: f9 z7 M5 b
  74. char *dmabufsrc2 = NULL;% Z* b* f+ Z! d1 ]; `
  75. char *dmabufdest1 = NULL;& j" q4 f, c* g' f
  76. char *dmabufdest2 = NULL;0 S! T6 t2 m, A1 y
  77. 5 N8 N0 v  s- p. ], e5 a
  78. static int acnt = 512;
    9 t2 U' f8 Q0 R
  79. static int bcnt = 8;/ y# p1 d' ?8 C3 w% {
  80. static int ccnt = 8;
    2 s' i( f. ^6 F, V2 ^
  81. 2 I! D) \' U! l$ X0 t- n
  82. module_param(acnt, int, S_IRUGO);& Y: ~; C, S( y* @( m$ e
  83. module_param(bcnt, int, S_IRUGO);: v. p3 t7 O4 C3 `) N* J( b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# c/ f6 d2 x5 B9 F% e6 z

) {$ R0 o* {# s  b. e* `, n# {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 P; m9 ~8 r. q1 l* V! m1 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 |& _2 _5 K" ?+ P% |% a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% B4 R3 h' [$ h) t: h* u0 Q

( v; C" B4 D' V( f! J4 V/ F0 A& q1 [& g' ^7 @" \2 ~: m9 e% W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 04:13 , Processed in 0.043623 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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