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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' j6 F. E% {1 U( k* P
  1. [code]EDMA sample test application) B' ?/ P" `$ }' u# L
  2. /*
    " e, X0 @& M8 A
  3. * edma_test.c7 P% Q* `+ p5 Y# t* E1 H' ^( B
  4. *
    * y3 U2 E! k3 ?- E0 P$ i7 o+ r
  5. * brief  EDMA3 Test Application2 {; F) y. b+ t  B/ r* K+ H
  6. *
    0 Q/ X( P. y3 _  G3 `' Z
  7. *   This file contains EDMA3 Test code.
    3 r' @. r, W3 r# x* |
  8. *
    1 g( E# g5 J/ Y3 ~9 x0 ]& [5 s' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ m4 s+ _9 A% y: V1 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: D  h& G1 i: ^+ r. i9 X  K
  11. *         TO CHANGE.3 }8 \  y+ }/ O* N: D6 y  J2 }
  12. */ E9 A4 K, l- ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 P2 r: |0 e1 z. p
  14. *
    * M7 ]( m1 M* ?0 C# H. I
  15. * This program is free software; you can redistribute it and/or3 Q( i2 j# a* T6 Z/ Q- D( W
  16. * modify it under the terms of the GNU General Public License as
    . O% M; _" ]( Q
  17. * published by the Free Software Foundation version 2.' C( p/ H$ {; e$ `: X7 v4 m
  18. *
    6 N, x- b6 Z/ r" ]- K+ a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 \: O: a8 H: y+ B, h" w
  20. * kind, whether express or implied; without even the implied warranty2 H# e1 ~% ]$ K+ m: a* O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: U, t) ^6 g% }; \8 B
  22. * GNU General Public License for more details.7 z8 A, f" z& G% }- K, ~0 p1 d3 A
  23. */1 b0 o2 h: z! ]
  24. 3 T% T# u# `  _+ b
  25. #include <linux/module.h>
    9 }& Z' F- u* y1 G. _
  26. #include <linux/init.h>
    # v+ B- b) W0 r# l
  27. #include <linux/errno.h>- L. r( Z5 k7 `( j' i" D
  28. #include <linux/types.h>  M) a0 O5 ^) Y+ i3 w: o
  29. #include <linux/interrupt.h>
    * T$ I9 \. t# T7 A* n* T1 }$ o  ]5 c( C6 m
  30. #include <asm/io.h>1 X5 L) x5 k" m: ]$ j: _) K
  31. #include <linux/moduleparam.h>
    8 J" L9 z$ N9 |2 z8 Z8 X( l2 f7 B1 ]
  32. #include <linux/sysctl.h>
    ! g* y0 p4 B( Y1 d. b
  33. #include <linux/mm.h>
    1 J  x& s/ h, t, z
  34. #include <linux/dma-mapping.h>
    , l6 q% ]) Y1 Q3 P; ^
  35. . _! I* j7 |' q) _7 R  h
  36. #include <mach/memory.h>3 k6 x  F" i6 M
  37. #include <mach/hardware.h>/ _7 `2 A& c( j
  38. #include <mach/irqs.h>
    ( i9 a0 g: e, _/ ]. C$ r6 _  T
  39. #include <asm/hardware/edma.h>
    : {" V$ q# c7 K* {/ _
  40. " M! n3 O! p  S  i& ?
  41. #undef EDMA3_DEBUG
    1 Q% i  C# `: b) f- B
  42. /*#define EDMA3_DEBUG*/
    ' ~( _4 J& n6 W7 W; E
  43. - I' I: G  o, J2 ^$ d9 c
  44. #ifdef EDMA3_DEBUG: I& K: f1 z% `% j# Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + M& E  }; l! W$ e' L2 N% _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 X2 a: O- E. }* v% R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M; e  }4 s" Y  M& ?4 c
  48. #else
    * p$ C+ u2 W6 }+ E( T8 }) i% y- K
  49. #define DMA_PRINTK( x... )
    " M9 I# w2 Y1 s0 r  @0 W
  50. #define DMA_FN_IN- K4 `/ \( @$ T5 t
  51. #define DMA_FN_OUT) T: U- V, t2 e% _' C4 @4 G
  52. #endif$ Y5 T0 H! e; o

  53. 6 R; B( V2 N: `; [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : p* ?$ P6 Y! o3 k/ N  _
  55. #define STATIC_SHIFT                3
    : S8 h9 f2 B/ h0 c' C8 o1 t
  56. #define TCINTEN_SHIFT               20
    1 p7 z5 T' y0 l9 k5 W& u
  57. #define ITCINTEN_SHIFT              218 `. l% z* {. n( C5 \
  58. #define TCCHEN_SHIFT                22
    . |# L0 F) P3 e" O
  59. #define ITCCHEN_SHIFT               23
    3 w4 T  J$ G' l# p; u; w4 k
  60. $ e4 K$ z# y9 c; V, L% ^. k; o4 t( K
  61. static volatile int irqraised1 = 0;* T* ~; m3 R1 F- _4 @0 x0 r( [
  62. static volatile int irqraised2 = 0;
    9 K, o$ V$ ^7 Z. d& A; N) T: {
  63. 8 r4 |0 ]: M9 `1 I, d; s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Q  [4 j8 ]; s( o) f* I% s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + c7 [) U8 I' q2 I4 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O  ^) t% U$ G; z
  67. ( [$ M; C( w* N9 k6 n+ a7 d
  68. dma_addr_t dmaphyssrc1 = 0;5 E/ I/ V) b) M
  69. dma_addr_t dmaphyssrc2 = 0;
    4 x3 l( H* |; d6 f2 X, T" ]
  70. dma_addr_t dmaphysdest1 = 0;
    $ W  |0 |" k5 \4 H+ _2 M
  71. dma_addr_t dmaphysdest2 = 0;- W+ S7 a1 z, y) @- ~
  72. ( U0 c7 e$ p( `6 F5 r
  73. char *dmabufsrc1 = NULL;1 p9 N7 J& J$ f6 W6 m) x! F4 a& c- @
  74. char *dmabufsrc2 = NULL;4 s; H# v5 N  ~* |3 V( E: B) D4 C
  75. char *dmabufdest1 = NULL;% b, W5 \' e; @; b6 c
  76. char *dmabufdest2 = NULL;
    & h( |) a! ~: i  l. E6 T, U. f) x# Y

  77. & Z$ e8 f) |2 q3 A; u" N
  78. static int acnt = 512;
    ! T: o+ b5 i& D8 Y' f9 k* I
  79. static int bcnt = 8;4 Q; d" D" I# t: ?- A
  80. static int ccnt = 8;
      O5 X5 V1 A" o/ m9 {( L0 {

  81. & A7 u2 g8 B. w) p& P/ C6 N; v
  82. module_param(acnt, int, S_IRUGO);2 f% U1 G( C5 {: z% E( k
  83. module_param(bcnt, int, S_IRUGO);$ W7 A! H. F1 g4 _% A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 o' }8 i" P: m% j& k" K1 a6 l
/ [" X' Q) ?$ I1 F  P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F; J. j+ w" w8 t! c9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' Q8 w. ^* W/ E( g7 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ t6 z7 b+ X5 ?* ^
2 o* t/ ~* x( g5 S; V1 w2 ~; J1 V4 R, r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 06:02 , Processed in 0.051301 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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