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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; }. F$ g# U" C5 n
  1. [code]EDMA sample test application8 P7 u& n( p7 O6 Q
  2. /*) d7 A% |) l8 H2 S
  3. * edma_test.c
    1 R' v9 Q* ?8 M" X- G" D$ o
  4. *3 I# Q  i* L$ w: o; D  T
  5. * brief  EDMA3 Test Application
    * f8 Y2 p# O8 I
  6. *: N1 d0 d3 A& `8 B% k
  7. *   This file contains EDMA3 Test code.$ Q1 T% a0 C, M2 `8 [5 T2 v
  8. ** q, W' F4 ?* S" A0 g- B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  {9 w! r4 {7 f8 k4 V4 C8 A5 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 e7 _3 [: Q! k- _/ P
  11. *         TO CHANGE.
      u7 \* H- p. O" U
  12. *% ^. N7 a" \* g9 b4 f: l0 P8 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Z4 x3 o, V6 ^5 O+ ?
  14. *
    0 K3 [- n& {, E# b4 X, K
  15. * This program is free software; you can redistribute it and/or
    $ m5 E3 \1 a( [& I$ l
  16. * modify it under the terms of the GNU General Public License as3 W, v3 t  s; X, j0 b% K
  17. * published by the Free Software Foundation version 2.6 W. x0 q, Q; g
  18. *0 q. _. C% u5 e  ]5 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + t( U  H; d! L& J
  20. * kind, whether express or implied; without even the implied warranty
    - k8 R+ a1 X- @, q$ ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # Z5 r% ]/ \4 f! f' J& S
  22. * GNU General Public License for more details./ C! D7 L& r0 X: U6 H) U" ^
  23. */1 l+ h1 m: H$ J
  24. # M. s/ x" {) W1 k& j4 O
  25. #include <linux/module.h>
    ( K$ _/ N+ h: [1 G
  26. #include <linux/init.h>
    - m! O4 p0 m3 e- k! \
  27. #include <linux/errno.h>5 E# W6 J  |+ j. e9 i3 {
  28. #include <linux/types.h>
    / v) q2 g8 x+ b9 R! B
  29. #include <linux/interrupt.h>
    + h# Q8 t  E0 B/ R5 E* b
  30. #include <asm/io.h># X9 d7 b' D4 `, [5 a
  31. #include <linux/moduleparam.h>/ u- d% Z$ V& t8 a' i6 Z
  32. #include <linux/sysctl.h>
    # i. T: f5 F5 g
  33. #include <linux/mm.h>5 y7 k- Q% ^. C7 d) \) Q
  34. #include <linux/dma-mapping.h>4 E0 q. Z2 o! W# ~  p& b7 @+ d, D
  35. # X# F" k; ^5 B! E$ B1 j; }
  36. #include <mach/memory.h>
    6 c1 t. B5 H2 f3 R9 u" n
  37. #include <mach/hardware.h>
    ; A( O, p$ V+ P4 Z
  38. #include <mach/irqs.h>
    " E' w  y9 N: C5 W) O4 z) M6 |% I
  39. #include <asm/hardware/edma.h>; e& t' o8 c+ V) j! {3 E

  40. 6 A, m; A5 Q" d8 @# J1 E
  41. #undef EDMA3_DEBUG
      x& [  t( }! P/ u( ?
  42. /*#define EDMA3_DEBUG*/7 s. {. o- }, H4 Y4 s( W0 `

  43. % _& X: {1 a- U) B* I6 K
  44. #ifdef EDMA3_DEBUG. p$ B! }( d% N6 y3 q  Z# l( ?$ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 p7 T; t5 }; G" l7 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 }3 o; j  ~4 i9 V% l+ n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ~" y4 v# J9 |; z5 z* ~8 A
  48. #else
    $ n- f* J" g& \3 I
  49. #define DMA_PRINTK( x... )/ Y% v0 _( k/ t( @3 d1 q# q
  50. #define DMA_FN_IN6 l) @. F  h; O7 [6 U0 d
  51. #define DMA_FN_OUT
    3 _% m) Z8 k+ X$ i
  52. #endif
      j0 ]# C6 ]' n/ l9 y, X$ q  |( [
  53. * v, E. a6 @) H( s# r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 v. \9 H. z* t8 f- {
  55. #define STATIC_SHIFT                3
    " h* X# b1 i1 G  w  Z
  56. #define TCINTEN_SHIFT               20
    & j% @$ m- J, c( P% y# R! g
  57. #define ITCINTEN_SHIFT              21, P% K7 q$ z# N
  58. #define TCCHEN_SHIFT                22
    ! b1 p3 |9 a- ^6 A# |# G
  59. #define ITCCHEN_SHIFT               23: B0 |0 ]: y- a9 q8 {( E9 W

  60. 3 ^: w2 q( X+ j6 O( L0 G9 p
  61. static volatile int irqraised1 = 0;% _" V* A3 C- U* y% S
  62. static volatile int irqraised2 = 0;
    + _* R9 g5 E/ r5 V0 f' {; g

  63.   Q4 I( w, }3 B* q- h3 p, s( |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 N2 s: @  U# w# S4 z) X. B/ E1 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N6 s, T8 E+ c3 c  g( D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P' c, e% G- V+ A8 P$ _
  67. # j/ ]0 X) s+ u' X
  68. dma_addr_t dmaphyssrc1 = 0;
    + ?' t/ W( x  G6 e& r* Q
  69. dma_addr_t dmaphyssrc2 = 0;
    6 C5 g/ E: V& H; Y
  70. dma_addr_t dmaphysdest1 = 0;* X2 H1 g; @- @0 h
  71. dma_addr_t dmaphysdest2 = 0;. S, F) H. M6 S2 U3 p4 v

  72. 6 i8 i& `% A+ |1 R2 {2 A$ M8 d
  73. char *dmabufsrc1 = NULL;3 V+ L/ U) q3 ^
  74. char *dmabufsrc2 = NULL;
    ; Y  z3 K3 p* [0 F) R- D
  75. char *dmabufdest1 = NULL;4 q  a, d3 y) }9 \, v4 ~
  76. char *dmabufdest2 = NULL;# w; h7 k; d. G5 r) u  S8 b
  77. , j" O7 h6 v9 [' \. k" z
  78. static int acnt = 512;
    ! \* s8 H' }0 x
  79. static int bcnt = 8;
    2 o* S; S! V  T! B; q* W4 |) N. R9 a
  80. static int ccnt = 8;2 r# C& @% k2 c( c, q
  81. + T6 [2 {% R2 u( X. J2 @. r' K
  82. module_param(acnt, int, S_IRUGO);7 `2 P0 w) i/ L
  83. module_param(bcnt, int, S_IRUGO);+ W! ]0 i" u" \  C( G, l# d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 h6 A& H# U6 ]0 C: v+ n0 c1 S; J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 Q# X" y: n2 W- `# s
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 v, O/ X& p6 ?  P# m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) t% s2 W9 m4 v7 E
( i9 V& @! e$ e

4 g+ t1 c! v/ M, q+ V! ]9 }; U- u) ]- D5 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 14:39 , Processed in 0.042211 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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