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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ?: u) z* N% ~* _& u
  1. [code]EDMA sample test application* `5 e+ n( G/ h/ |" N% E: ?; x2 f
  2. /*3 s; l. ]4 G# }# t
  3. * edma_test.c
    ) S+ l( Z& S& U4 H1 G: N6 x
  4. *
    + \( \8 N) A; W; v
  5. * brief  EDMA3 Test Application
    ; T, \8 _7 H) l8 M' H3 t+ W
  6. *
    % f& b1 d* ^, c6 K: O5 t
  7. *   This file contains EDMA3 Test code.
    9 H8 X; u- h9 n. z9 p9 z
  8. *
    7 T7 w9 J1 A& a2 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. O2 X4 B+ ^# C& Y/ f  y1 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 F8 e( u; ^/ i3 h) h) H6 ^7 v5 Q
  11. *         TO CHANGE.
    & X( z, F  E* Z' w
  12. *
    ) l4 }2 V( l# h2 f$ Z  M8 P4 s) M( T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , n3 V, g8 A) u: i
  14. *
    ; n  u3 p; D6 P* ~! g4 d
  15. * This program is free software; you can redistribute it and/or
    # L$ ^( R% w8 \' R# T# |7 C
  16. * modify it under the terms of the GNU General Public License as  ^9 g: m, W  A2 w4 q7 q. g# G
  17. * published by the Free Software Foundation version 2.9 f3 o3 }4 v% a& t/ }/ Z# Y2 @4 w
  18. *
    1 F! i* \/ f5 c' e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) F4 e: i, o8 q+ X4 b) j1 j
  20. * kind, whether express or implied; without even the implied warranty" \7 t. T! M8 c3 Y2 W" o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - H6 p  M0 W2 Q, V9 }
  22. * GNU General Public License for more details.6 Q/ N( Y2 z0 V, q6 |. d" Q
  23. */, n8 Q: r- \0 O/ i. y" b
  24. 2 `8 `) z' |* N7 g
  25. #include <linux/module.h>1 k2 W+ ^% ]. K  D
  26. #include <linux/init.h>+ Y  C* P$ S/ e
  27. #include <linux/errno.h>% R/ S! k) z& t3 v7 ]) k
  28. #include <linux/types.h>. E5 x1 B( X( i. [7 [. p( W+ Y' C$ _7 K
  29. #include <linux/interrupt.h>
    , ~# O) @5 U6 F6 m
  30. #include <asm/io.h>$ M1 E" \: a( `& c7 O
  31. #include <linux/moduleparam.h>
    ' `9 G/ ^% C2 V4 G; Q. C3 M
  32. #include <linux/sysctl.h>
    5 \5 e, E3 d; k( q2 G+ j
  33. #include <linux/mm.h>
    $ z7 _9 [' ]: s- o4 V
  34. #include <linux/dma-mapping.h>
    : k- d8 j" z  a: K9 [- g

  35. ( s$ T$ u; Q0 u. o; F5 ~# T# Q9 H
  36. #include <mach/memory.h>
    * @4 g0 [6 I* V2 R. C- F2 {
  37. #include <mach/hardware.h>/ D% \& J; J; O1 `" C
  38. #include <mach/irqs.h>% q' N1 z  _/ `! q  N
  39. #include <asm/hardware/edma.h>. d8 f+ `7 V5 t! k( M2 z. O

  40. / M& t2 e9 L3 b1 X7 Z. ?+ T7 x) Q
  41. #undef EDMA3_DEBUG7 D. F) T% G. ?1 X
  42. /*#define EDMA3_DEBUG*/
    3 j, |& ?3 ]7 l6 X( }% i
  43. * h- s7 m9 ^2 D/ D! Z3 t" s
  44. #ifdef EDMA3_DEBUG
    ' f) k0 @$ X. J% F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  V# N) o4 j2 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # }% G% e2 @- i: U! a5 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' l, `* H; Z4 U9 B
  48. #else) Q/ v) n' T; W% S* q. v
  49. #define DMA_PRINTK( x... )7 p$ J# A& A0 u- H* |  z
  50. #define DMA_FN_IN
    % |" G$ u( s% A* D4 W
  51. #define DMA_FN_OUT& D) M! N! R- J" c& i; U8 {; y
  52. #endif, b$ u2 u# S3 j
  53. " t' w2 n& m& H4 S2 t2 r4 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). {7 l' ~: o7 f6 \' P
  55. #define STATIC_SHIFT                3$ m5 |$ F) W# ?, ~/ ~6 g- Z
  56. #define TCINTEN_SHIFT               20
    1 B9 h6 r1 L8 D
  57. #define ITCINTEN_SHIFT              21+ J* B. ], L6 L6 a3 n+ j/ }6 E
  58. #define TCCHEN_SHIFT                22
    & `. I! v. V2 d" i6 q, P% |
  59. #define ITCCHEN_SHIFT               239 r( I6 |( ^( I: o3 m! t" C& r

  60. 1 S7 ^* X4 c( k' A" p& ~
  61. static volatile int irqraised1 = 0;
    4 \- ?3 a& N2 i% M5 |& v
  62. static volatile int irqraised2 = 0;& l/ ?( _+ U. t) O
  63. 5 O/ w2 b2 u% A2 W: ^+ h/ ]3 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : x$ i& O. O- h- b( Y9 J: A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + D; e' e" H+ \- N. U* L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # U$ W0 D, M2 i
  67. % g) j  C  u5 y, b9 H3 z& L
  68. dma_addr_t dmaphyssrc1 = 0;
    5 D$ W2 n) r- o8 ]4 q5 E
  69. dma_addr_t dmaphyssrc2 = 0;
    4 b# e* [& P$ L0 _9 m
  70. dma_addr_t dmaphysdest1 = 0;
    9 ^7 U1 Q5 f) h" I: F7 }- ]
  71. dma_addr_t dmaphysdest2 = 0;
    ! D+ N! F0 k( J

  72. + b$ p! s5 B7 c' }1 p5 E- G1 v
  73. char *dmabufsrc1 = NULL;8 J, q8 \7 I" W4 `9 e, R5 U1 n
  74. char *dmabufsrc2 = NULL;
    6 X$ T& U) B1 M- I* g$ w
  75. char *dmabufdest1 = NULL;
    # i# K' H! Y  @- W9 b; S& o# g- \2 X
  76. char *dmabufdest2 = NULL;" f* h$ o* Z0 a8 _( c# U

  77. & M( ^, }2 ]4 L  q. E' h
  78. static int acnt = 512;) @' }9 M& b* e2 I6 R$ |* i/ _
  79. static int bcnt = 8;
    : O( {; Q4 Q1 R: i/ G
  80. static int ccnt = 8;
      O' i8 i: S3 \3 u

  81. ( R/ d3 G, }2 N# P
  82. module_param(acnt, int, S_IRUGO);0 i3 Z$ m/ C5 ~2 O2 v
  83. module_param(bcnt, int, S_IRUGO);
    9 ?' P+ q2 M* C# c" E2 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 m8 j$ [5 U) }* \8 D+ O* g" ~* J- p( h+ ]$ l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S1 j5 P, u" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- [$ z- o7 Y1 f* J9 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  X1 f* [1 Y+ G& S7 ]' I6 x6 U. y+ {3 {
. ?" ]: p0 N5 _5 `- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-12 10:31 , Processed in 0.045805 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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