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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ?* r% A# H" P: {8 @- X
  1. [code]EDMA sample test application
    ( N* w  ]" j) ]/ |
  2. /*
    ' ~: g$ I5 A7 _4 [6 Z' ~. ]) i
  3. * edma_test.c: v( H7 V/ _8 T9 }( l) @
  4. *0 h5 i: g# ~& P8 p
  5. * brief  EDMA3 Test Application
    , C1 j$ m" [. M3 s& k4 L1 Z& v
  6. *2 J. V$ g1 Y. W$ S8 Y
  7. *   This file contains EDMA3 Test code.
    : f! j) n3 u! r" ]  n$ W/ J* F- v' f
  8. *) C7 L1 x. T7 Z4 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      @1 k4 t# P2 z# B6 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; k+ v6 R* j2 S/ C; X- X9 t
  11. *         TO CHANGE.+ Q5 j9 t' g8 m9 e/ P8 x
  12. ** d2 z& ?4 Q0 x  \& E( D. f: [( L1 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 |; x) c! x* S; S9 [
  14. *
    8 d! m% Q% H, k- q; x- F9 `! L
  15. * This program is free software; you can redistribute it and/or
    8 C. B$ S  _( C0 ^- H# x
  16. * modify it under the terms of the GNU General Public License as
    ! j& a# K5 }! `
  17. * published by the Free Software Foundation version 2.: T7 |, |  j) Z/ D& y$ r: h5 U
  18. *) ]5 \$ Z  S0 s9 a3 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " [8 {1 x# ^5 v, b. d. ~
  20. * kind, whether express or implied; without even the implied warranty8 y- Y' M6 S$ v1 K: w1 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. ?" |0 W$ N( T! G7 D
  22. * GNU General Public License for more details.& N9 a' v; ~+ d0 g! r- [
  23. */. Z. ^. C1 A  }: t, v/ Q

  24. 3 |9 K, K" X& t: ]. f, F- x- D
  25. #include <linux/module.h>4 {: U' d- T/ U4 k$ {/ H
  26. #include <linux/init.h>+ }* V6 z/ r5 ?  Q% D+ k
  27. #include <linux/errno.h>( v0 x3 x- D6 v# y6 D: G0 o. ]
  28. #include <linux/types.h>2 P6 ~. g4 I# a2 t% T8 n
  29. #include <linux/interrupt.h>" T+ [/ N# q! G  X: ?( |
  30. #include <asm/io.h>
    6 k4 Q! Z0 f' m0 Z
  31. #include <linux/moduleparam.h>) v4 |  r# H7 V1 u' p( Q
  32. #include <linux/sysctl.h>
    3 w8 r5 D" ]2 R* X
  33. #include <linux/mm.h>
    # M' l3 i2 o* b8 V( d# Y# z( O8 f9 W% c
  34. #include <linux/dma-mapping.h>
    # E7 q* g' l& W+ i# v0 D5 S
  35. . ^+ e9 I6 c  L/ t( g& D
  36. #include <mach/memory.h>
    ' B( Q3 ?  |" w* |2 @+ K% i0 G  p
  37. #include <mach/hardware.h>% w9 r: l' V; K5 c; h9 `8 F1 F
  38. #include <mach/irqs.h>
    3 C3 V+ v( J# t; W
  39. #include <asm/hardware/edma.h>
      l5 P0 F2 ^2 l# n' l9 u
  40. ( c2 H! I7 i, M( L% y
  41. #undef EDMA3_DEBUG
    1 H% I" q- T" d
  42. /*#define EDMA3_DEBUG*/
    % t+ F8 p5 Y$ N+ r$ `% B8 v4 ]
  43. ' i+ f# n, J$ g2 a6 i4 S# R
  44. #ifdef EDMA3_DEBUG
    5 W1 p3 V1 J! Z# A' Y- f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 o0 N. n! q; I4 [3 d+ k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . E, _& ~; G  ~1 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : W  R) i8 A/ `( f9 v: n
  48. #else
    ! i4 m- _+ H0 d: g3 l  A
  49. #define DMA_PRINTK( x... )
    3 J& u- T# l: ?* a7 R: B6 I
  50. #define DMA_FN_IN
    ( G3 S# i& O3 f1 X( k5 |
  51. #define DMA_FN_OUT
    % R1 m+ v, ^$ p- |
  52. #endif) j. L  A) m) i; b$ M% n# f

  53. $ R. ]; t0 T! W, ^' L* h. L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). U! _. ^8 ~3 w, ]7 u0 w/ r
  55. #define STATIC_SHIFT                3) H4 A" I, v. ^$ }) d/ X7 \
  56. #define TCINTEN_SHIFT               20, t- \5 w% p1 t# J
  57. #define ITCINTEN_SHIFT              21
    0 H5 x. G+ A; @8 L- z
  58. #define TCCHEN_SHIFT                22
    % f- p. ?( I+ h
  59. #define ITCCHEN_SHIFT               23
    / J1 s) E! i& J" v* r

  60.   v* X9 D  U8 j. c, v2 a
  61. static volatile int irqraised1 = 0;( E. z! A+ K( N4 J. v2 V" M  ]
  62. static volatile int irqraised2 = 0;
    6 D7 m3 l5 `( z+ k2 O: Y

  63. , @' Q9 T" k& h8 d0 s" v  Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - o/ z4 W1 n" e+ L7 F0 R6 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 k/ H+ {" I7 T- b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! k+ ~4 f$ b' J) ?% L3 d
  67. 1 l/ k: n8 _0 L& Q# N2 Y- y2 @
  68. dma_addr_t dmaphyssrc1 = 0;
    3 ~" ?1 C( J$ t  p0 c8 p' }3 U: L& S
  69. dma_addr_t dmaphyssrc2 = 0;, k- l1 |8 j' N% Q
  70. dma_addr_t dmaphysdest1 = 0;8 [7 k( D7 d% ?7 K! e
  71. dma_addr_t dmaphysdest2 = 0;
    ( w- {6 T  b7 G! h4 d- }5 P0 @4 }( Y+ c
  72. 5 _7 a8 N4 t$ ?$ {8 n
  73. char *dmabufsrc1 = NULL;
    8 E! |  z2 p8 [+ |* `7 Q
  74. char *dmabufsrc2 = NULL;
      K- p( u! C5 s5 f! G. K- ?
  75. char *dmabufdest1 = NULL;
    2 a& E" M+ E8 W- p* B
  76. char *dmabufdest2 = NULL;
    " K! Z8 S) V3 @% I
  77. $ N: g4 t2 }+ W7 {! q# e& w/ j
  78. static int acnt = 512;5 E( Y: B  {/ ^, ~
  79. static int bcnt = 8;* C! g7 o) E: p! }
  80. static int ccnt = 8;0 u. X/ ~0 R3 _: X
  81. + G6 j, c+ q/ b+ T6 h9 O2 V
  82. module_param(acnt, int, S_IRUGO);4 `4 k$ M8 n8 o* w' ^" {& ~
  83. module_param(bcnt, int, S_IRUGO);
    : ^  l+ D* T8 t- ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ Y1 {: y9 m. r* D! m% }
* p3 j( X% ?* J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* M% k; Y" |# {. k& A& Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j7 J6 D/ g6 m2 E- v4 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% w" b3 R. v1 K" Y2 N4 x- r$ F2 n# h
' d4 ~( ~' ^* @' A* x1 |7 t3 ?; B. `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 14:14 , Processed in 0.039112 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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