OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 o- R; R3 B' z3 S
  1. [code]EDMA sample test application
    1 Y2 q  v, j  H  ~8 `' M
  2. /*6 d. f% I- c; O! _, d0 v
  3. * edma_test.c* n0 w& }1 f! g+ w  ?7 ^8 Y
  4. *  c- [+ g& o* O" U) z5 u# n  G+ C
  5. * brief  EDMA3 Test Application$ ?2 K$ B# e6 n$ G7 f9 e
  6. *
    8 R3 o2 Z4 Q: r8 u; U' S; k
  7. *   This file contains EDMA3 Test code.
    % b# g3 t3 B( a. _
  8. *
    6 J7 O5 t/ ]5 _' v. V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ {& [( F3 S; P/ F0 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Q  P+ M. P, v. Z" X
  11. *         TO CHANGE.! M6 [6 A" ?/ V% X) n# L
  12. *( i# y- T* ]/ w# ^( a7 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # ]' O( A) B. I! o5 Y" p8 A
  14. *
    % b: J* D+ l) [' F% m0 _
  15. * This program is free software; you can redistribute it and/or
    - y9 s7 H) e$ C% H5 o
  16. * modify it under the terms of the GNU General Public License as
    / @7 c, D8 c& y4 k! \! f
  17. * published by the Free Software Foundation version 2.  Z. E# \! O; v/ P/ s2 r# U0 D0 Y
  18. *
    1 P& z+ K5 f: {1 j0 T' K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * M  R& a% i6 o' o% ?1 C: g
  20. * kind, whether express or implied; without even the implied warranty! l. k, p. ?$ K8 s. z. W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 s* N9 s2 T# g" I% c1 L
  22. * GNU General Public License for more details.
    2 O: N% b+ b1 d& ~; L
  23. */
    % r1 j" a9 O# C- V( j  p/ a( Q$ m$ x
  24. ( u) z, |# w7 B( J& l
  25. #include <linux/module.h>, O$ S: [1 I# R2 M) L
  26. #include <linux/init.h>
    3 D2 l( N, H3 Z# [/ T& w
  27. #include <linux/errno.h>
    3 S- D3 z% W+ c9 y8 p9 R* x
  28. #include <linux/types.h>' ^- U3 j' d# T* R' D' Y
  29. #include <linux/interrupt.h>+ i3 T, _/ V3 q1 {+ ?
  30. #include <asm/io.h>% U5 J" ?: S7 j2 z3 F
  31. #include <linux/moduleparam.h>  e9 Q$ T1 |6 {2 f9 |5 x
  32. #include <linux/sysctl.h>* r  C3 q& g( r$ o; n1 ~/ [4 e
  33. #include <linux/mm.h>' t9 a! i$ P5 i) r/ H0 F
  34. #include <linux/dma-mapping.h>
    0 I5 x$ Z' w7 ^5 r+ a' o* J$ f7 O

  35. + p* K9 T  p# z% }7 r0 _
  36. #include <mach/memory.h>
    ( A( a9 h. {. @8 J# y5 _4 w
  37. #include <mach/hardware.h>) D5 q- u! N2 Q: b/ f% S0 o, R6 v- I
  38. #include <mach/irqs.h>
    * w3 {& W: C. F
  39. #include <asm/hardware/edma.h>
    ; |/ h3 e- K$ ~0 ~  l0 Y. `
  40. 7 B& k( {, s8 Q: R6 Z7 ~+ S
  41. #undef EDMA3_DEBUG
    1 W4 i7 X( v4 k: M: [' X
  42. /*#define EDMA3_DEBUG*/3 h2 j# V5 `+ E& c% O: V' C
  43. 4 B, a7 S6 h  x  n& R
  44. #ifdef EDMA3_DEBUG
      t6 ^. V2 Z. y1 i3 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% o) k( n4 Z, |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ?2 }. L; H8 g9 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# L+ u& q2 p$ p* M, _! K
  48. #else7 P3 G: X/ w7 Q  E& s( s1 C. {
  49. #define DMA_PRINTK( x... )  I5 p" k' O) {  J: D
  50. #define DMA_FN_IN
    3 v, A8 P5 c5 O$ b7 @
  51. #define DMA_FN_OUT
    ; U9 k: u4 S) y0 v6 z" P& \5 Y( k! B
  52. #endif
    % O) N! o6 a" C- s
  53. ' w) d" A& v" n. K5 E3 E' e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * f$ E4 _8 h* }1 U2 e* q  d
  55. #define STATIC_SHIFT                3
    6 U& b* @2 p+ Q: ?% s
  56. #define TCINTEN_SHIFT               20, y2 J8 p$ i, q% W( V5 T  a8 _) j
  57. #define ITCINTEN_SHIFT              215 K- \' ~2 `) i
  58. #define TCCHEN_SHIFT                22
    ' T# t+ ^; {/ R0 j1 s2 M/ Z# e; f
  59. #define ITCCHEN_SHIFT               232 m' ?5 [& L& D( A
  60. 4 [' i( H% [$ O% M
  61. static volatile int irqraised1 = 0;0 E. I! k: l) \
  62. static volatile int irqraised2 = 0;" B/ K, ^0 E' V
  63. * j) T7 O- d& O- p6 o" x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 N" S* V- x; B7 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 u& ]+ q  p: R- H: O; d6 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & k+ [+ w- _! n" M% ?) ]

  67. 1 q) ~6 E: ~6 H  t. s" Z
  68. dma_addr_t dmaphyssrc1 = 0;5 E9 [) t# m* T9 P5 B/ t" @
  69. dma_addr_t dmaphyssrc2 = 0;
    5 o+ T) m1 |( f6 @! m9 c
  70. dma_addr_t dmaphysdest1 = 0;: `. A$ e( M2 J. a
  71. dma_addr_t dmaphysdest2 = 0;# P' O, `/ R6 P: J
  72. ' J, J( k- V$ d
  73. char *dmabufsrc1 = NULL;
    $ W* A# Z7 U/ t( C
  74. char *dmabufsrc2 = NULL;
    7 ]7 `* |7 L0 ]. i. w# }4 z
  75. char *dmabufdest1 = NULL;
    5 Z/ o+ q% `; q  E3 v4 l
  76. char *dmabufdest2 = NULL;
    0 u+ B5 G* q* A1 Z% U4 p8 r+ p
  77. 8 U& h7 @" c& s1 W! y8 l
  78. static int acnt = 512;! N* @/ M( U2 ], {8 J7 D- B* x
  79. static int bcnt = 8;8 p7 i/ ]* s- B9 K, y( u) P! N
  80. static int ccnt = 8;
    % l" F8 g* P0 B, t' M
  81. 5 b5 l8 N9 X: A% f2 }! ^
  82. module_param(acnt, int, S_IRUGO);
    3 s8 z, [( r+ Z
  83. module_param(bcnt, int, S_IRUGO);
    ! f* f4 H6 v! J1 J# V8 v3 _! [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ Y) V4 J& P  B
, j  L2 A2 `  R2 S4 r2 s9 s" H7 F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# @9 O, e* Y" a1 U$ i# w2 X. o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; q4 r4 H" }/ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Z5 M9 c& ]7 d& }8 ?
# e/ K' `4 R' M

6 K+ X5 K3 Q& R& A, e2 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 04:16 , Processed in 0.038476 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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