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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% S+ g$ ^+ W  _$ O
  1. [code]EDMA sample test application' |5 }) p: C' e
  2. /*0 C  _: v, Q: [, D8 u$ b9 u
  3. * edma_test.c  `" x  z2 s! D8 Z4 ]; K: s
  4. *
    % Y, K+ h: e8 ~6 R( M5 F
  5. * brief  EDMA3 Test Application( h- D! j8 R9 o. y
  6. *
    ' k3 f4 }5 J- h9 [( |  @& W' @5 _
  7. *   This file contains EDMA3 Test code.
    . c) U1 V! o% V: _2 y4 Z) z  ]
  8. *
    ' A2 s5 N9 a% `) W$ d) ]& U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" e2 J) e9 ~) s* H! D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 m/ }0 G$ z0 A. c  r0 d
  11. *         TO CHANGE.7 N3 U! E3 P: m5 m! d2 z
  12. *
    + d% R: M3 D8 M3 w3 G) x* M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// {: W( W, L8 W$ N/ u
  14. *
    + x5 v! ^0 h4 ~' Z- b  D1 Q' [
  15. * This program is free software; you can redistribute it and/or/ v4 O2 B% a$ @1 D/ Z
  16. * modify it under the terms of the GNU General Public License as7 X' {8 F. w' G
  17. * published by the Free Software Foundation version 2.
    - X, f5 ]) e. w
  18. *
    7 T8 {2 k" x/ P) t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! S/ }; l2 c5 ~; [9 O; I; p' j
  20. * kind, whether express or implied; without even the implied warranty$ ?( c2 F* K+ ?4 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 M+ y7 D) O( G9 d: _& E
  22. * GNU General Public License for more details.
      T; r' l! T& Y9 a$ x& ]
  23. */
    $ O9 ]6 h  N3 |! h, o, B
  24. # I3 O$ Y; M* \# B1 u
  25. #include <linux/module.h>
    ! d3 Y$ k5 n; A6 X  m6 \3 |+ P1 R, X3 e
  26. #include <linux/init.h>. ~$ h+ s2 M; i  ~2 B# K3 Z
  27. #include <linux/errno.h>
    + @7 W! L- V9 f+ A9 }
  28. #include <linux/types.h>! k. u6 m4 K% ?4 h) p8 `
  29. #include <linux/interrupt.h>$ Q& U' k8 |. ~# K
  30. #include <asm/io.h>
    ; R! |0 x4 W0 i" J, `# g1 D7 H
  31. #include <linux/moduleparam.h># y! N$ V$ M* J& Y$ L% F$ I
  32. #include <linux/sysctl.h># q7 @9 A% y7 w) w" B" e
  33. #include <linux/mm.h>/ N9 s/ B! [" v. ]- h/ P8 [
  34. #include <linux/dma-mapping.h>
    . A/ [& ?! C; s+ }) i& z7 U
  35. " q6 Z* n  @# z3 @: X$ @
  36. #include <mach/memory.h>. n2 T( Q  V$ Y
  37. #include <mach/hardware.h>* ~) ^' I- h/ j- f. x6 i$ {+ q3 \
  38. #include <mach/irqs.h>8 G/ Z3 m' N+ S- X  i$ h
  39. #include <asm/hardware/edma.h>
    9 t( V5 k0 I% ]0 P

  40. + a: x9 h" V0 V% b3 o
  41. #undef EDMA3_DEBUG9 K' r2 Y0 |1 r2 n+ J+ f% B9 c# o& e
  42. /*#define EDMA3_DEBUG*/
    2 d7 z* c) u2 E1 g; K

  43. # a/ W& U, s* J" N1 q/ G& b/ G2 \$ ]
  44. #ifdef EDMA3_DEBUG  U6 a' A5 d5 l& b3 c  I+ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 ~7 X9 @7 _+ @5 F. ?  v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q% L, K) }* Q9 z+ y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 d$ j5 o7 N; U, u  I
  48. #else7 j& Q  r7 `7 x. F/ c
  49. #define DMA_PRINTK( x... )# ^. v: a7 W5 H
  50. #define DMA_FN_IN
    ( [2 d* |+ c/ S) M1 m: ~# Y
  51. #define DMA_FN_OUT9 z3 C/ T$ \' `& ?5 N. M  o* o  b
  52. #endif9 f9 J( y; K4 W# D
  53. ; L" k) o, I/ Z7 U6 i. P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) h$ [9 l% t  M8 y5 ^8 D0 i2 I
  55. #define STATIC_SHIFT                3
    ) S2 n6 R3 b9 N' [8 d+ }5 i8 E
  56. #define TCINTEN_SHIFT               20
    1 n% g5 C" ?9 N5 l  A, h* O4 z4 M
  57. #define ITCINTEN_SHIFT              21# I% s. T- Q- c" k$ d- x/ n, _
  58. #define TCCHEN_SHIFT                22$ ?4 i5 x$ Q0 [7 O3 g( e
  59. #define ITCCHEN_SHIFT               23# J$ B; m: w2 u6 n+ J

  60. , J! t3 p0 Y' f. m( i1 }6 e
  61. static volatile int irqraised1 = 0;4 c+ Q- B+ N& f* k
  62. static volatile int irqraised2 = 0;
    9 P% t5 C% ?. J% A5 e
  63. 7 X9 N0 I& {* H, X  ?6 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; p/ H) ~; g5 s; ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M: k, i( U0 }6 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, v+ ~+ [8 N4 r8 x3 x7 f! C5 K* v) [

  67. - _% i2 R8 a" Y% f5 B3 @
  68. dma_addr_t dmaphyssrc1 = 0;
    & I, ]4 R) q% E
  69. dma_addr_t dmaphyssrc2 = 0;
    4 x" m" @$ a$ \; s
  70. dma_addr_t dmaphysdest1 = 0;3 Z! c2 J: ~8 }  z% s- m- T; R
  71. dma_addr_t dmaphysdest2 = 0;& E9 l9 p8 G9 }! O
  72. # F8 X' [0 v1 v9 o9 [$ Q
  73. char *dmabufsrc1 = NULL;3 R# G% u+ Y' G+ {3 k( H
  74. char *dmabufsrc2 = NULL;- g' [6 y% A4 e9 V1 D( M, V. E8 r
  75. char *dmabufdest1 = NULL;
    0 g7 {& N. j6 e$ s- |% s* a2 @
  76. char *dmabufdest2 = NULL;3 ~7 a4 w* @( _* U

  77. . K; p, P1 a/ X0 s* U
  78. static int acnt = 512;
    . A* ^. O2 R# y  ]) F
  79. static int bcnt = 8;" t8 [* q4 p/ e7 E3 F4 N& O
  80. static int ccnt = 8;) k* n1 i- U4 j6 T
  81. , l& W) r8 z3 k1 x7 M- p
  82. module_param(acnt, int, S_IRUGO);
    . s0 M8 A0 K" m  M6 x+ P
  83. module_param(bcnt, int, S_IRUGO);9 U+ C3 ]9 ?9 }& m$ Y$ _: |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  n: y3 j6 [, u3 G

- O5 A$ X/ j5 M5 B$ k# v! L) \/ F+ K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ K& K! d3 c. ^" E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* V) O+ h* D  Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* y; y2 w( w7 o, F- I

2 d6 s0 Y& r8 ?  c) i: x/ U# S1 E- I+ S8 _7 p* c/ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 13:49 , Processed in 0.039423 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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