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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! J2 R$ c" z& {. U8 ~8 S! G" d
  1. [code]EDMA sample test application
    ( }, F$ P/ y& w% {) A. Z
  2. /*. P0 v, i0 v1 @
  3. * edma_test.c# }) Q/ ?7 ^9 J) T8 P! K
  4. *
      }' n  n3 l' l% E
  5. * brief  EDMA3 Test Application( J4 m9 s- I0 ~) {5 \# v& m
  6. *
    % R, \5 n! e& O4 J* p+ z
  7. *   This file contains EDMA3 Test code.: u( ?6 l8 }3 U2 ~, ]! X
  8. *& J: K8 |( @% `* }3 K! a6 Y0 ^7 Q3 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 T# t. T6 c$ m8 P; r% `2 e# ]1 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ i* f. W% f& a" z6 w7 P! Y
  11. *         TO CHANGE.
    2 n( |8 S( g% q: f3 C* e
  12. *# y) r9 ~" _; R, Z2 \/ o! N) D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / i. J8 [" W3 J# L! |- O$ n
  14. *7 \3 y% x) `2 {; h% b, [$ n) A
  15. * This program is free software; you can redistribute it and/or0 ~/ ~1 K7 a3 l6 a9 Z
  16. * modify it under the terms of the GNU General Public License as
    ! K; C. A. j8 e- k2 F
  17. * published by the Free Software Foundation version 2.
    2 ^7 s- E) o) H' z' H4 C% F: O6 ?
  18. *& h! Y/ q4 v5 s! N( P- s+ a: o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , ?# c0 {7 [. u6 u6 b$ C) m
  20. * kind, whether express or implied; without even the implied warranty; j  q6 t5 h$ }5 M( v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . [: j4 ?2 a, e7 ~
  22. * GNU General Public License for more details.
    # X5 l; [* T7 r
  23. */' U+ B6 l! p, Q9 H5 B, A: P) n0 N
  24. # K5 D' x; V6 Q3 }
  25. #include <linux/module.h># Z% f0 U7 @) g% \3 R5 p$ B
  26. #include <linux/init.h>$ F5 R8 q/ Z# H2 w) r9 d; s8 q
  27. #include <linux/errno.h>
    ' C* ~! I6 M1 Y- G5 J% f9 g
  28. #include <linux/types.h>
    4 ]6 V2 s# ?6 c
  29. #include <linux/interrupt.h>
    2 D5 s. ^! v* Z$ j9 @* T
  30. #include <asm/io.h>
    , M6 `; f  x% W
  31. #include <linux/moduleparam.h>
    9 z7 Z1 I7 T) N/ B
  32. #include <linux/sysctl.h>
    # H+ w( M9 S4 j
  33. #include <linux/mm.h>9 R( U+ Z6 `/ w
  34. #include <linux/dma-mapping.h>- f  F* n9 ?0 k. t+ N' r4 w4 h3 \
  35. ; l8 e3 ~  O. |% l8 d
  36. #include <mach/memory.h>  ?7 k: @' [# ]
  37. #include <mach/hardware.h>1 `' K8 p7 {0 S: ?9 z% M) S
  38. #include <mach/irqs.h>( P* F. W: X, j; A% ~' e5 b
  39. #include <asm/hardware/edma.h>
    ; d+ w1 n3 P' ]4 t  I, n

  40. : L- [# L$ z: }& `2 ^' [' H
  41. #undef EDMA3_DEBUG
    & Y' P. m" E; f
  42. /*#define EDMA3_DEBUG*/0 A! o& e, F9 k$ v

  43. / R  R  ^/ }. o- Q
  44. #ifdef EDMA3_DEBUG0 i  O2 C( d1 Q. s1 }/ _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 s5 j+ n( W5 p5 \  n9 W" p, F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a+ [6 P# u; G' x$ f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ r  I( v' ^' C8 n
  48. #else
    3 h. W& d6 X$ T: ?' o- Q+ `
  49. #define DMA_PRINTK( x... )$ |7 j  A: |& ~5 D  H- p# \
  50. #define DMA_FN_IN# z6 V8 a- O4 a
  51. #define DMA_FN_OUT
    1 Z4 _3 R( X+ A/ k+ T2 X
  52. #endif
    # n$ }# o0 U+ R6 G6 `; f' s, B
  53. 2 [4 u) y! W$ s6 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* Y' R1 g& ^/ j1 d. h3 K
  55. #define STATIC_SHIFT                3
    : f4 Q0 l5 N/ ?( r' l/ `
  56. #define TCINTEN_SHIFT               208 V4 L/ ~+ \0 Q3 f5 T
  57. #define ITCINTEN_SHIFT              21
    8 W7 k3 A; k6 |; B9 q9 F' R3 @
  58. #define TCCHEN_SHIFT                22
    $ n$ `' F  t& Q
  59. #define ITCCHEN_SHIFT               23: q; T8 n: [8 B$ J5 a9 m" E; V/ ~

  60. 0 G, ^2 }, p1 H
  61. static volatile int irqraised1 = 0;
    * X/ m0 c8 Q. Y4 {) q% l
  62. static volatile int irqraised2 = 0;
    5 a4 m4 k  q% f1 L9 K/ X

  63. 8 f3 C7 g+ i8 {  M4 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ x  U! B9 K; O. s5 l( C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ^0 |% I7 i, W7 M7 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A5 A7 I- ^; F3 M; l( C' O) U

  67. # @* ^& u0 O$ M3 A) {
  68. dma_addr_t dmaphyssrc1 = 0;
    6 q3 @. W3 ^: q. W
  69. dma_addr_t dmaphyssrc2 = 0;
    % _( M" E- }1 F. O
  70. dma_addr_t dmaphysdest1 = 0;. ~6 L4 R2 m: {/ y
  71. dma_addr_t dmaphysdest2 = 0;& s3 K9 M0 _% z4 S& z

  72. 5 `# A6 {  _  r8 G8 ~5 Z
  73. char *dmabufsrc1 = NULL;
    % O' v- J% h/ k" d5 g
  74. char *dmabufsrc2 = NULL;
    ; ], N3 b* j5 S
  75. char *dmabufdest1 = NULL;
    * G1 d; i6 p2 F. b/ _/ n/ T4 Q& w
  76. char *dmabufdest2 = NULL;
    / n% v0 J9 g3 R/ {- k% |: F- e

  77. , P/ f* q; _0 D6 B2 Q, W
  78. static int acnt = 512;
    ! B/ M# e0 a: Z6 L  k
  79. static int bcnt = 8;
    $ @* f: ?* a/ ^: G8 u
  80. static int ccnt = 8;; \3 V0 j; Y5 \* J/ M2 V: h: O
  81. ! d7 @) A7 o6 w0 [
  82. module_param(acnt, int, S_IRUGO);1 m$ I) G4 g7 F9 c5 H# L
  83. module_param(bcnt, int, S_IRUGO);+ E1 |8 l2 d, U; C5 ]7 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" \: j7 v8 Q6 H) \* z/ N5 u" C) _7 _! F* ?( w! v5 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! c* q$ ~6 X- P  h7 L2 @! }
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* I) P4 v; X- w% R3 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, K4 [0 e  c9 d! x# {0 S

# [% ?4 f/ [+ p8 B# Z8 L' _/ W& W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 04:25 , Processed in 0.038068 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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