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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `3 e3 j( i: g
  1. [code]EDMA sample test application; T1 W9 i3 u% g
  2. /*
    : r2 I8 Y& x7 l: c& w& s
  3. * edma_test.c& b7 \7 m5 H/ L3 X: M. B: T5 r
  4. *- ~4 d& W; w6 I7 `
  5. * brief  EDMA3 Test Application
    $ O& k6 X( B% d# Q3 b- @' o3 Q
  6. *" j- H5 V& g% g' K% |1 F! |
  7. *   This file contains EDMA3 Test code.5 |3 E3 _& h! C
  8. *( T2 X; i! C; y2 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! y# j0 x6 T4 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ ^9 Q. J6 s6 L6 w$ F% k, h
  11. *         TO CHANGE.
    0 w6 M- Z) ~  k' U
  12. *- r: s0 Y, F- \" L9 P. p) t# Q  O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / o; ^' T- n/ X2 z# |) [
  14. *
    3 X* E& I" w( b
  15. * This program is free software; you can redistribute it and/or
    : S. j! ]7 N: M( k1 X/ ~# ^
  16. * modify it under the terms of the GNU General Public License as8 Y$ e" R% [! Q2 U: \6 o4 o
  17. * published by the Free Software Foundation version 2.
    0 P4 u$ K  l- l( l: R
  18. *7 S! M' m1 R& x; ^3 k) N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 G# O# `$ `5 A* p3 }9 @
  20. * kind, whether express or implied; without even the implied warranty8 p9 y) M' y& X% ]9 z9 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# w; d2 Y0 ^0 P1 a( z0 [
  22. * GNU General Public License for more details.
    $ Z) w# G" H: V9 T( [  l9 n3 \
  23. */
    9 ]; x% ?: O( S) r4 f! Q7 A1 J2 H3 \

  24. 0 O) g$ F# c/ b3 d# R  V
  25. #include <linux/module.h>8 C- L$ D+ d' j# t
  26. #include <linux/init.h>5 W' m0 w* E: A6 |7 ?- ?! E' A4 O
  27. #include <linux/errno.h>
    6 g( G- \' o4 x2 c$ `9 S6 F  U. M
  28. #include <linux/types.h>
    1 {, g* U2 z0 s* ?0 [2 m
  29. #include <linux/interrupt.h>* [2 m& _6 N9 q* `6 @
  30. #include <asm/io.h>1 O+ M5 R5 `# M
  31. #include <linux/moduleparam.h>
    6 X/ [* Y+ ~) M+ f
  32. #include <linux/sysctl.h>3 X4 e/ n! }  R4 r2 C$ W- J
  33. #include <linux/mm.h>1 N. h% N2 _" i% }
  34. #include <linux/dma-mapping.h>
    3 y' t2 W/ P) }+ Y" g
  35. 4 C# E6 J; |. f4 D
  36. #include <mach/memory.h>! W. j. w9 K& b4 R6 M7 e: D
  37. #include <mach/hardware.h>( U7 M4 C3 }8 n$ v0 K8 |) z. I2 d
  38. #include <mach/irqs.h>
      O1 t. c2 q8 o. i
  39. #include <asm/hardware/edma.h>
    / u/ G3 _* ?) V/ q0 W0 M

  40. ! E% O3 P6 _1 b; s
  41. #undef EDMA3_DEBUG
    / Z) e3 j# g/ o! U# Z8 ]( a2 W
  42. /*#define EDMA3_DEBUG*/
    ' R, Q' ~1 b7 q/ O( X

  43. % ?* I" O: n( M+ C( j: T
  44. #ifdef EDMA3_DEBUG
    9 }- }0 B2 P, }4 o& r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" |0 |5 k2 f8 D( a9 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" U% E* w7 t' K$ _8 F# X- i* g+ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): J' Q- G: S8 K/ Q* ?
  48. #else
    6 N, \1 g" n2 u( ^. b& q3 l
  49. #define DMA_PRINTK( x... )( U6 V" ]3 b  b4 H4 ~& e/ G
  50. #define DMA_FN_IN+ k# m% S% E+ H8 N- R
  51. #define DMA_FN_OUT
    / O5 j* @* ^. P& O, v/ ~
  52. #endif
    ( |" N% @1 K' m; N  ^* h) ]
  53. - c4 [+ z! m1 H# p' l& v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); N( f% @8 d& D% H2 o2 e
  55. #define STATIC_SHIFT                3
    ; Z. U" e* x4 h! G, v. [
  56. #define TCINTEN_SHIFT               200 X; p9 S4 x6 Z$ G
  57. #define ITCINTEN_SHIFT              21
    9 ~; c4 D+ N) f" O6 g0 U
  58. #define TCCHEN_SHIFT                22
    , h6 I# E" @+ _
  59. #define ITCCHEN_SHIFT               23' C3 P1 ?  H8 ?+ b( x  w( j

  60. 3 Z2 w- F3 N5 x4 ]: A: a
  61. static volatile int irqraised1 = 0;) Z; ~& D$ h! v9 s* t. d8 }
  62. static volatile int irqraised2 = 0;
    3 G  V2 r1 Q6 f2 X* t: p

  63. . e% j' C& S; J; T% L6 D/ Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e- D! D, r/ o* A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 \) @0 k+ I7 y8 P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r& _) @/ R# M
  67. $ ]6 R, `( C3 F
  68. dma_addr_t dmaphyssrc1 = 0;& k' [( P' O6 a0 A9 `5 d* |
  69. dma_addr_t dmaphyssrc2 = 0;0 n# G! B: m  D
  70. dma_addr_t dmaphysdest1 = 0;% ~4 T' c3 l: u6 _- Z
  71. dma_addr_t dmaphysdest2 = 0;
    / W  a* I( g- ?- d0 V9 t( j
  72. 6 V3 j5 Z) w, d3 u6 C! l" E
  73. char *dmabufsrc1 = NULL;# ~! w% }$ z  A( b
  74. char *dmabufsrc2 = NULL;+ Y9 S! E4 H" I7 \
  75. char *dmabufdest1 = NULL;5 ~5 _, A: x9 ^
  76. char *dmabufdest2 = NULL;
    . M) }" i6 c: h( w5 o

  77. 1 O6 O2 Z' L7 n* A: Z6 Q
  78. static int acnt = 512;$ L' ^; Z8 ^' h/ J# r
  79. static int bcnt = 8;+ a' H: T  K6 h5 m$ L% |
  80. static int ccnt = 8;0 V! L: H$ K7 U

  81. 4 j4 a# s4 z: Z% E
  82. module_param(acnt, int, S_IRUGO);
      f) \) k2 i7 \6 @: @
  83. module_param(bcnt, int, S_IRUGO);
    - L' R8 j: g; Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ I: e- A- x5 M! {" T* ]/ |5 d5 {
0 ~3 B# Y; X: a  t7 W5 d  T/ P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 \, O4 D% K& ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: Q$ d% i0 f+ ?+ L- H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' b  N; p2 F) E( H

' J3 F  G% \3 B5 M% k+ r" x! ]: O. A+ k  Y% c7 l; s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 03:31 , Processed in 0.038914 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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