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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 h5 Q; w4 V# K* i; s" }
  1. [code]EDMA sample test application1 l0 N2 e$ V$ u( @5 m0 O- d# x+ @# Q
  2. /*% \' J# e3 j6 x. S
  3. * edma_test.c
    ! _+ n) d; b3 s  O
  4. *
    : z. n8 Z" C4 p2 I& }
  5. * brief  EDMA3 Test Application
    1 C/ R6 p! `6 U9 W! b7 _
  6. */ p; T' c/ H/ J+ u9 ~( }
  7. *   This file contains EDMA3 Test code., Y2 Y1 s. X# f6 x
  8. *  p; d7 O0 A  S4 |0 _  b  A  v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; m% M0 w8 R! H) D* ?" [8 f, u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 _4 Y- {0 U1 u2 b8 `
  11. *         TO CHANGE.$ D2 K3 Z- m+ b
  12. ** g" \* F. m" {0 Y7 n' t4 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. a* q0 r/ ~0 S4 `3 M0 Y( B6 H
  14. *
    * ]: j5 T: F0 E' Q0 L/ T
  15. * This program is free software; you can redistribute it and/or
    2 s5 t) R( l: c2 z2 a; ?, O1 f
  16. * modify it under the terms of the GNU General Public License as
    3 p4 r) G" C* f: U
  17. * published by the Free Software Foundation version 2.* Q/ c1 c8 ?. T/ O" O
  18. *& T% J- J1 g; z" j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. z! z/ e4 M8 }; {2 v) l2 @% {
  20. * kind, whether express or implied; without even the implied warranty6 ?5 w; ~, h  s- c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 l8 C. @4 W3 b% c  j* t) H5 ?
  22. * GNU General Public License for more details.* W4 F/ W; P( W2 N  O+ b$ r
  23. */
    4 a4 A( P) Z+ c$ c$ x" I
  24. ; n: G' X6 W3 d1 o1 a
  25. #include <linux/module.h>
    5 f- M& x) \1 H
  26. #include <linux/init.h>
    . b1 ]3 g& i9 r$ Z4 O2 Z) L9 U- V
  27. #include <linux/errno.h>
    " [" Z1 R2 t, x& g9 S! G
  28. #include <linux/types.h>
    & p  S- B! Y7 R) v# b, x6 l  N
  29. #include <linux/interrupt.h>+ T; H' }: b. h$ F
  30. #include <asm/io.h>6 i! q4 k- ~+ u% T
  31. #include <linux/moduleparam.h>. U2 T8 {7 R7 i1 O1 x/ \
  32. #include <linux/sysctl.h>& P: j5 P  e" Z" p9 [/ j  K0 h
  33. #include <linux/mm.h>
    * F; c/ W: p# y, k
  34. #include <linux/dma-mapping.h>
    * s( @4 \5 W1 G, U8 S+ `

  35. 7 J- o: m4 O- c  B) l4 s% `
  36. #include <mach/memory.h>, w# _$ \; L" S- t  Y! R
  37. #include <mach/hardware.h>
    $ A( c$ o$ }9 }# Q0 q) F
  38. #include <mach/irqs.h>, s# N6 E  E# o
  39. #include <asm/hardware/edma.h>0 {  s! D# |2 y+ N; \' v- ~6 C. f
  40. ' Z1 J3 M. Z1 d7 M" ^
  41. #undef EDMA3_DEBUG$ Q! {; P1 z4 S9 i6 |* M* [. w
  42. /*#define EDMA3_DEBUG*/- v* Q' O! g% ~3 Y6 O* n& c

  43. 1 }4 b. W8 ~( F9 z* t* S
  44. #ifdef EDMA3_DEBUG
    , u" {0 i' f; t( V$ _! |3 k$ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) @6 G  F) Q( \5 ^# @3 w; w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & R+ p- {" l2 S, C2 R+ G" J8 s8 I  p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) c3 q$ }8 ^  L. L2 C  v' M6 c
  48. #else7 p0 {1 g) e, ]$ Y/ d
  49. #define DMA_PRINTK( x... )
    / W6 I; x. h6 E, Q! h0 k( e- W& ^# O; y
  50. #define DMA_FN_IN
    $ Z* S. y2 G2 J. t) r
  51. #define DMA_FN_OUT3 h( G- f# u$ E! Q$ E
  52. #endif
    ( V  |5 r. ^& }# {( e9 }) L" @, |

  53. 0 o( n  m+ b. `8 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 A! ?) |, A! h) f
  55. #define STATIC_SHIFT                3
    9 O+ o& A- U) W  N; w) M3 ~
  56. #define TCINTEN_SHIFT               208 ?* p% |# ~3 @2 l- Z
  57. #define ITCINTEN_SHIFT              21
    & W# f6 Z  ^0 Y  W' Q& j
  58. #define TCCHEN_SHIFT                22
    ( u3 a0 K" a/ U* i# y
  59. #define ITCCHEN_SHIFT               23, X$ }3 O+ x9 W8 e9 J% T+ c

  60. 7 `, `7 L  }' c* l1 s& b& G
  61. static volatile int irqraised1 = 0;
    - ~0 T, J# M* s& g: y" i) g
  62. static volatile int irqraised2 = 0;6 }$ U8 z- l. j, P
  63. # H' Y$ O0 }# x7 Q2 @6 R! ^5 ~- S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! k, g/ R; P$ i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# r, f4 N5 {0 ]& g/ B; l4 c; B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R' ~- C) |2 o

  67. - Q3 {2 }2 a6 M0 i# O: ~
  68. dma_addr_t dmaphyssrc1 = 0;1 l  N, c6 a& g- w$ K! _7 D
  69. dma_addr_t dmaphyssrc2 = 0;/ ^  a9 i( H$ o
  70. dma_addr_t dmaphysdest1 = 0;( i4 ~% h* e( \' S) t5 ?" i9 Z
  71. dma_addr_t dmaphysdest2 = 0;
      u1 G0 O8 I; E2 b5 x; r0 q/ t

  72. 2 r( Q5 \, J6 Q, s
  73. char *dmabufsrc1 = NULL;
    4 s! t+ P+ L2 T4 l4 J: f) m% B
  74. char *dmabufsrc2 = NULL;
    # }! ^+ x+ \+ L& f- X3 S
  75. char *dmabufdest1 = NULL;
    ! O" I  u3 D3 r0 E* a9 z0 ?& y- t/ |" |
  76. char *dmabufdest2 = NULL;4 z, v+ ^3 o' ~. m' Q, W* ]5 Y
  77. - @) K3 w) b& L5 _# t
  78. static int acnt = 512;
    & X8 j1 m  G! q- J3 J1 e
  79. static int bcnt = 8;+ z8 t* T, l6 |. |
  80. static int ccnt = 8;% ~! U& @" k7 Y5 f% O0 S

  81. % i- U2 ?4 q! t8 @' b
  82. module_param(acnt, int, S_IRUGO);
    : e3 y' T$ D. x% @9 E
  83. module_param(bcnt, int, S_IRUGO);1 p( a0 e0 h# i2 p1 X! T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, o) R- q+ j/ w8 b5 ^5 J* R# \/ x' q. \; o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; g% j& {1 P( u% I6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! W7 J& o( T$ |0 m0 G' N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T/ m- x! J- I' Q4 M, S! W
& k& [6 ^9 B. P* e9 H+ C* w
9 a  r8 L3 k* w& |4 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 11:41 , Processed in 0.042184 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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