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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 s% Q  k  u3 V! ^+ U
  1. [code]EDMA sample test application
    1 ~& f% U( h' [/ o8 V
  2. /*$ p7 t" J4 n& D
  3. * edma_test.c; ]/ G. Y3 B; l9 b2 g
  4. *
    ; E( I" |, ?$ ~# r( ?4 T. `
  5. * brief  EDMA3 Test Application
    " o# G; |& i( {% T% u2 \' z9 A
  6. *
    : L8 D% q. n, ^; w2 P
  7. *   This file contains EDMA3 Test code.
    . `$ v" }* ]3 J# j
  8. *( ]0 f& [, u2 G% p3 l% L; q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 b0 t4 A$ K: [! b/ e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ z1 k; s* O4 Z' F  h" p4 d
  11. *         TO CHANGE.
    4 S$ r& b4 _# `( Y4 }5 h) e
  12. *
    1 ^2 Q! X8 d$ t  |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 `- m* R, F# M; `* o2 b
  14. *1 t  Z: ~2 M' }7 ?1 ?& @4 r
  15. * This program is free software; you can redistribute it and/or
    7 n0 D2 R5 l) `2 [, Y6 `
  16. * modify it under the terms of the GNU General Public License as0 Z. g4 E1 Z1 i
  17. * published by the Free Software Foundation version 2.4 J) ]2 z; H- o2 r9 W
  18. *
    % F: _# v8 S! E; j3 ]/ c+ J. s2 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 t6 _+ r5 j) P! g# O
  20. * kind, whether express or implied; without even the implied warranty
    6 o# Q) e1 j; A% m" j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , }2 b( w( k7 b& `* t
  22. * GNU General Public License for more details.
    + g: w! A' C3 Y
  23. */( j: M) G* W1 Y

  24. $ i" l: D: c: y4 {
  25. #include <linux/module.h>
    & g2 G5 E  x$ N3 b$ `; W* {
  26. #include <linux/init.h>/ J1 Z% f; J2 s8 N( \& t: B
  27. #include <linux/errno.h>
    ) h2 \7 _/ O& P5 x" L
  28. #include <linux/types.h>5 Q1 t; J5 F3 S1 K
  29. #include <linux/interrupt.h>
    ( w) B4 G  z* K6 L+ D" G; D
  30. #include <asm/io.h>, p* r9 i. }$ r7 i% v  ]2 i8 S5 ^' K- ~
  31. #include <linux/moduleparam.h>
    * a; H7 i0 l$ Q
  32. #include <linux/sysctl.h>5 b, g: F; m' M+ j
  33. #include <linux/mm.h>
    2 g% b% I9 N2 L5 E  M8 m
  34. #include <linux/dma-mapping.h>9 p9 F; P6 L9 ^. [# I
  35. $ ]5 l! W" D: D/ f* [7 k3 n! g& [
  36. #include <mach/memory.h>  T/ V8 u+ W9 @' f7 `
  37. #include <mach/hardware.h>
    3 k& n, n: j" J$ f* p2 G
  38. #include <mach/irqs.h>- G7 r& N3 }( c  E5 C$ A
  39. #include <asm/hardware/edma.h>
    3 w% {0 p9 i8 a4 ^* J
  40.   e+ @0 |) N4 x- X  O
  41. #undef EDMA3_DEBUG
    : z. O$ |: b: v; E
  42. /*#define EDMA3_DEBUG*/
    " ^5 Z2 \7 p. `$ P' J3 q
  43. 3 c- o+ Q6 ^% A3 `" F' U
  44. #ifdef EDMA3_DEBUG) E# W# }& O: O1 c3 g3 S5 _* s$ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 H, o. p+ L$ s* |; @* }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" G2 N, z# D" W, c7 \0 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # X! l2 N0 c6 u
  48. #else  g2 a$ B( r: `, ]
  49. #define DMA_PRINTK( x... )/ n# D$ y- w8 Y! c3 p: K
  50. #define DMA_FN_IN
    + E( F0 K7 v' a& P* C0 }
  51. #define DMA_FN_OUT
    : d4 O$ L5 O. t2 U$ B6 z- @4 ^/ {
  52. #endif
    3 [, s' n$ m9 B2 Z# G/ e$ S5 h

  53. - W; S. q5 ^+ d. Z- C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* B. L7 o  i6 X
  55. #define STATIC_SHIFT                3, |1 ~# W6 N5 f3 w0 ]( d
  56. #define TCINTEN_SHIFT               20- @2 L- O$ W3 c- l) @  m7 K
  57. #define ITCINTEN_SHIFT              212 B6 K" t# A6 y7 W4 X8 F
  58. #define TCCHEN_SHIFT                22
    4 X9 v3 B' X/ R' m; [1 s
  59. #define ITCCHEN_SHIFT               23
    4 @8 U3 G: U+ G( f# X$ n
  60. ! _. C* Y% I! C  Z
  61. static volatile int irqraised1 = 0;& i7 o, Z7 e4 P5 b
  62. static volatile int irqraised2 = 0;
    " p9 N  i$ o8 A8 X; K
  63. ' ~( G" K0 S  v# c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - d) V0 c5 A# @  a0 y" _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 a3 {# V7 q% ]1 H8 I" t5 M2 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 h( x9 ~+ @0 h. T
  67. ; J7 \1 {& [  E# ]% _" ~7 H
  68. dma_addr_t dmaphyssrc1 = 0;" \) M, t/ Y* }0 T5 P
  69. dma_addr_t dmaphyssrc2 = 0;; \; h7 Z) f2 R
  70. dma_addr_t dmaphysdest1 = 0;. v# u# F. {! C! q* E# W
  71. dma_addr_t dmaphysdest2 = 0;9 }9 U& \6 q" e! s
  72. ) A2 G. D9 [. A; X2 @+ ]: a' @
  73. char *dmabufsrc1 = NULL;- N0 s( A- [0 |6 x* X; L
  74. char *dmabufsrc2 = NULL;' I2 p5 h' i9 S. ~/ E
  75. char *dmabufdest1 = NULL;
    5 z: j4 W8 o! d8 j3 l' u3 e0 I4 `
  76. char *dmabufdest2 = NULL;0 R) m# J" q4 X; ~9 \" U2 v: b
  77. 8 I9 E  u" t4 Y% ^: {# i6 Q
  78. static int acnt = 512;1 v  p  C: I7 j
  79. static int bcnt = 8;" h; i- o2 {/ U% o- m
  80. static int ccnt = 8;
    $ u* u* U% {4 L# c
  81. : r9 Z; A9 R; U" O
  82. module_param(acnt, int, S_IRUGO);
    ; n( `0 h) d1 E9 D5 b
  83. module_param(bcnt, int, S_IRUGO);& ~! l8 Z% U0 H! ^3 e. F6 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: ^3 P. k, T9 ~9 {: E: R: V& l/ x( S
/ W7 v0 @) u4 r8 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 O& n7 j+ E4 D7 K( O8 A* d1 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g$ Q6 h7 W' E# u2 b5 W+ W! ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 w. _/ p" C3 B5 o: O

: }. Y6 X1 J. K/ j6 I0 S9 H
2 m9 Y6 v6 X  ~- p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 19:35 , Processed in 0.038101 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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