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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  Q* r2 ~2 F: V  g
  1. [code]EDMA sample test application  j2 c0 \5 a" E2 R- o' G9 P
  2. /*6 r3 r( F( t4 \2 h, J8 f* c3 R, O5 f3 O
  3. * edma_test.c) C6 H3 l" {# _3 s) D
  4. *
    & ]: D' C/ z' H; {) A
  5. * brief  EDMA3 Test Application" X+ w8 v' |( i+ N
  6. *
    4 u, Q$ Q; r# |8 v& m9 N
  7. *   This file contains EDMA3 Test code.
    4 F" _. y) t+ k. _4 f5 q9 v& }8 W
  8. *% r5 `9 e0 P1 w* O2 V; R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 u0 _" _' N" C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: k0 f0 i. r& K( W9 V
  11. *         TO CHANGE.
    & x6 r  d8 R9 b# h+ l( L
  12. *
    3 [/ o7 K3 b$ X' C9 [. c: {) M+ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% U5 M' i) R0 _- \: I2 O! a7 e
  14. *; b3 @: @  L/ w) v
  15. * This program is free software; you can redistribute it and/or8 b# }2 {1 h/ g3 F* @7 g
  16. * modify it under the terms of the GNU General Public License as$ D+ D9 Z" |0 h' }( U" x
  17. * published by the Free Software Foundation version 2., j* P! w, C0 Z, y
  18. *3 X/ ?- }% B6 i9 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ], W2 P4 T7 {5 ^$ N
  20. * kind, whether express or implied; without even the implied warranty
    8 @/ R3 {% g  g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# ]; T& S. P1 S& o8 l) ]- k
  22. * GNU General Public License for more details.( ]! E5 P# V, T0 E9 z# e
  23. */0 I( x& r; C% H* t( G  R
  24. 5 g7 f6 n! Q' Y9 x2 g4 N
  25. #include <linux/module.h>
    7 w4 |- v6 d) I) h+ I* [) R
  26. #include <linux/init.h>: Z* Z3 X4 J2 G7 H. j, u
  27. #include <linux/errno.h>
    1 v( x0 Q5 X* [( }& ^
  28. #include <linux/types.h>1 s: ^7 i2 D% A8 }% q7 Z) g
  29. #include <linux/interrupt.h>: Q  W8 v  S' W- a- k5 }3 C4 u) _
  30. #include <asm/io.h>: L9 D9 c4 V9 |
  31. #include <linux/moduleparam.h>
    $ ~5 g5 W6 l+ y3 O
  32. #include <linux/sysctl.h>
    1 ]) O) S" S0 O4 J5 ^/ o
  33. #include <linux/mm.h>
    1 E( C, g. K1 K4 T
  34. #include <linux/dma-mapping.h>% M" d/ Q, S# V0 b- h

  35. + ], M3 \9 O  @
  36. #include <mach/memory.h>. G! G" X6 O; E+ @. A2 h2 E0 \
  37. #include <mach/hardware.h>! U" A6 d8 l1 |! s8 k" {. Z1 \: Q, N! e
  38. #include <mach/irqs.h>
    - L& {! T& ]9 s  R/ X9 D; w: g% U( N
  39. #include <asm/hardware/edma.h>  @( [3 J- G% q& |4 }8 x/ A
  40. ; x  c( m1 k3 Z! u/ p6 _' l- J9 x, Y1 V
  41. #undef EDMA3_DEBUG5 f0 K+ e3 K& C7 |: o2 |
  42. /*#define EDMA3_DEBUG*/
    3 j5 k; k1 }; M& s

  43. ( D% T2 \0 i/ J5 u7 E
  44. #ifdef EDMA3_DEBUG
    3 ]- g4 ?' k8 ?" \& d3 s" ]. Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * a% `! }/ H6 m8 c7 u: t+ |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 T  t+ h7 c# y; _; S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): q8 y- o, K  S, Q
  48. #else
    7 A& y8 Z! J) f+ Z" K
  49. #define DMA_PRINTK( x... )
    ; U& {. D7 G% {
  50. #define DMA_FN_IN
    ; }& X2 K) j4 D" s# u: j
  51. #define DMA_FN_OUT
    % |. v- W8 \- @/ r: k+ k
  52. #endif
    & p+ x" @" F) E  h
  53. 3 ]4 X$ _: i' x, t) _5 Z* T" @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) k& ?5 H# x' y
  55. #define STATIC_SHIFT                3$ a5 k. o  v+ X$ G# C
  56. #define TCINTEN_SHIFT               20
    * X7 m! R. D8 T: o
  57. #define ITCINTEN_SHIFT              21( r% `6 d; p5 j% o7 E) s1 z6 [
  58. #define TCCHEN_SHIFT                22- y0 E% F5 ]: e: ^0 w/ J6 x, @9 |
  59. #define ITCCHEN_SHIFT               23; g0 c; _4 v9 x4 o* v5 u

  60. 9 |% z; [4 f. K5 c9 `. u8 [
  61. static volatile int irqraised1 = 0;
    # F/ A- g. E0 p0 y
  62. static volatile int irqraised2 = 0;
    0 R" T! o1 c+ U6 ^) ~& P

  63. 6 h& r: R2 O& C& D( \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ k  E- ^% d4 j( w% H- H1 d0 k3 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V6 m# S/ A0 W4 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) u0 i! K* [  P; y$ [$ x- ]
  67. 2 J# |  R: g' O  a& X5 i" G
  68. dma_addr_t dmaphyssrc1 = 0;5 v; c3 L$ m9 x6 p5 [/ P
  69. dma_addr_t dmaphyssrc2 = 0;9 A% d0 m; n; e% d6 E
  70. dma_addr_t dmaphysdest1 = 0;7 I; v6 E3 Y1 j, n6 F) p6 m$ i
  71. dma_addr_t dmaphysdest2 = 0;% C- k" u5 w; w& M$ w' M1 Z

  72. 2 ^: c- C6 X# g1 n+ w$ U
  73. char *dmabufsrc1 = NULL;' C& O7 F  \) B; _
  74. char *dmabufsrc2 = NULL;
    6 O" v7 K) J: ^- G
  75. char *dmabufdest1 = NULL;
    ! F- p8 C' H( Q6 D% L
  76. char *dmabufdest2 = NULL;+ r% a0 f5 T( Z6 N

  77. ' U9 y: S+ g3 ]! E' ?5 d3 T/ j
  78. static int acnt = 512;
    + A  S+ U2 u  |& L* p; z
  79. static int bcnt = 8;( x4 k* c7 a! w7 l- M2 m6 M# N
  80. static int ccnt = 8;
    ) o! e6 [( O  n" Q' L9 B, l# H
  81. 0 [( d  w( Z! C; i  I8 ~: a
  82. module_param(acnt, int, S_IRUGO);
    " A  O6 F& [0 X& l; i
  83. module_param(bcnt, int, S_IRUGO);
    2 U. B' R% W9 \% B& H& r% W# C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 y$ E. Z# T' E% ?& T' ]/ W: _2 I* m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' }" ]9 E3 ]* j% m7 X  n) w; aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  G; d& ?% E; [  r, H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  P/ A$ L% V5 W8 i, z

( E3 b* k" O# \/ ]- b) o9 `2 p) X7 Y7 O6 h9 t5 ~0 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 13:48 , Processed in 0.039415 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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