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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 o$ R. v# w+ b4 k" R, v
  1. [code]EDMA sample test application
    ! A0 q3 P$ x- K& c8 F% F
  2. /*
    * ~; [; [9 J: s6 z% R, |# T
  3. * edma_test.c* r( @' Y: Q& q& K$ w; h* [) i
  4. *
    & W. O  o/ E4 u* I6 I, }
  5. * brief  EDMA3 Test Application- f  o5 ~' z* f7 M
  6. *
    ! c" f% h; F8 [% N' \. L. G9 b$ j
  7. *   This file contains EDMA3 Test code.
    / W  e. {6 h0 `8 d
  8. *
    + i/ ?4 l0 l+ \# P: A' G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 K( {; W: U3 E3 Q& j' X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( z5 p" N' r0 }0 H+ S7 c2 j- E. R5 o
  11. *         TO CHANGE.
    . e; j: _1 N* g9 B. r' v" ^
  12. *
    ' A# e2 d) ?+ X' }! @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' W. |! I3 a4 F' X  p
  14. *
    " _1 t* S  [: A, s8 ^1 B
  15. * This program is free software; you can redistribute it and/or0 Y: I# N# {7 _6 e
  16. * modify it under the terms of the GNU General Public License as
    6 e" v/ ~0 t- v' t% z
  17. * published by the Free Software Foundation version 2.7 G! B- f" I9 w5 B9 k
  18. *$ v0 ?$ P0 I; _1 `+ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " p9 L: P$ n# \
  20. * kind, whether express or implied; without even the implied warranty
    & J: A. f" c% h5 Z) w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; E# }. x$ Z' f) T8 n8 v4 a
  22. * GNU General Public License for more details.
    5 i% n. r! v% o5 y
  23. */4 q2 m+ z$ H& _! _4 Y& C1 {
  24. / O, c3 S* R: k% g" _! K3 i
  25. #include <linux/module.h>/ h4 p, t3 y/ W3 u
  26. #include <linux/init.h>! u, |1 Q% u7 k8 K0 Q8 q5 \
  27. #include <linux/errno.h>  A( A5 d0 _& {# `) F" _
  28. #include <linux/types.h>
    6 z* x5 F' ?, Z. |0 g) F" q
  29. #include <linux/interrupt.h>
    5 \4 ~  E2 V: W/ A5 F$ i
  30. #include <asm/io.h>
    8 }6 U8 Q7 y$ w3 j7 v: F
  31. #include <linux/moduleparam.h>1 c( P& w* x  U  @% F9 ]8 E5 \/ k+ Z
  32. #include <linux/sysctl.h>- D, Y( ?& {) L& `2 H
  33. #include <linux/mm.h>
    5 |! m  }! G' g
  34. #include <linux/dma-mapping.h>
    3 M1 U2 j% z2 u/ Y5 n  ?0 [

  35. % @2 ]1 W( r9 a' B8 x" W& d
  36. #include <mach/memory.h>" N0 T0 @5 K7 n& p  f
  37. #include <mach/hardware.h>6 F; x! z* f) T  X' S7 H) p( F9 u
  38. #include <mach/irqs.h>
    1 O$ O6 n9 I& {7 E4 c+ k- Y
  39. #include <asm/hardware/edma.h>
    1 [/ K* Q& K8 ?2 M. v6 l
  40. 6 U7 e" q! X4 Y1 p
  41. #undef EDMA3_DEBUG
      ]  G& s  z$ g- d8 X2 X' B
  42. /*#define EDMA3_DEBUG*/" X0 _5 p) t) V1 C' _0 t/ o+ _6 b

  43. ( y+ Z; b! C* S- i3 R0 ?4 Z$ j! n
  44. #ifdef EDMA3_DEBUG
    * x6 b' D) w7 A3 Y/ W2 {) W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , r5 s/ v$ K5 c9 P0 N% l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& J5 L+ E* ]: K1 w# G6 n6 [" ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 x: I3 s& y8 X) Q8 \
  48. #else
    / B3 ~& D0 T1 X2 v: H
  49. #define DMA_PRINTK( x... )
    . V$ a# o6 E& k8 G7 O$ T$ x9 R" a5 W
  50. #define DMA_FN_IN* G, F$ ~% U& Y0 D% w- p9 j1 K
  51. #define DMA_FN_OUT
    6 L8 B% f( w; T! `4 b+ M5 g
  52. #endif) l8 f0 m1 U0 `3 A! f' Z
  53. * k; {* |* n  J$ S5 Q4 z( x0 L( y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 c& b& V1 l! |
  55. #define STATIC_SHIFT                3! h, Q3 G% f9 j. ^9 m* i+ z
  56. #define TCINTEN_SHIFT               20/ K; b( B% y& L: m9 i6 ]
  57. #define ITCINTEN_SHIFT              21- D' n8 M5 t9 ]7 ]& v/ `% V
  58. #define TCCHEN_SHIFT                22+ @" @7 }$ y! F
  59. #define ITCCHEN_SHIFT               23
    ' V$ C, m- F% F; o7 k
  60. ( @" T* {4 T2 ~5 q  d
  61. static volatile int irqraised1 = 0;
    5 B7 ^! P7 R/ f! U5 \
  62. static volatile int irqraised2 = 0;
    * W' @% V! n# d( y9 c% b& c

  63. 5 _" b) ?" y6 i% s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 N0 [, y% i- V3 p, t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Z! k3 J3 ?+ `" d+ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 r# T! n6 N5 ~7 a7 H

  67. 3 M% i7 O( v: O+ w4 s) j" R: r
  68. dma_addr_t dmaphyssrc1 = 0;* x! I  h) J4 C) u6 }
  69. dma_addr_t dmaphyssrc2 = 0;) k* L( N1 v) u) g- V+ y5 Y
  70. dma_addr_t dmaphysdest1 = 0;, w1 i1 o) D* x: k, m( q8 V. k, [
  71. dma_addr_t dmaphysdest2 = 0;
    # t8 g6 z2 f# B+ m  H$ q

  72. % @5 q: ~" b* F1 C
  73. char *dmabufsrc1 = NULL;
    ' {+ |$ G3 p8 o, R% H" R, @  b
  74. char *dmabufsrc2 = NULL;
    . W0 X3 |' r1 z/ q1 T2 l. F+ H
  75. char *dmabufdest1 = NULL;
    : l) ~* C8 S* f5 `3 b$ J3 j
  76. char *dmabufdest2 = NULL;( ?1 d( j: j6 U3 G3 I

  77. 8 `1 e' u- F/ o3 ?6 v( l
  78. static int acnt = 512;1 A# q2 e: W1 }
  79. static int bcnt = 8;
    5 c  o# W9 G6 O6 X) H0 i' }
  80. static int ccnt = 8;% C2 N) \" x- [5 |. {& P: Q
  81. 6 ~, h% d! y. X
  82. module_param(acnt, int, S_IRUGO);; ?) d3 V7 x# @5 d3 C: P6 i5 ^
  83. module_param(bcnt, int, S_IRUGO);6 C2 G9 x7 r1 s' {8 Y9 g* D, @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 e% i% f4 Z% O+ L9 }4 {: B6 U; ]7 k' U4 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ Q- Z/ L' D* w1 ?( K
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# C' P2 n! ^2 U! x; d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 s9 ]) T0 q/ E# K# ^0 s4 ^$ L
7 M& O: j9 Z6 H) S7 Z
( K- _) C* a" m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 02:35 , Processed in 0.063682 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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