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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & {4 i# C% g& O8 i9 E& l
  1. [code]EDMA sample test application. K$ ?4 t% Q  `, w
  2. /** z; k( Q+ F4 P+ B' T" I$ K
  3. * edma_test.c: d; h/ t! ^+ R* G8 k
  4. *2 v( f% B/ r; D( q# ?
  5. * brief  EDMA3 Test Application( h% h% ?7 z* T7 N
  6. *- E. i! Y/ t, `7 T1 n) ^
  7. *   This file contains EDMA3 Test code.- z  J  {8 L; N* w
  8. *
    5 `3 a5 Q+ v, X) Z; n( E# W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . t# R. o* F, ]5 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ~- p, R* [* t
  11. *         TO CHANGE.3 r7 o* M  {1 ~' U
  12. *
    7 |: S: t0 }8 t( e( W! @' {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 ~' }8 o! c& C: [: [6 s
  14. */ z4 Q9 v7 }7 \( ~/ Q& Y8 h& k
  15. * This program is free software; you can redistribute it and/or. y/ d# }. d: p5 \/ U
  16. * modify it under the terms of the GNU General Public License as
    2 {% c: {+ ~( W5 j( x
  17. * published by the Free Software Foundation version 2.7 f+ t# Q; F4 |8 [- D. C
  18. *$ _1 S( a: v/ x$ L( ^* h3 y4 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ |$ i0 d$ V5 Q+ v" ]0 S  ?" s
  20. * kind, whether express or implied; without even the implied warranty) ]( B5 w$ s$ [/ Y8 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / a8 P4 R$ a( {7 ^) _. }+ Y' F
  22. * GNU General Public License for more details.5 G; a0 v% Q2 \: k' Z. k, [
  23. *// w) A( y& I1 v0 A- u: L3 K
  24. 8 Y2 c7 W2 V: \* Z# s
  25. #include <linux/module.h>
    ! S5 K7 d6 M1 u
  26. #include <linux/init.h>/ y- ]: ]4 J8 j  A: D0 E# Q7 M; w
  27. #include <linux/errno.h>
    8 O" C! a. }. L( b3 M2 L' T: d
  28. #include <linux/types.h>. s" p$ @+ F$ a, C
  29. #include <linux/interrupt.h>0 G+ I; T+ [2 c* v' F! M  q
  30. #include <asm/io.h>
    & t- m& t% l& F+ }
  31. #include <linux/moduleparam.h>
    + [* ?: m6 Y" E2 B- S; G9 i) g
  32. #include <linux/sysctl.h>
      R( K7 L' ^9 s- R2 w
  33. #include <linux/mm.h>
    . M) x8 T4 ^' W6 X- B
  34. #include <linux/dma-mapping.h>  J+ L+ t' V/ T4 L

  35. 4 u/ ^( y; `9 j
  36. #include <mach/memory.h>
    7 I& F; u5 p; J4 C' Z' t
  37. #include <mach/hardware.h>. j/ u; b6 w! P
  38. #include <mach/irqs.h>
    & q, G* r( I9 b1 P  x3 V
  39. #include <asm/hardware/edma.h>: h" y7 S8 Z3 @5 w" _4 X$ _
  40. . P. _: G" o; w6 y; R+ b* ]4 A
  41. #undef EDMA3_DEBUG
    9 l7 G7 y# l2 M3 t% `# `0 @- B
  42. /*#define EDMA3_DEBUG*/
    1 e4 G" Y0 o" B6 K( z6 [6 K9 n: n4 I
  43. * b" T0 d. p/ E; }8 g: V
  44. #ifdef EDMA3_DEBUG
    * i5 W6 A4 h# ^9 T  v5 Q- M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; i/ R% d% k6 S6 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! K" ]. B0 h- C/ m; }% q5 F8 d; L4 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 ?( Y) j& }( q9 J
  48. #else$ ]4 m+ D$ c1 A6 c0 q
  49. #define DMA_PRINTK( x... )0 o! E1 l; M& \( ]5 G
  50. #define DMA_FN_IN
    0 j1 m; N2 l3 S3 A( d
  51. #define DMA_FN_OUT) a8 X5 j/ W% S
  52. #endif
    / w+ B, H4 z' V1 U  f7 k9 _. l1 y

  53. 2 L/ ^4 U+ p$ M" `0 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 z0 `4 |4 D4 Q5 y
  55. #define STATIC_SHIFT                3# @5 q' f# r0 A$ Q
  56. #define TCINTEN_SHIFT               20
    1 a1 b$ ?$ U& t: y* T  d$ O" w
  57. #define ITCINTEN_SHIFT              21# n- s9 g5 v* _# i7 f
  58. #define TCCHEN_SHIFT                229 F) |+ A% ?% \( o, x
  59. #define ITCCHEN_SHIFT               237 e' @1 j0 ]1 C7 }( L4 R& R
  60. - e7 k, J. z& ?* Z, T; U5 _9 ?
  61. static volatile int irqraised1 = 0;; V' [) l: P4 ~' U3 U: a$ |) d$ D
  62. static volatile int irqraised2 = 0;- f; _! w3 j8 [8 V+ \" V
  63. 5 R/ W/ D6 N3 r9 P3 q9 t) O  X2 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 t& G2 |  w) _( ?' Z$ n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 t. }2 n9 f0 W6 \2 a7 y8 O1 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Q) R" Z3 h3 l  T( ^
  67. ) }  m: i. _9 N% Q2 o; U% @
  68. dma_addr_t dmaphyssrc1 = 0;
    ' r6 F4 E# L( |  R! |/ n. K0 a( f2 z
  69. dma_addr_t dmaphyssrc2 = 0;
    4 y- B5 c, R' Y/ Q& D7 `
  70. dma_addr_t dmaphysdest1 = 0;
    5 \8 Q9 C1 _. \. v0 G# B5 N1 R
  71. dma_addr_t dmaphysdest2 = 0;
    ! E2 q! R" R9 v; O- f: T1 M' v

  72. . z7 @: J, z7 O$ ~9 I
  73. char *dmabufsrc1 = NULL;; y: l8 Q4 n2 s. ^6 k% W
  74. char *dmabufsrc2 = NULL;
    4 w( I9 ?+ |6 i
  75. char *dmabufdest1 = NULL;
    * c0 B2 ^6 p. P2 s
  76. char *dmabufdest2 = NULL;) k7 Y% m# [% H

  77. . M. V$ ^. U- ?3 L. ]3 ]# B
  78. static int acnt = 512;
    ) ^+ J+ ]' x2 D, W+ h" j
  79. static int bcnt = 8;# n# I( W1 t9 `0 x  Y
  80. static int ccnt = 8;
    " _' ?3 B3 N& j  f* H% y

  81. ) T- k! @( u$ t' N" f2 l3 u- R
  82. module_param(acnt, int, S_IRUGO);
    ) D0 U3 R) {9 v- _* E* P
  83. module_param(bcnt, int, S_IRUGO);" Q0 V6 L+ L1 d$ U' G1 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% H8 M, M, n( _. @% W6 r
% Z- b  E# O: ]% `% J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; R, e; K- j' i7 e+ S5 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; p! ~6 d/ I1 Q7 k2 |$ W, ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* t' I* T6 ~- \6 _3 _' i( a# s4 L
3 v" q" F  P! v. p5 p, l$ u

  h3 `8 W5 P( V, e1 r  P6 j+ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 05:06 , Processed in 0.040324 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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