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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # X' k0 T  G1 [! t$ O' t
  1. [code]EDMA sample test application
    : W% h$ Y) `6 X; g" ?. l
  2. /*4 W  p' k6 p9 B! T
  3. * edma_test.c; W4 Z+ h! J7 Q" a
  4. *
    , y# z" ^; e- ?' J. `9 a9 d; [
  5. * brief  EDMA3 Test Application
    ' |$ E1 O# a3 \. K7 W
  6. *6 y. w7 _9 {- k$ C' ~* k' V0 D8 F3 ]
  7. *   This file contains EDMA3 Test code.
    3 @2 E+ J3 y* I, c
  8. *
    1 o' j* ~* O/ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! K# [( H9 }! \9 t, `4 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* W8 Q6 h; I* j7 P6 B
  11. *         TO CHANGE.+ l7 j1 C+ D+ `& L- {. I. i
  12. *
    , K$ C% _% c+ G0 {& r4 J, J6 V, W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ q$ }% S3 V3 z6 g9 O2 Q
  14. *
    * N6 y+ v0 f2 p- T# @
  15. * This program is free software; you can redistribute it and/or
    * s6 Z' \8 e) |7 E' X% t, P
  16. * modify it under the terms of the GNU General Public License as' s  _$ [4 p( F- [! f
  17. * published by the Free Software Foundation version 2.4 ?5 z9 F& U6 V
  18. *
    ' c7 g+ s3 W' f- K+ \4 Y9 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 k, Q* T' |! k8 L
  20. * kind, whether express or implied; without even the implied warranty
    * C, {0 ]/ C4 S0 N  E6 M) ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 A! Y1 B+ }, W& i) d0 J4 f
  22. * GNU General Public License for more details.: \/ P  ]5 A0 {) J  Y0 Y: n0 ^, N
  23. */1 b' d6 V# u9 E9 _" R% R7 Z% V# S

  24. ' w; i0 }, }  E6 _
  25. #include <linux/module.h>
    ' w* q- u! F, i
  26. #include <linux/init.h>" c* A& l, ?' L9 y% j0 u  a
  27. #include <linux/errno.h>3 \, q! r2 E! d9 v
  28. #include <linux/types.h>
    ; k, _  }1 l4 v+ O8 ~1 l/ `
  29. #include <linux/interrupt.h>& A0 F# o. @8 }4 T3 s
  30. #include <asm/io.h>
    6 L9 y# i/ j- P; c( h
  31. #include <linux/moduleparam.h>
    3 p' Y! U* i- V  M
  32. #include <linux/sysctl.h>; S0 E. {: E; s% t" W5 j
  33. #include <linux/mm.h>
    ! ?( X* U9 a" R$ K$ [* a. x, Q
  34. #include <linux/dma-mapping.h>
    + w' d# j: P) j9 j5 o6 D3 F/ d. k

  35.   d' @7 {( I% e4 @+ g
  36. #include <mach/memory.h>8 k% m- b2 P8 A: |
  37. #include <mach/hardware.h>
    4 l4 F" P/ A7 i$ u8 p
  38. #include <mach/irqs.h>2 Y! ?  X# F5 e' c& J
  39. #include <asm/hardware/edma.h>
    : A* Q+ D% z3 ~3 |( R/ I% d. m

  40. 7 z( ^2 F/ B- j* h' X" |
  41. #undef EDMA3_DEBUG) n% |5 `# x+ l3 P, Q
  42. /*#define EDMA3_DEBUG*/
    % Q  t$ x% R: X
  43. , h" D1 i+ c, s' s
  44. #ifdef EDMA3_DEBUG* R: W  k5 `- ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 ^/ W* H  b/ H* E5 D/ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 M& [7 o  N* \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / `( X  A. q& {9 n2 t
  48. #else
    0 y% U9 o  e5 U: }: h
  49. #define DMA_PRINTK( x... )! J. Z! H( a7 a; c! D
  50. #define DMA_FN_IN6 X6 s0 C, x2 a" D
  51. #define DMA_FN_OUT' Y: Z( `1 F- C- B6 z4 ~
  52. #endif
    ! g% p: \! K2 H: W0 e
  53. 8 t5 z" W$ w5 R: g7 N2 }6 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ [: l9 d+ J1 ]4 g
  55. #define STATIC_SHIFT                39 _$ V! k8 ?; A3 m
  56. #define TCINTEN_SHIFT               20
    # m' d$ a. J/ {- u& e
  57. #define ITCINTEN_SHIFT              21
    ) h1 k6 N! t' L4 i/ f( o
  58. #define TCCHEN_SHIFT                22
    ( {$ h8 a) k3 X7 R( f& ?
  59. #define ITCCHEN_SHIFT               23
    * B- H- W9 b6 m$ I
  60. , o( m. b7 t. p2 w
  61. static volatile int irqraised1 = 0;
    5 G" v# _. F/ B- v. h5 [
  62. static volatile int irqraised2 = 0;
    " x# t1 g% p* ]. g6 D/ R
  63. + X- n6 N: [& S8 g( {8 w8 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ?, I9 b' Y" d1 N* A" n8 }5 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 g( k* q# `6 q3 o. x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( H5 d* z6 `% S: D% \: I
  67. 4 a" R9 q4 O( \5 U2 Z* W
  68. dma_addr_t dmaphyssrc1 = 0;
    7 A5 F: M  d! j3 c% `3 @
  69. dma_addr_t dmaphyssrc2 = 0;
    ( T4 K4 v% \; x2 L
  70. dma_addr_t dmaphysdest1 = 0;. b' T% O! U; A6 W7 V( a
  71. dma_addr_t dmaphysdest2 = 0;* ]! |" G. ?' z; m* g8 v0 z

  72. ) G1 }$ w2 b8 M7 z
  73. char *dmabufsrc1 = NULL;2 [2 i5 V. B8 `& E
  74. char *dmabufsrc2 = NULL;; d+ N4 H! Q+ h( d8 |' o5 A1 T
  75. char *dmabufdest1 = NULL;+ u3 X1 ?& V$ `. c2 Y' M" f5 T
  76. char *dmabufdest2 = NULL;, `5 ^4 d. Q9 I2 B" g

  77. ! V" |- A$ M0 Y
  78. static int acnt = 512;# H. m/ B4 Q" ^
  79. static int bcnt = 8;
    6 j' Z% z1 D. K5 T' r
  80. static int ccnt = 8;) ?) `6 d8 \$ G1 }  o( W) }
  81. / e5 ^. Z9 S% J: D2 E
  82. module_param(acnt, int, S_IRUGO);
    $ |* [6 L/ g/ {% }
  83. module_param(bcnt, int, S_IRUGO);2 o9 V' S5 k: O4 O+ b( u( L! D: y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, w' [8 c' f* @

$ ~8 D3 q8 @$ h6 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' w5 V6 N# S  G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 O% m. k& Z: q" |$ ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U$ P; T8 B# u1 K  I
( C8 }. e! L( k8 q$ |3 h2 t$ r* K" }* \. T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 22:40 , Processed in 0.035205 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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