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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   s! V7 P) d+ S- P, y; U
  1. [code]EDMA sample test application+ D) v; T. X2 @& @
  2. /*. {8 Z3 O4 \0 t  A, {
  3. * edma_test.c/ B& M7 C9 K, S
  4. *, J1 B& N. @; P9 \- [1 R
  5. * brief  EDMA3 Test Application
    3 H( B- E4 ?7 S* _' _7 e3 F9 r
  6. *; f7 p4 Z  J  Y
  7. *   This file contains EDMA3 Test code.
    6 {# ]: W  i$ E% _/ @3 Z
  8. *, U- D$ R. x8 z; v! I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 \& i9 o& M- \( U9 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 r4 C9 c6 q: i! n! y
  11. *         TO CHANGE.- ^. \/ _7 t2 _5 o, c- M7 w
  12. *# J$ f6 D' D4 i5 g  P3 Z9 x( E- I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; r) G8 Z: W9 T6 C
  14. *( ?; `# p. k/ @
  15. * This program is free software; you can redistribute it and/or
    ) v& k/ D% n4 T6 u# o# ^
  16. * modify it under the terms of the GNU General Public License as1 u4 z; M+ j) }# v
  17. * published by the Free Software Foundation version 2.
    0 u6 m( y1 \6 I1 @) R: r1 d
  18. *
    / C, ]' ?- r4 f: d0 a7 g( x  ^% }" Y$ R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 s+ y, ^7 v. V# p! x# V; c8 g
  20. * kind, whether express or implied; without even the implied warranty
      i& ]5 M# K. Z  n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 {8 V5 v& Y" }7 ]5 ?7 ^% Y8 M# }
  22. * GNU General Public License for more details.) ], d6 h) v+ T9 h
  23. */" H7 b! T3 N+ K2 l0 A+ X

  24. 9 x/ _# o/ a+ l# t
  25. #include <linux/module.h>! |3 @! R( U9 C: b
  26. #include <linux/init.h>9 ]  Z# d- d6 r9 @7 e, _
  27. #include <linux/errno.h>
    % o) S8 V# ]2 ]9 M: j
  28. #include <linux/types.h>
    5 A1 P% Z4 b+ h* E& i% w6 M6 w
  29. #include <linux/interrupt.h>
    5 v5 q  ]( {8 _# c. j/ h8 @
  30. #include <asm/io.h>/ z+ L  l- m( X
  31. #include <linux/moduleparam.h>: A9 L3 {: W* h% X
  32. #include <linux/sysctl.h>6 J+ Z2 z  X8 c
  33. #include <linux/mm.h>
    1 l& }. ~5 L5 ~5 g
  34. #include <linux/dma-mapping.h>
    ; {/ E, T) e2 a3 s! k2 `$ r: t# i# N
  35. ) q( M: E" \: Q; M* H9 T; n
  36. #include <mach/memory.h>
    . ~& c+ e5 F, C( X) S. x
  37. #include <mach/hardware.h>
    + ^" e% u+ u$ E6 k
  38. #include <mach/irqs.h>2 a8 E: v. g7 i. G5 T2 y5 g; b3 f7 G
  39. #include <asm/hardware/edma.h>, }, e6 R/ O$ c# F

  40. 1 v$ c& P/ X1 g
  41. #undef EDMA3_DEBUG0 b# ^4 b4 V+ t/ w% |4 |, y
  42. /*#define EDMA3_DEBUG*/4 }- w4 X) _3 ]% F9 P+ [

  43. 4 M4 ?' l$ w- D9 b5 W1 l
  44. #ifdef EDMA3_DEBUG
    5 r9 I; K6 s& B" C: I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" t1 k- h* \/ D! e0 B6 S& L7 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 [* {/ a9 ^9 N3 m" Y( }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 b- ~, G# W7 ?  k/ Y. J, r% E
  48. #else- f% `0 }4 u6 c# b; j/ {
  49. #define DMA_PRINTK( x... )! y  M+ a$ M. e3 I9 K% Q
  50. #define DMA_FN_IN0 ^) |% p/ O$ I' h2 }/ }" T
  51. #define DMA_FN_OUT9 b8 }7 P$ O" y. [
  52. #endif: \9 a. h' E, u# }3 h

  53. # j0 }" ~& ]( V& N/ D; l( o% ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 X5 K6 ^. w7 b% a# _
  55. #define STATIC_SHIFT                3
    % p% H1 v: n! Q+ s* s, _6 V0 \
  56. #define TCINTEN_SHIFT               20
    5 w& N: W. M7 J7 s
  57. #define ITCINTEN_SHIFT              21& y4 j/ b. b  z  q' k+ V
  58. #define TCCHEN_SHIFT                22  M; }. U% X  ^) a, j& [
  59. #define ITCCHEN_SHIFT               23
    2 ]) q4 `- |4 _4 g9 }

  60. 7 k" j/ |* u  F; p" m
  61. static volatile int irqraised1 = 0;$ [/ B' }! L+ P0 q9 O" P( W
  62. static volatile int irqraised2 = 0;
    2 ]) a7 N2 `# d  a  d9 F8 {! z4 x$ }

  63. : I" ^) y( h% ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y. p  ~  r+ l, D0 G! W+ h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n; d) p% Q. ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& f# o+ z% Q1 R8 t  n9 Z8 _
  67. 8 S: t2 C0 N  W" G4 \
  68. dma_addr_t dmaphyssrc1 = 0;
    6 U! n1 P* _  D" W9 j% H" i; Y" E
  69. dma_addr_t dmaphyssrc2 = 0;8 m( R. ~  D7 @" h/ r
  70. dma_addr_t dmaphysdest1 = 0;% J7 z' k4 g! J1 G+ |2 A) o
  71. dma_addr_t dmaphysdest2 = 0;3 |, Z8 h0 H0 s' n6 a4 x- X9 S. ^

  72. : z. T7 T0 d# o. s
  73. char *dmabufsrc1 = NULL;2 e9 W5 T6 M5 ~% Q+ W9 a
  74. char *dmabufsrc2 = NULL;/ K0 ?8 b8 T9 ]; h  h# ]. ?
  75. char *dmabufdest1 = NULL;
    3 h7 N1 t6 L+ _: T
  76. char *dmabufdest2 = NULL;* `; k5 y. [& w/ `# l% N9 q+ G
  77. 1 |" ]1 }+ ^. A  |) Q# F
  78. static int acnt = 512;
    1 A- `1 j# ^& f7 |" v6 g
  79. static int bcnt = 8;' q/ P. d1 Q$ t$ Q9 p
  80. static int ccnt = 8;& s0 R$ x( w5 R4 h" ^( @' W

  81. 2 w  }) k+ V7 F  O9 K
  82. module_param(acnt, int, S_IRUGO);5 W/ a9 u6 w" v8 W: s2 |6 Y; F4 D
  83. module_param(bcnt, int, S_IRUGO);
    2 R% J3 M, a4 ~+ N/ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 i  {) t# ^! T
7 O4 A, a# n0 c; x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ]' o$ b: l6 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ P5 X# z3 }! c4 A1 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; W$ W8 J2 U4 r5 g
& x# L! W& {8 X+ I2 W, i( G% T2 n2 i( s% |( U. Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 20:38 , Processed in 0.039049 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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