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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % X7 `) G8 h; H6 U% c( J
  1. [code]EDMA sample test application
    6 \" a1 j+ D: F; W: g4 q" Z
  2. /*- K& r' C1 ~! e8 B0 X
  3. * edma_test.c
    0 J  l4 p% G; y; a# B- [* k
  4. *
    ! v6 J- h& q+ n. F! |
  5. * brief  EDMA3 Test Application
    2 i+ |2 C& X3 M% k7 ]
  6. *& l/ t' O! q. a
  7. *   This file contains EDMA3 Test code.3 Y. ]7 _$ W; U# W1 j7 ]8 j- J
  8. ** R) O0 B5 q3 }, n4 n# S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 `  ^) u4 e5 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- j' F1 U3 h; z( H
  11. *         TO CHANGE.
    * o% R1 r' r  V% E
  12. *7 `2 w1 Y  J( l- a: C* x6 F* O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! T6 W7 M6 x3 y" |' @0 i8 h7 J$ K
  14. *
    9 ~! v% I  K1 W4 s5 v# C& N" [
  15. * This program is free software; you can redistribute it and/or% U2 I9 @( ]; Z: n' `1 e' a# S
  16. * modify it under the terms of the GNU General Public License as
    8 R: B1 ]2 F! c
  17. * published by the Free Software Foundation version 2.; i" |  R+ S0 w5 z9 T; n
  18. *
    . E* E% {2 ?! _6 W  T: b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . r0 U+ W4 U4 f+ v6 ]/ e
  20. * kind, whether express or implied; without even the implied warranty. ]2 t. h+ T$ [! o6 D7 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % q) u. w9 t" G' H  }
  22. * GNU General Public License for more details.6 a, M8 F; \4 {" R! k
  23. */
    " Q' U& F% w+ N; _: Z

  24. , X2 ~6 |6 ^, R4 s6 f: m
  25. #include <linux/module.h>
    4 i) t5 _8 E) Z: f1 O
  26. #include <linux/init.h>
    8 B: V* n7 H& J9 i4 F& Z& `
  27. #include <linux/errno.h>
    . l9 ~; l( r# G1 a0 L( ?7 y
  28. #include <linux/types.h>! i- V. b+ K  g  U
  29. #include <linux/interrupt.h>) A. K& r" B7 R3 A
  30. #include <asm/io.h>
      d  F4 I8 \- c6 f1 P
  31. #include <linux/moduleparam.h>
    ) a; k) U1 Z" `$ J1 a4 X
  32. #include <linux/sysctl.h>
    0 m# P5 {+ `" n! O0 `# k
  33. #include <linux/mm.h>7 _" p! s4 r$ g( t# r
  34. #include <linux/dma-mapping.h>
    : E* v; T& h3 ^+ `
  35. ) ^9 r/ R# D+ e3 |
  36. #include <mach/memory.h>, `/ w5 m$ l1 C
  37. #include <mach/hardware.h>
    - {0 S8 Z8 U, u- H) x8 c1 T
  38. #include <mach/irqs.h>
    3 E% O5 a+ a# ^, ]2 s# e
  39. #include <asm/hardware/edma.h>. |% ^/ [) L' ~& f

  40. ! l! ~7 I  X% r' T$ E  y' P% Z" L
  41. #undef EDMA3_DEBUG( ]3 B) Q9 G6 Q, T8 `( P  N6 n* S4 a
  42. /*#define EDMA3_DEBUG*/( g7 K' e2 U& q3 ?" Z5 m9 j: Y* e( Q+ A

  43. - V: D" U8 L4 N7 f) e0 ^1 l7 a
  44. #ifdef EDMA3_DEBUG
    5 ~1 \9 X; n+ H; Y* _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- G* V4 R. W* G: v# A& Q( X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ U/ @* q+ z8 n7 ?- V' U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 u- I9 P  E) k' V$ o
  48. #else, {4 }/ h' r1 c+ n
  49. #define DMA_PRINTK( x... )
    # @, A# u7 R% t( w
  50. #define DMA_FN_IN, q: E5 D4 D: D6 ]7 k+ Z
  51. #define DMA_FN_OUT
    ( n4 ~, E! r7 E4 _
  52. #endif
    + X- g+ _5 }. E3 U! L
  53. 8 H' y0 N; s5 ^- h3 L1 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 u$ T! f$ A/ ]& @
  55. #define STATIC_SHIFT                3
    ! [1 d2 ^, n, B+ o
  56. #define TCINTEN_SHIFT               20
    * D' n4 S4 t" ]% e) P
  57. #define ITCINTEN_SHIFT              21
    / r' k6 P1 m- f! n
  58. #define TCCHEN_SHIFT                22
    0 c9 p3 s+ V( p, i0 s, j
  59. #define ITCCHEN_SHIFT               230 X- n8 j  O* N( X/ T

  60.   E) j/ c$ A7 {$ z$ |0 d
  61. static volatile int irqraised1 = 0;& x  t0 `. b4 m. B' ~
  62. static volatile int irqraised2 = 0;4 T4 m' _% B. @( \- G5 q/ S' v

  63. 6 K  e8 q4 X: X$ h/ I. I! e% m* I5 ?+ g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s6 }+ k& Q( d3 r& b- K# I. l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , O& L' V& d, o+ p) U8 r2 t# D# b( `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i( d. Q, I8 a5 v7 V; H

  67. , T4 b( y% `3 m2 R' B3 e
  68. dma_addr_t dmaphyssrc1 = 0;; n7 X( \1 a) y  \  `4 _  f
  69. dma_addr_t dmaphyssrc2 = 0;. P; Q- A5 x" b, h
  70. dma_addr_t dmaphysdest1 = 0;
    ' E, @- l# z: o5 |* D$ a$ B
  71. dma_addr_t dmaphysdest2 = 0;6 n, Q' d  M6 K( o) ]+ W$ _4 c

  72. 7 _" \. k/ m% I% G6 C, Q( Q1 V+ f
  73. char *dmabufsrc1 = NULL;
    & J% R+ G9 I; J  d" K
  74. char *dmabufsrc2 = NULL;; N7 O0 w  p3 Z: [8 e- d+ t8 n
  75. char *dmabufdest1 = NULL;" J3 @8 Z. e7 }9 p' ~5 X, b) j
  76. char *dmabufdest2 = NULL;% u. |9 n7 g4 l! t- i& B
  77. . v5 R* ~# k. h  M' j
  78. static int acnt = 512;! N, H$ ?3 z% T% c
  79. static int bcnt = 8;
    4 u" }/ e2 R: b) j+ \
  80. static int ccnt = 8;9 _. G: x1 T: I; ]
  81. + o, ]" G  n0 d# V# Y8 c
  82. module_param(acnt, int, S_IRUGO);1 L' g! \" a7 }( q0 c% F
  83. module_param(bcnt, int, S_IRUGO);2 p. M, S; {& R  N7 j# x8 T0 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! h9 `( Y, B7 p& g+ N
3 c' K3 p) o% j" b/ v8 J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ \4 E. S" C; u4 @+ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ?+ Z3 J4 {5 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( d% G8 `- Q  f0 D' ~- X
( h/ S" R0 s# h: c- y+ G
7 r3 l4 Y! |7 T$ o: x3 b8 C1 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 20:39 , Processed in 0.040410 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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