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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & U( m; J6 J! W  ?" G; d
  1. [code]EDMA sample test application
    6 m& q0 S4 F, }; P* ?
  2. /*
    ' P  J. t! J2 n3 \
  3. * edma_test.c( L/ b; f/ ^7 V0 d% s, Z# v5 X
  4. *0 Z5 ^& {3 {' o+ P# J/ X
  5. * brief  EDMA3 Test Application
      y/ `' P( t/ F. z
  6. */ k* \5 K$ h! I1 v+ J- U( |4 `
  7. *   This file contains EDMA3 Test code.
    # q& |" I9 Y6 M
  8. *
    5 `* n# P7 [1 I3 b, q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 n  _+ {. t8 j$ u& ]5 N- D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 ~: ~1 e$ H6 U% k
  11. *         TO CHANGE.
    0 w: h9 `" w, B
  12. *- r) U$ s& i* \7 n. v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 M0 r) }* C# M) W! A# A
  14. *5 |( p5 N  }9 L. w; ^: m+ Z2 B( W2 U) [
  15. * This program is free software; you can redistribute it and/or
    $ K$ Z- k) o+ G  x" m  O
  16. * modify it under the terms of the GNU General Public License as
    * D  @: G5 ^3 e  m& V- k
  17. * published by the Free Software Foundation version 2.
    5 W3 V+ q9 L- F
  18. *
    1 W% ?9 e2 e* l) d. r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" Z1 Y1 i& S0 [3 [
  20. * kind, whether express or implied; without even the implied warranty0 ?4 F0 q5 Q! ~. ]+ U7 v6 L3 A9 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 S% R( y$ Y( k. i! l5 e. M' ?
  22. * GNU General Public License for more details.
    7 O3 S0 b1 U& O
  23. */
    : b& H, _2 m2 A3 N  H+ Y

  24. ( @9 `! K3 \) F9 n
  25. #include <linux/module.h>4 U" i- _, }9 J
  26. #include <linux/init.h>
    2 D: z6 |$ n, J% \$ L$ F5 [
  27. #include <linux/errno.h>4 V+ S! P3 B9 g* G8 _& ]
  28. #include <linux/types.h>
    9 n) L' y. `) K# e
  29. #include <linux/interrupt.h>  \6 _" m) D( S- X1 O- w# c
  30. #include <asm/io.h>
    " _8 t' B9 V5 R. q' e9 P* @$ V7 N5 @
  31. #include <linux/moduleparam.h>  E, O7 _% V% g6 L% H1 ~- E
  32. #include <linux/sysctl.h>0 j+ t6 r& e* x" e! a* {# l9 y
  33. #include <linux/mm.h>6 L' A. p7 Y" ^
  34. #include <linux/dma-mapping.h>
    . g- c% v! t7 H: I9 |

  35. 7 `+ ^) R  m  X4 |# X
  36. #include <mach/memory.h>" [. b: ?3 z4 Q$ Z6 r: k6 c- I  D1 P- D; Y
  37. #include <mach/hardware.h>; p- U% D( |. O
  38. #include <mach/irqs.h>- Q* Y+ e0 i! o
  39. #include <asm/hardware/edma.h>
    2 l! v! ~) A' V  e* u
  40. + T; q( z0 G9 c8 y" V: [
  41. #undef EDMA3_DEBUG
    5 U8 g. m/ q+ T6 W
  42. /*#define EDMA3_DEBUG*/
    " n3 ~1 i  S3 @) M; @; E

  43. 0 h0 M- ^( r4 x" T9 x6 I8 Y$ I" C
  44. #ifdef EDMA3_DEBUG) c6 n, Z" T9 J0 i  O( ~/ h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; k9 b5 ]- D  m' e& Z, S: w  a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 p6 k5 u& j1 x! u) ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ i/ I1 Z2 r# f
  48. #else
    / `$ o' M8 F1 X' p) U" j' F
  49. #define DMA_PRINTK( x... )% @% R0 T8 n+ j& I
  50. #define DMA_FN_IN
      @- u% B& G- H4 T( S
  51. #define DMA_FN_OUT  X) r8 z/ R( k; ^$ a3 ^* M1 \
  52. #endif
    7 J5 h  _" l9 J* V# f
  53. + F. o6 U, J7 u( O0 b) r9 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ c6 A! L) i2 R% T! @
  55. #define STATIC_SHIFT                3* E, B* Q5 x: [7 {3 _
  56. #define TCINTEN_SHIFT               20
    - v* O0 j. S% Z( C0 v
  57. #define ITCINTEN_SHIFT              21
    5 D2 R6 i% d5 I9 b; e( d6 I) v" o2 D
  58. #define TCCHEN_SHIFT                22/ ]; t' Y! g& m
  59. #define ITCCHEN_SHIFT               23
    % Q& m  _) V1 ~8 i9 I- Z
  60. % y  L+ T2 j" O' f. v
  61. static volatile int irqraised1 = 0;
    1 f# R1 y/ P  Q8 C% u
  62. static volatile int irqraised2 = 0;
    9 u7 H% [+ A. C* H
  63. % A$ n; ?5 Q" P5 b/ g1 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# I1 U3 S( [7 M# C0 W+ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R0 E0 U; r( c/ P, X2 Z' j, Z, ~, X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 T5 Y9 {) F$ K* u/ x

  67. 7 N6 W$ W! s. U7 f$ ^% ^
  68. dma_addr_t dmaphyssrc1 = 0;
    9 |' C9 q0 w# ]" X
  69. dma_addr_t dmaphyssrc2 = 0;+ X4 ~( @) f) ]
  70. dma_addr_t dmaphysdest1 = 0;8 w" Z. H/ Q6 g/ V: C
  71. dma_addr_t dmaphysdest2 = 0;- ~9 p. R; G" ^' o0 A( L. `
  72. ) H. F( p* O* e( Q* l
  73. char *dmabufsrc1 = NULL;9 l# g' S/ s1 X* c
  74. char *dmabufsrc2 = NULL;( c5 p3 u. K( a* d
  75. char *dmabufdest1 = NULL;; j  j6 r. j/ B  w. R
  76. char *dmabufdest2 = NULL;3 ^5 u  U2 q$ k  A$ g

  77. 0 d( ^" y# e4 k- D% b& C
  78. static int acnt = 512;+ b7 z) n  L, y  J7 M$ R# J
  79. static int bcnt = 8;* P2 c2 h) [4 F) ^8 K. k
  80. static int ccnt = 8;
    1 h' C8 l' q! u2 b" E

  81. , N) k7 I' }- y
  82. module_param(acnt, int, S_IRUGO);
    4 u' w7 [7 B% O
  83. module_param(bcnt, int, S_IRUGO);6 y0 ^  c3 t( j( \; Z! n0 j. a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^- n. {6 T' @
4 N2 N+ z1 C* {. }- C0 A: ~( \# b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) R: T9 M- e# J5 c5 v" g" S' H3 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" c+ |% e: `9 V/ q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 k1 f6 ?2 W- b  ~) Y$ g
1 [6 y9 ~; x9 L9 @

& b* i' B( D- q, N. ^/ z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 12:36 , Processed in 0.046353 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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