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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: w" I5 q! O. g: |+ N
  1. [code]EDMA sample test application1 T2 F# I, _4 [6 ^) C8 L& v
  2. /*1 U  V. A* \: C* |" i5 U7 G4 S9 f
  3. * edma_test.c
    7 \6 q$ [& Z9 H# P5 y9 W1 h: E2 x
  4. *
    & _/ W4 \" z2 ~) r6 R! X
  5. * brief  EDMA3 Test Application
    8 k9 g- F! {$ k3 l
  6. *
    4 ]4 u; H* s# m: U3 N& f' [) Q
  7. *   This file contains EDMA3 Test code.& R7 |8 {: E  x0 H$ z" z1 R/ s" {
  8. *
    8 A" D; F& }, G" G% z5 k7 x. s5 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ _2 u) K% M" W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & v2 i& Y, U, }& B2 P
  11. *         TO CHANGE." K% Y% _3 X2 `! j  w
  12. */ m+ b0 ]0 H. i, X. j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & }, ]) a" }. s: p9 H: M* v" s
  14. *1 f/ ~$ n0 X! x3 [
  15. * This program is free software; you can redistribute it and/or. W0 Y1 K. @$ E' a/ s
  16. * modify it under the terms of the GNU General Public License as  a9 W0 ^4 r- a7 A7 D6 g
  17. * published by the Free Software Foundation version 2.
    # u/ A% F6 U, @3 i
  18. *
    ; t# F+ ~7 M2 Y  i, r: d8 l% Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; @! N3 F5 z+ G; e! [: }
  20. * kind, whether express or implied; without even the implied warranty
    $ c( a# F& w5 a- I% G8 i+ g0 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 [. B' v1 @. L/ S% N  J
  22. * GNU General Public License for more details.' {- h/ p& v' T9 v0 {6 B. A  i
  23. */
    9 M# Y, ]3 E7 K8 ^  I1 [

  24. ' r" G, G: w! _' j& C
  25. #include <linux/module.h>
    # O1 @" Z/ A7 E, U8 K/ F: [# ?4 C
  26. #include <linux/init.h>
    2 I& x1 m$ g% Y) \; y. X  v
  27. #include <linux/errno.h>
    6 ~$ w! q' [5 [' F
  28. #include <linux/types.h>
    9 F" K* n5 H1 d
  29. #include <linux/interrupt.h>
    ' a2 w+ G; {& E6 U* i
  30. #include <asm/io.h>
    7 `4 y! J4 y+ V+ f4 r" r1 Z! h# F5 }" f
  31. #include <linux/moduleparam.h>9 C5 a6 v5 p+ J# }% i6 p* N( N' C9 W9 @
  32. #include <linux/sysctl.h>
    1 p: v: q- Q; |: w' j
  33. #include <linux/mm.h>' ?+ ]% e9 I, r, I0 q$ O
  34. #include <linux/dma-mapping.h>. K6 O5 `" \/ w" x

  35. 0 C" N: t8 z' [" ]
  36. #include <mach/memory.h>" P  H) A: g$ ]$ ]+ C+ ~+ k
  37. #include <mach/hardware.h>( R( y1 q0 M& X( g! v3 N3 k- p
  38. #include <mach/irqs.h>' f& _, G" T5 x4 o
  39. #include <asm/hardware/edma.h>
    & o8 k: h% n2 |8 T5 Q$ ]6 i8 Q' @0 l

  40. % j9 {; m4 Y5 h6 k: ~6 g/ u
  41. #undef EDMA3_DEBUG: A5 U( i- Y* y2 d; C% z- F
  42. /*#define EDMA3_DEBUG*/
    * @/ R) g% i2 G# Y9 V1 `
  43. % H. P0 `2 n6 r5 W! c) z( p
  44. #ifdef EDMA3_DEBUG
    & `/ P) F. X/ z' R+ `3 S* G3 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 |% V" f9 y. M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Y2 N7 l% z; v( _; M, b6 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! T; B+ p- @+ X: S$ E- R
  48. #else% E, X. y/ u- W
  49. #define DMA_PRINTK( x... )
    3 w2 t5 E! D' \) j- C9 K  I0 _
  50. #define DMA_FN_IN
    & D% ^3 m4 o6 e
  51. #define DMA_FN_OUT* `6 q9 x- n2 j2 c1 z" p
  52. #endif; u# o8 S; L5 d; }/ O8 C

  53. % X/ C4 V& u( F7 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 I& i5 {8 E, A
  55. #define STATIC_SHIFT                39 T& k2 F0 x8 W& p1 z# y) |( I
  56. #define TCINTEN_SHIFT               20
    # V* }5 W1 b8 e
  57. #define ITCINTEN_SHIFT              21! K0 O6 I0 U; r/ t
  58. #define TCCHEN_SHIFT                227 S" Q6 ~6 ?' s0 U2 q
  59. #define ITCCHEN_SHIFT               23
    + Z$ D7 m( }3 [" B
  60. 6 M% r$ k8 N% n  w
  61. static volatile int irqraised1 = 0;
    % ]* C# H. R6 F2 h
  62. static volatile int irqraised2 = 0;
    1 }: y: T& s7 h

  63. : H) X0 U+ ?: ~% e, _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H( c1 x$ h" b+ m- j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _( C. B; W& C: @8 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ~1 f- h" S% f' `: ?8 Q1 {
  67. $ t6 C2 }7 Y/ Q5 a" ~/ a* l6 R/ F
  68. dma_addr_t dmaphyssrc1 = 0;
    ' Y1 p& X0 @, L  E+ C' b
  69. dma_addr_t dmaphyssrc2 = 0;: Z" q, B* s% o, Z- A/ [2 s- Z
  70. dma_addr_t dmaphysdest1 = 0;
    . ^. ~! G/ H3 a% a
  71. dma_addr_t dmaphysdest2 = 0;& v9 \" ^- h, j& w% t! p6 D

  72. 7 f" P, E* _: T$ l
  73. char *dmabufsrc1 = NULL;
    5 [4 _# B: g7 C- Y6 _6 N
  74. char *dmabufsrc2 = NULL;
    + m: Y& S8 U5 j/ O
  75. char *dmabufdest1 = NULL;
    6 N& t: P# S1 s- ~5 s4 K
  76. char *dmabufdest2 = NULL;
    , U3 N! u1 V+ c

  77. % q8 i$ f) e; Q" }" j
  78. static int acnt = 512;
    5 T" G0 `7 H9 [' u( n9 Q! g
  79. static int bcnt = 8;
    9 q  Z* A8 @- T* ?
  80. static int ccnt = 8;2 N* }5 o2 Q  P- \; P& _
  81. $ M0 m2 |! P' H9 C$ m5 y5 U
  82. module_param(acnt, int, S_IRUGO);
    3 ~, ?' q* f6 B9 k$ a4 @
  83. module_param(bcnt, int, S_IRUGO);7 E; _* z6 e& t9 _$ m+ l# p& u) c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 v% @2 }: I+ V' m
0 X. U+ n* n( O) e) y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 x; j& m8 P7 |( o$ P0 T9 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* l# ~/ J, o# i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ J5 t+ v0 H1 c6 ]$ Z; X
2 u. p& L5 `  U  Z5 L  e

( ~7 |0 K: ]& @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 16:13 , Processed in 0.040149 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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