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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " [7 J' U( O. M' ]! j
  1. [code]EDMA sample test application" P& u. }& j) X0 }
  2. /*5 S6 @: `8 c8 [) z
  3. * edma_test.c. }/ j" |' f/ L4 o. m. {
  4. *8 F/ J4 i8 d, c3 O% j
  5. * brief  EDMA3 Test Application
    $ p1 {$ ], u; M7 a3 s' V/ t
  6. *3 o2 Q$ {1 H1 q1 t+ r( X
  7. *   This file contains EDMA3 Test code.
    ! x% T/ Z5 c$ p0 W4 v5 s) U8 F
  8. *, O. n* D  Z0 f' D( C& k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " f; k% |; \2 D3 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; k3 f0 ?5 j, _1 n# m' @& M
  11. *         TO CHANGE.+ `" Y. Q+ g# |* F
  12. *
    " w0 p- c/ y0 V8 U9 a6 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + s2 [" Z3 P; O  z( T! P; K
  14. *, E  X( {6 y. r* n1 u$ @# K1 ~
  15. * This program is free software; you can redistribute it and/or) [  r/ D8 O1 s5 P2 k
  16. * modify it under the terms of the GNU General Public License as) y9 z+ z& q3 ^) i3 d
  17. * published by the Free Software Foundation version 2.
    ) s) D  [. L9 _/ V& K
  18. *
    3 K# ]. Z2 P! ~( k0 K, F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; B- P- e& C* H* P5 X
  20. * kind, whether express or implied; without even the implied warranty
    ; O2 ~' K6 B# X& c, b1 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 [0 L. O+ P; s8 M9 Z1 x; \8 n' ]- z
  22. * GNU General Public License for more details.2 a/ L) k  }% K' C0 B# z' z& `- y
  23. */
    0 L5 l9 R- S2 {
  24. 3 D. G3 R% ]9 L' }# G$ P
  25. #include <linux/module.h>& s) N' @9 d  d) w, `  v
  26. #include <linux/init.h>0 c' A" K7 J1 e/ L# T, t* Z3 y
  27. #include <linux/errno.h>
    5 O; B( g) X/ _) g' j$ ?  \' O. F2 h
  28. #include <linux/types.h>' ?; r. C6 T0 h
  29. #include <linux/interrupt.h>: E& I$ c  @$ z6 z
  30. #include <asm/io.h>+ [8 _( Z( n7 m8 \9 K, X
  31. #include <linux/moduleparam.h>
    3 b; g' ^# b5 D  h4 S# L. @
  32. #include <linux/sysctl.h># F' ?6 T# X: x) E+ x
  33. #include <linux/mm.h>% z6 ]# `3 S4 q0 Y. b8 G9 N7 l
  34. #include <linux/dma-mapping.h>
    & p% p) l) |/ c( U
  35. & W1 j/ I! X3 f# K) m, O( G
  36. #include <mach/memory.h>
    $ I6 [/ b, y4 k2 S* B/ ^7 b
  37. #include <mach/hardware.h>7 I9 w+ V( X" i+ T$ M# ]
  38. #include <mach/irqs.h>
    % M, |% ?; Z9 [! s! r- @8 E8 K
  39. #include <asm/hardware/edma.h>9 ]  V9 G5 _* {. J
  40. $ v0 h0 x3 O/ b4 ^% m
  41. #undef EDMA3_DEBUG
    4 v% w7 t9 {9 H, T
  42. /*#define EDMA3_DEBUG*/8 {' |: }# u$ O) L- g: c
  43. 2 K$ r! b2 p  U2 L9 W% {
  44. #ifdef EDMA3_DEBUG/ N% G% D) ~7 M4 ]- j5 d8 V2 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( K6 Y' j) N" k" Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! S! @4 o0 w, m2 n' e7 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  V: Y& J# s5 O7 s" \% \, Q1 x
  48. #else
    ) H- O3 t9 J6 f, s; e4 p
  49. #define DMA_PRINTK( x... )) U) A, _8 ~, k1 [2 S5 T
  50. #define DMA_FN_IN4 i0 N$ G9 G! \2 }" p
  51. #define DMA_FN_OUT
    / q. c" P0 B! y! s1 L) d* q: i2 q
  52. #endif
    ; ^( ^/ F. Q& x2 u
  53. 7 L8 q7 t, u6 J% Z6 I: e; f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 O: Z  N3 f4 ?9 I1 d4 H
  55. #define STATIC_SHIFT                3( A# L$ ]* k& ^
  56. #define TCINTEN_SHIFT               207 C* [( [2 G5 ^% U7 g4 J, b4 Y! I
  57. #define ITCINTEN_SHIFT              21
    0 f. L8 ~: W! a
  58. #define TCCHEN_SHIFT                22# z. @4 \: [! r  K
  59. #define ITCCHEN_SHIFT               23
    * R# H) l' k- q0 o* d6 S5 P

  60. 6 a( o' N% y8 k! X! p6 M
  61. static volatile int irqraised1 = 0;
    * X6 \+ d( N# ^% \( s, c
  62. static volatile int irqraised2 = 0;
    1 n1 V+ [4 V3 }2 ]+ \

  63. * o* h" I4 Y, V1 f7 M; N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 z, j: j' Y8 [, }4 C' h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [' n* ?% N4 m- r* K, j6 R/ `+ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 L  Y$ R7 [4 q! A4 r! q; d5 m

  67. 9 f3 e4 y4 q0 U7 f4 G- g- l
  68. dma_addr_t dmaphyssrc1 = 0;
    / d: c1 j5 J) a" b9 V5 P& E1 v3 ~
  69. dma_addr_t dmaphyssrc2 = 0;4 d( s. n* j! ~3 z
  70. dma_addr_t dmaphysdest1 = 0;2 e$ Q# x) ^* J. G8 Q+ F
  71. dma_addr_t dmaphysdest2 = 0;% T8 H6 e" o/ m6 C
  72. * D* W, U1 ~6 ]& ?
  73. char *dmabufsrc1 = NULL;% w% q* V5 Q8 z" B
  74. char *dmabufsrc2 = NULL;
    6 f/ U1 h% x9 o* R8 o6 |4 ~$ c$ _
  75. char *dmabufdest1 = NULL;
    # l% S: @! h7 R
  76. char *dmabufdest2 = NULL;
    5 o; K; \3 {! L3 |

  77. ' a: V0 b, A# f) ^7 B. h9 L, J
  78. static int acnt = 512;3 W$ Z% f) G8 L
  79. static int bcnt = 8;: C0 _0 M9 U9 x+ X# a* K( _
  80. static int ccnt = 8;6 d8 ~3 h, C7 O, T9 o- M
  81. 5 |# O7 V4 }9 O* L$ w% Z2 Q. ~
  82. module_param(acnt, int, S_IRUGO);
    " b% K! `0 y- F% d& P, Y4 o
  83. module_param(bcnt, int, S_IRUGO);: u* M% F7 |( N$ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ L) ^) k7 c6 I- D$ R6 J/ T

* }8 G; |% j9 e- I* `7 f7 E' D' D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ u4 W2 g: q8 U% Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 l1 H  Q. S, O0 T7 e4 X( O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 H; N0 p1 o- Z% g7 f: {! E' f' ^- m9 s  o

  T; k6 k. j( T% g0 a( A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 10:44 , Processed in 0.044859 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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