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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 G  l/ L5 f8 i) d
  1. [code]EDMA sample test application1 m3 s' \5 G$ y
  2. /*
    8 J) [) \5 R4 |8 p9 R2 V( T: c9 A
  3. * edma_test.c5 m. U; d# O' e* }# y+ ]
  4. */ ?7 d" X  p. n- j$ |$ i
  5. * brief  EDMA3 Test Application
    ) ?  C' y; X, Z- V
  6. *( D+ f5 L3 L9 x# Y
  7. *   This file contains EDMA3 Test code.0 l6 {0 g% N. R# _6 u
  8. *
    9 O9 D. v) ^) ]- I9 |. W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + B" [& Q7 R6 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 N( y8 Z+ s7 J! t3 x$ u) J
  11. *         TO CHANGE.
    $ X  {' v3 Z  h. l1 C
  12. *6 v) t5 t1 d! D1 d+ `7 ]% e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 F! E1 E; b5 b8 p% u2 C) L
  14. *
    ! B; L5 c) c# n9 Y$ C9 U
  15. * This program is free software; you can redistribute it and/or9 P  D5 J5 H: Z3 \7 p' K  t8 |4 k
  16. * modify it under the terms of the GNU General Public License as- Y4 E1 v, a( }& L! G  D% R
  17. * published by the Free Software Foundation version 2.2 ^5 P: I5 H! I9 \, ~. ^
  18. *
    * Y* W4 F8 D% ?+ ^- ^- c7 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % s1 @4 a5 G; ^* G2 [& g
  20. * kind, whether express or implied; without even the implied warranty6 B6 w7 W# k# {& g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 u6 l1 V3 F8 P: ]; v
  22. * GNU General Public License for more details.
    ) [- X" _- f% Z4 {; l) f
  23. */
    / |6 y& Q! T$ L+ R$ L' x6 k9 U
  24. 6 A3 D2 g" ^6 s+ {+ g1 C
  25. #include <linux/module.h>$ W- N1 y& r5 ~2 U7 ~6 R$ z# v6 z' T
  26. #include <linux/init.h>4 V- q6 S; \2 ^) o3 D
  27. #include <linux/errno.h>
    + Y% L3 M: c0 [, \
  28. #include <linux/types.h>
    / R: N! @: p9 E" E1 h" g! @
  29. #include <linux/interrupt.h>$ p6 W- \- l; M  y9 t( L- z! f) m
  30. #include <asm/io.h>/ G/ @- g2 i1 c) L
  31. #include <linux/moduleparam.h>' v7 R  z8 h  W5 ^: l# ~
  32. #include <linux/sysctl.h>( s) A+ \1 }% V4 u( x
  33. #include <linux/mm.h>
    1 u* r% j  A# u' i0 q6 Q+ @/ W
  34. #include <linux/dma-mapping.h>' a/ O/ \+ r1 [7 s6 K* u3 a
  35. / R3 C( H# ]9 Y8 r6 G
  36. #include <mach/memory.h>
    + ~6 H; x0 r, g5 d8 b: f" z
  37. #include <mach/hardware.h>
    & S) _1 s* a' @+ P7 I9 b/ X0 V0 K- r
  38. #include <mach/irqs.h>
      e9 m+ [# Q% F( Q( G
  39. #include <asm/hardware/edma.h>8 n. n) b/ O% H

  40. 1 C0 h3 i' N9 Z9 V
  41. #undef EDMA3_DEBUG5 G# a& g" e* [0 w# @( \, w
  42. /*#define EDMA3_DEBUG*/
    ' c( u$ C" a6 g8 h2 W! `3 @( ~
  43. " w6 {% T+ H/ n* o1 \0 Q
  44. #ifdef EDMA3_DEBUG/ w; Y0 c( ~  @0 G: k# [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 F/ C% o5 t# g8 G/ J- w- N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! t# p, |8 R3 ~# V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 @1 ]. U4 }  H  G( n4 S
  48. #else
    ( V5 m0 C+ b3 B
  49. #define DMA_PRINTK( x... )) n8 j8 c! W' ]( q, g) y! {
  50. #define DMA_FN_IN
    ! ?+ V) G2 ]6 a$ }
  51. #define DMA_FN_OUT
    - l* s8 z/ ]9 r
  52. #endif
    , l) ?0 R+ `9 Z: D; ]

  53. . a1 X$ W, h7 o  G1 U! J8 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 w  t7 C+ Q4 F5 T/ o4 s
  55. #define STATIC_SHIFT                3
    5 R& ]+ D  f* |
  56. #define TCINTEN_SHIFT               20& V, B" y0 N8 ]8 X" H8 C5 d
  57. #define ITCINTEN_SHIFT              21
    4 I5 s/ E& K& B
  58. #define TCCHEN_SHIFT                223 D* }  x1 [4 j0 @4 J' F
  59. #define ITCCHEN_SHIFT               23$ W; O3 p3 p0 ^8 |" M8 h
  60. ' Z* c/ B; Q8 L5 v5 J( T# K* r
  61. static volatile int irqraised1 = 0;
    * N$ Y% I9 @' a; a
  62. static volatile int irqraised2 = 0;3 S0 Q* j( T' b9 X; q
  63. ' [) {. d! A, w9 N" w+ l. W! w9 V1 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! {1 W: o/ e# z+ z& M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' w9 Z( [2 h3 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 h/ `( m5 b' }1 ?. p) Q: c; n

  67. 3 O. X" M/ ?' K4 W
  68. dma_addr_t dmaphyssrc1 = 0;
    $ H8 g' `% V( @+ R+ E3 ^
  69. dma_addr_t dmaphyssrc2 = 0;6 t+ U6 E8 x0 s) p- z/ m& q& G. K
  70. dma_addr_t dmaphysdest1 = 0;! \! o' Y/ i  a/ V
  71. dma_addr_t dmaphysdest2 = 0;7 R) O& l3 c! c2 U' L

  72. - p# `. J1 \3 X8 q* c8 Z
  73. char *dmabufsrc1 = NULL;
    - e7 ~8 p2 S% `4 I; n
  74. char *dmabufsrc2 = NULL;* h5 z" a8 k& D0 g+ _4 K  p) ?
  75. char *dmabufdest1 = NULL;
    % d' }1 u7 A/ o1 E
  76. char *dmabufdest2 = NULL;/ o/ g! J! b& o* g* C+ k% b. v& a

  77. 0 w; p9 c7 @9 \% K& Y" m
  78. static int acnt = 512;- w) c& T* k6 v; L  m
  79. static int bcnt = 8;2 B8 q) J: ?% @1 a( T- X
  80. static int ccnt = 8;& @* W) B( z9 y% n( K
  81. + z/ z' n* Y8 c5 k# u% D% ]9 y7 k% S
  82. module_param(acnt, int, S_IRUGO);  ?( r8 u1 E* O- H7 F& y$ o
  83. module_param(bcnt, int, S_IRUGO);
    + K$ I& z" V. \8 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 v1 z! o8 L* R  E8 G

" G9 Z8 l, }& k+ u3 ~: m4 J  Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, y  @& S$ W6 @. ^: f4 f0 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, e" D! q: W- ~# a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 @: X' P$ L7 X! U; T' H) D4 l# G  |: A0 e' M2 h+ n0 I5 |1 I3 {3 W

1 u# C  X. F* p* V2 M: T2 z, |! e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 10:18 , Processed in 0.041462 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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