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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ^( I2 I$ o% k
  1. [code]EDMA sample test application
    1 d" y: K. Q$ v' C% e
  2. /*1 [) y  E. @- V- u
  3. * edma_test.c
    # C( j  [/ `0 l3 U3 h' O; N
  4. *, q+ m: S2 x1 b. `  y( B
  5. * brief  EDMA3 Test Application
    : L$ S( G$ L) ^% d" w4 V4 M9 e1 ^: u
  6. *
    9 c  g2 v. C  |# T4 k
  7. *   This file contains EDMA3 Test code.
    * ~  C1 P" z( k; r  e
  8. *0 A( m7 j* m% m* b8 j3 v  e5 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 K, R8 D+ x+ a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; e8 `  U6 g, Z1 d! [- n1 _+ w
  11. *         TO CHANGE.* Y5 n- g6 u( I9 {
  12. *
    8 i7 I. }" M6 q: @. b/ N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' |: g) k$ p9 ~$ {4 h
  14. *
      m. O/ i0 g3 {2 r- K, `0 r
  15. * This program is free software; you can redistribute it and/or* X2 P6 Z% z8 l
  16. * modify it under the terms of the GNU General Public License as, t9 O4 ?) J' U' d+ P3 f
  17. * published by the Free Software Foundation version 2.
    , h) V6 r2 h. m! g
  18. *. h5 q" Q* @1 w% M7 C8 M9 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) p2 u2 k) `6 U4 Y7 u+ H* H  |
  20. * kind, whether express or implied; without even the implied warranty
    ) _/ t- k7 }  h4 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) l* J) D' J( v* V
  22. * GNU General Public License for more details.
    8 j4 v2 Y' K, g% k2 G* b0 c
  23. */# u7 o! c2 n. F3 i' @( F
  24. % `# A" R/ j9 h7 ^+ m
  25. #include <linux/module.h>
    * W8 P7 {+ z& `" `9 Z
  26. #include <linux/init.h>* O. s  _9 N  Q% g( S3 v. P
  27. #include <linux/errno.h>- A; y" @2 \2 e$ S
  28. #include <linux/types.h>
    0 f5 G' {$ W  x7 t; ~
  29. #include <linux/interrupt.h>
    $ v* N& f. s% ]" f8 o
  30. #include <asm/io.h>' s) K- a0 x) _4 O
  31. #include <linux/moduleparam.h>
    2 S5 o3 g; y$ |; _
  32. #include <linux/sysctl.h>
    ! f0 \) a1 o1 f' F! |
  33. #include <linux/mm.h>/ r1 J7 Z/ D$ i4 u( Z% Q/ z# {7 x
  34. #include <linux/dma-mapping.h>( c% f! Z$ B$ @4 K, _% a
  35. - M: f5 U% w% F* t: R
  36. #include <mach/memory.h>
    4 R6 ?. D3 C) Y* a/ S8 r% G
  37. #include <mach/hardware.h>
    9 x7 u+ h9 u8 R4 `
  38. #include <mach/irqs.h>7 S6 d4 [: r+ X4 U
  39. #include <asm/hardware/edma.h>) t2 L7 S. G3 X( C
  40. 2 t) g- F6 w0 A/ ]% q- f  X" N7 M5 x
  41. #undef EDMA3_DEBUG
    0 h. ?1 z1 W# F; ]
  42. /*#define EDMA3_DEBUG*/' _# A9 A9 a  [2 A% t1 t, x
  43. " B' X5 }7 c: y, v
  44. #ifdef EDMA3_DEBUG
    0 T. V3 n- `: `. }9 q6 C. U4 U" ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) u6 B' \/ x7 b* x' u  j6 i! O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 V) o& b9 `/ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( x7 A8 O  p# e1 J; ?# m
  48. #else
    ) W8 O- o$ l$ i' m
  49. #define DMA_PRINTK( x... ), \: M; z' a( D8 v
  50. #define DMA_FN_IN
    - Z! N" x4 H! u2 m6 V
  51. #define DMA_FN_OUT
    * V/ o4 h0 t' U
  52. #endif
    ( P1 N! i5 V4 h- P6 B$ H
  53. 5 J" N/ c. u, K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# i9 Y4 D# G; f( K
  55. #define STATIC_SHIFT                3
    ; W9 i" A  n* T5 u* C/ s/ `
  56. #define TCINTEN_SHIFT               20) Q" i( w+ u2 V) u6 E9 Z, d
  57. #define ITCINTEN_SHIFT              21* q7 V2 T) Z+ j5 G: ?3 E
  58. #define TCCHEN_SHIFT                22/ A3 J2 R, W6 u! \% P8 O" T7 L5 y
  59. #define ITCCHEN_SHIFT               23" v& E+ E" f% ?6 v5 K7 r

  60. % r% Y% H- b( E$ R: W- A
  61. static volatile int irqraised1 = 0;
    * i" A' x( ]. l& w; I
  62. static volatile int irqraised2 = 0;
    9 s9 S4 v- e+ X3 {) g% x8 U
  63. 2 a  z+ @) a$ z5 @$ f) q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?6 u* q+ g' L, `! G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % I1 n  U6 b3 N* ~2 U+ k. j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d, k  S& W3 L/ F5 E& K: ~& Z

  67. 7 K2 t. p! B  ^# J
  68. dma_addr_t dmaphyssrc1 = 0;
    $ [' {' S: D: E' x
  69. dma_addr_t dmaphyssrc2 = 0;; k" _, |8 v( v/ ~% ]
  70. dma_addr_t dmaphysdest1 = 0;
      _1 w3 b/ o4 O9 \8 Y' j
  71. dma_addr_t dmaphysdest2 = 0;
    8 E) m2 g; ?+ m/ E6 v
  72. % S$ e& m8 t# G8 ^; [6 J7 E2 V1 C
  73. char *dmabufsrc1 = NULL;
    3 y% f- L+ L7 U9 P
  74. char *dmabufsrc2 = NULL;/ q' o6 B* a+ x' d' r+ Z7 z9 q& m
  75. char *dmabufdest1 = NULL;
    & Q9 Z( u2 C4 G
  76. char *dmabufdest2 = NULL;; E) V- c+ p% J7 c  }8 F. V

  77. ( T  ^# y+ p3 a3 I; L# Z
  78. static int acnt = 512;& Q/ P+ b  S7 }' `4 N
  79. static int bcnt = 8;' f4 z. l* x' C% i3 k( q. a$ q
  80. static int ccnt = 8;
    9 i4 T" H  o8 o+ O4 o: i
  81. 1 O2 E0 B" H% P( ?  q: A1 c" J3 H
  82. module_param(acnt, int, S_IRUGO);
    9 B: K# J- b1 t4 j" y4 D
  83. module_param(bcnt, int, S_IRUGO);# f& k  n' F/ ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ g1 |* C# V3 R! v
( i) f/ [; N2 m# q7 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# k+ N3 r- H7 j" W) s. a0 y4 n+ |
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 M2 }& |5 C4 T. l# `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" C* n3 o+ O/ v( K4 M+ C3 A+ D$ U5 O, C' q9 J
1 z% o; G* \$ D, z4 f% E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 07:18 , Processed in 0.043799 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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