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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! l" V6 t) j6 r9 F4 ?; D" h
  1. [code]EDMA sample test application
    2 q' e4 h9 w6 K  I; a8 Y4 r
  2. /*
    / g# J1 u' f9 b- i( {/ H3 e# |
  3. * edma_test.c' j0 M; [  B) @* ]# G6 H
  4. *
    1 K1 @$ Z$ b# L$ T' m
  5. * brief  EDMA3 Test Application
    ' O% q! S. F2 D8 @- O7 \, J9 K
  6. *
    / e/ r+ Q  F6 ?
  7. *   This file contains EDMA3 Test code.
    - i+ }  X; Y- r* g9 y9 n3 F2 L
  8. *7 j: P7 U) B, ?' V$ C$ G, j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % g7 ?: R" C( G9 K' v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 d* _( D6 H6 i  ]
  11. *         TO CHANGE.8 U) u6 G* q6 D
  12. *
    : @! a, u& r3 X$ S& S8 {( \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% @3 g* }! T4 b% R1 a
  14. *
    - @2 X- O2 b4 M. A' p4 |  w& t
  15. * This program is free software; you can redistribute it and/or  \, U5 v; Z' f$ G6 i
  16. * modify it under the terms of the GNU General Public License as
    0 c- g7 E$ m( P, Z6 e2 t
  17. * published by the Free Software Foundation version 2.
    ; K- u, c3 r7 n! X6 |5 X9 E+ a- e
  18. *
    : k) R3 q9 w) {. @# Z  t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 u9 M, u, X! a1 O0 I; [1 C
  20. * kind, whether express or implied; without even the implied warranty
    8 Z  e8 V: y/ v+ a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 h+ s+ L3 \+ b. [$ |
  22. * GNU General Public License for more details., R0 K6 b# w: E6 e0 {
  23. */
      `! @; B+ \: Q7 Y
  24. ' y& ~1 I- P8 Y" E$ E, g
  25. #include <linux/module.h>
    & s3 m, p, H' ?  Y/ c2 e7 h9 M
  26. #include <linux/init.h>
    8 ?8 s  \) ^' d5 K+ a3 _. z
  27. #include <linux/errno.h>& s$ L9 g1 K# A
  28. #include <linux/types.h>" g& v# Q+ O' t* D
  29. #include <linux/interrupt.h>
    9 G0 V' Q' e! Y( U* _
  30. #include <asm/io.h>
    5 C  Q; o' p, G. h
  31. #include <linux/moduleparam.h>
    4 U1 S. E" c- R6 g
  32. #include <linux/sysctl.h>
    - a: K# y/ F3 `
  33. #include <linux/mm.h>
    % q0 R1 R% v" w# d4 a& H" A& \
  34. #include <linux/dma-mapping.h>, A" L' u6 x# r" f1 Z8 k

  35. 7 D1 A+ L5 z9 U) [% S3 Q/ \8 o
  36. #include <mach/memory.h>$ b! {# z5 S% p' c) c
  37. #include <mach/hardware.h>& c! t6 A2 c" h& Z! h* |% V
  38. #include <mach/irqs.h>) b( ?* o( O! W) n: P: n
  39. #include <asm/hardware/edma.h>
    9 Z. }3 {- h6 u& Z0 l

  40. 2 I& I7 j7 \1 {3 e0 \0 N+ N
  41. #undef EDMA3_DEBUG
    & r4 n  u/ C, b1 ^5 U
  42. /*#define EDMA3_DEBUG*/' Q) W* \, }. a& u% L

  43. $ y" J  R6 K2 J/ I
  44. #ifdef EDMA3_DEBUG
    7 Q" `/ F  A" A6 n% S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* f6 z; x! C4 d) r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # M/ R  G! u# d) q: R% f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 Q- Q' T8 h3 Y4 s
  48. #else* m/ v  [. p7 y, T' W! {
  49. #define DMA_PRINTK( x... )
    - _4 C3 z+ z9 E( r: Z
  50. #define DMA_FN_IN
    ; p9 C8 }7 A3 C& _# R/ e: S2 ^7 b
  51. #define DMA_FN_OUT
    * Q; O$ I7 p6 R; Q) g/ M+ }, m; R
  52. #endif1 U  K8 t$ J: ?2 N3 \
  53. % j' ?- |8 x: W. z5 |. z1 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " h. a/ f& w  P, r6 b
  55. #define STATIC_SHIFT                3
    , V3 e# V1 q* x
  56. #define TCINTEN_SHIFT               20
    ' _) r" }6 }, h8 |# f4 `7 l" t
  57. #define ITCINTEN_SHIFT              21
    ; f* ?/ }/ E& x5 s+ X: Q7 |
  58. #define TCCHEN_SHIFT                22
    ) W0 z6 k+ L( I' O2 H
  59. #define ITCCHEN_SHIFT               23! k  O7 Z: I* e. M! v
  60. 5 c% e# v0 E, ~' S9 a- A# F
  61. static volatile int irqraised1 = 0;
    9 ]4 h. V5 ~9 t/ Q: Z8 H
  62. static volatile int irqraised2 = 0;
      A& Y' V5 Q% G" o1 i/ u
  63. / y, s- L5 h9 h& h+ c# [+ m# e5 t0 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ~# c. c0 `; D$ U0 s  V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 _0 b( y! c1 ^" L" d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g% s+ D) i0 v8 Z

  67. 3 ^9 r2 W' s. @, d8 V. E
  68. dma_addr_t dmaphyssrc1 = 0;3 x# h/ K' c7 k8 P
  69. dma_addr_t dmaphyssrc2 = 0;
    $ p! S0 k& @( q1 L, K% q
  70. dma_addr_t dmaphysdest1 = 0;: \' Y8 b# c% F; ^  n; o; x
  71. dma_addr_t dmaphysdest2 = 0;
    - j$ m- l4 a9 A, P  L0 k' S
  72. 4 o% R: l/ ^& v) a# r0 c
  73. char *dmabufsrc1 = NULL;
    . e2 ~% N5 k' u- T. |( {: ]" A, \
  74. char *dmabufsrc2 = NULL;
    # k5 V2 |+ K6 T& a* W1 S" J
  75. char *dmabufdest1 = NULL;# l$ O2 Y0 W5 b) R$ L
  76. char *dmabufdest2 = NULL;. M' y; V1 l' |: a* e# X

  77. + _; Z* }; ]; H4 a" D) Z( C3 `1 s1 i5 V
  78. static int acnt = 512;0 w/ n1 p9 v% G- v) I6 b
  79. static int bcnt = 8;+ t) t4 v/ o; _% @
  80. static int ccnt = 8;
    3 I+ k' v# d$ r  F* H$ o8 F
  81. 4 e6 O8 H' r6 \$ d6 {  {6 y  G
  82. module_param(acnt, int, S_IRUGO);% @) T8 O+ t  J, B  I/ w  L  p
  83. module_param(bcnt, int, S_IRUGO);
    * Q" r8 k3 C9 _( o+ W5 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) H( v0 t& M7 T: b

; V0 g' l: a' z+ n$ y( i+ e& c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 t8 D1 T1 c7 l# v% f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 n2 X( T0 M8 B. D+ j' m- x/ _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 C3 x2 {3 J! g) X$ i  }% F3 T0 L

) G) J& m; A" ^  ]
: m# o& C, b6 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 22:27 , Processed in 0.043018 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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