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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" D1 n  H) F; r6 O
  1. [code]EDMA sample test application1 i- j& f1 y9 n( O$ L
  2. /*: ?( `' r% [4 c
  3. * edma_test.c
    * R/ |2 H* N9 c' F9 w9 l
  4. *
      h; P  I2 Y! M4 n
  5. * brief  EDMA3 Test Application
    / b. e4 q, c' B- h% s
  6. *, @& y+ ~  F) r% h; f" V
  7. *   This file contains EDMA3 Test code.+ t5 x, [# M; i- L& P* N
  8. *& n; c$ V( F2 S# S. k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 f) t$ J# ]' \; B: L2 w6 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& x8 F! a! [/ B
  11. *         TO CHANGE.# [& _  w9 M* j
  12. *
    + c# Q# z% D8 m* `- v9 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# j. ]8 R7 j! J- a
  14. *
    / |9 R" e! n" b/ e
  15. * This program is free software; you can redistribute it and/or
    6 q+ l3 _( Q' M6 ]# L0 h$ W
  16. * modify it under the terms of the GNU General Public License as4 t# l) t: O/ U$ L8 m4 Q% |) K
  17. * published by the Free Software Foundation version 2.4 C% ]& f% m7 T
  18. *
    , a7 d/ c, ]% ?+ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 p* |( T: e. `' R$ m" S! G
  20. * kind, whether express or implied; without even the implied warranty
    0 z5 _) Q, H' E6 E) Q/ b3 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & D4 P& |1 H0 t0 A- O! S! b* N
  22. * GNU General Public License for more details.
    # L& l) }, I) z* s' d9 y5 s
  23. */: ^7 F3 k4 X, e( j$ z

  24. 1 z1 r/ G, a3 K
  25. #include <linux/module.h>2 T) z3 Y% c' G! ]: E2 p7 }
  26. #include <linux/init.h>- i  r* j' s) v4 N  |
  27. #include <linux/errno.h>
    + Y. P0 E$ u# z
  28. #include <linux/types.h>- I, E/ o, a, }- r2 ~1 p
  29. #include <linux/interrupt.h>
    ( i: L* V, Z3 _( U
  30. #include <asm/io.h># f9 M: A7 \* g6 P6 m  `+ v  |9 M0 k
  31. #include <linux/moduleparam.h>
    ' v0 S& [3 u/ y3 }- I9 S6 v
  32. #include <linux/sysctl.h>6 |3 t1 }7 L7 x# X
  33. #include <linux/mm.h>
    + z% A4 k! B$ m1 @$ L
  34. #include <linux/dma-mapping.h>% X! ?* _: _/ x7 D! H

  35. , N: {1 u$ h" |* s
  36. #include <mach/memory.h>
    # g) t8 f/ P  t. W5 E0 \
  37. #include <mach/hardware.h>9 @  ?  Q, k) V3 U! G
  38. #include <mach/irqs.h>
    ) @0 D6 O% U% J2 y
  39. #include <asm/hardware/edma.h># E  d# z. v8 ^- Y5 j4 j) J

  40. 0 @. n# M0 d( H; {
  41. #undef EDMA3_DEBUG1 r1 l( ~: @- m2 X; w
  42. /*#define EDMA3_DEBUG*/  E) U$ l- c* V2 I2 R; X

  43. 9 r$ y! G6 _# l$ w
  44. #ifdef EDMA3_DEBUG/ ^+ a* T% b5 g7 v% e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' x9 t- T& B" N' s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , s8 b' e. K5 V- A. I- d! j# o: C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 C9 G$ O5 r! |8 g7 ]: i
  48. #else! m0 v0 V$ \& X4 A* y$ P( K
  49. #define DMA_PRINTK( x... )
    " H/ r& D- c" ]) ?6 T+ _9 {
  50. #define DMA_FN_IN
    3 }1 I! B) i/ S9 v
  51. #define DMA_FN_OUT
    6 d! O; ]/ F" \% Z( T
  52. #endif
    6 F9 z, b7 l' H/ k6 e' Q7 M! @( x; B- g3 V
  53. 8 {1 B$ C- F+ L! m9 X1 @5 b/ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' Y  t5 V  l7 q
  55. #define STATIC_SHIFT                3
    ' h! h0 e( \6 r" N' x2 H+ D
  56. #define TCINTEN_SHIFT               20
    ; ~7 ?) }# n9 {- O
  57. #define ITCINTEN_SHIFT              210 ~' q* }$ |* G
  58. #define TCCHEN_SHIFT                22
    , s. C1 P- F% I: u
  59. #define ITCCHEN_SHIFT               23
    6 _: w7 @1 P+ L

  60. ( T% V3 R7 y* n9 d
  61. static volatile int irqraised1 = 0;3 U4 @/ j3 h  o2 [
  62. static volatile int irqraised2 = 0;+ V! q1 P9 ]* g; F5 M! M' ~/ W
  63.   a7 L' n3 D$ t5 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( q! R6 m2 b( w4 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 m1 M3 w* S, u0 _2 Q& H% _7 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 n) \+ u3 J+ N" U
  67. & w# p5 q  H& C3 C  P; l
  68. dma_addr_t dmaphyssrc1 = 0;/ i" @, {1 t  `3 L. ?% l% c
  69. dma_addr_t dmaphyssrc2 = 0;; {8 Z0 q6 p! q, D( s! e
  70. dma_addr_t dmaphysdest1 = 0;
    % t! r1 N, v. {4 v' Z( C8 x
  71. dma_addr_t dmaphysdest2 = 0;
    8 v) I5 P- r' X7 }2 H

  72. " ]6 H% g6 @! `8 l8 j3 Z
  73. char *dmabufsrc1 = NULL;8 U' V3 H2 e9 {% p4 K
  74. char *dmabufsrc2 = NULL;  N7 E, U, I3 e' V, ?1 e8 a
  75. char *dmabufdest1 = NULL;
    # f+ S  h9 k- `7 s8 p
  76. char *dmabufdest2 = NULL;
    8 T; R- j9 }, n& e4 n  m9 y3 m
  77. / J1 o) H) p  g0 @( j" {
  78. static int acnt = 512;- l  K, Z' X  \6 P) c
  79. static int bcnt = 8;; x, ?% K# l( }
  80. static int ccnt = 8;
    : W# V3 M' ^" y; e( ?: R' v$ \% ~

  81. 1 D0 s6 Z- Y2 W
  82. module_param(acnt, int, S_IRUGO);
    ) \7 k# L4 C( M$ ]
  83. module_param(bcnt, int, S_IRUGO);
    . M7 U: c5 X+ k$ c$ |  p+ D% R: |7 Q$ @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 ?+ T! M/ u6 o7 D5 H- k6 D7 Z* a5 Z! b% c" E% d6 |6 m4 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ?: x' `2 E3 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 C- [$ a9 a! d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 N' t9 P- W* l- w$ k3 x$ X- _2 L9 p/ Q) X' s+ M/ Z& L
& T. d2 H" C! N2 d) W! s# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 07:00 , Processed in 0.045330 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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