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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ]- }& Q6 S2 k8 T" E" n1 x- }4 Z
  1. [code]EDMA sample test application
    3 J: E& i, ~' [' ?& |# m
  2. /*
    , Y; V( Q* t5 I4 B. n
  3. * edma_test.c+ A$ _. ~) a% X/ V1 e
  4. *, U7 ~! K: y) M1 e
  5. * brief  EDMA3 Test Application
    , r# ?$ P0 C' s4 N! @# Z% o3 b6 q
  6. *
    2 u: n; p# R# C- T
  7. *   This file contains EDMA3 Test code.
    : s( O* p! q' g# ]; T2 }" K8 A/ ^
  8. *
    ( F' v) p  ~9 N/ F5 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 B( P9 j* _, Q- ]' s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ e  F) B3 }9 |9 x
  11. *         TO CHANGE.. W- c+ a7 k3 Q. f
  12. *
    # g9 Q$ V) H3 [" p3 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) V4 e, n" R! m. G$ L5 p  Z: m
  14. */ m8 R( o3 }' [9 h' L5 F8 E3 q& }
  15. * This program is free software; you can redistribute it and/or0 U# S% d/ T7 E
  16. * modify it under the terms of the GNU General Public License as( z2 j2 d6 k. L( ?% T9 g0 P* ]
  17. * published by the Free Software Foundation version 2.5 o7 g2 T# D( Z) \* |! E7 h, A
  18. *
    - U$ m/ R3 a( e4 T( R/ V$ P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + N% ]5 y8 A" y+ b: H
  20. * kind, whether express or implied; without even the implied warranty1 d* ~# v: b9 j. C& B2 H; h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % U0 y" R/ e# G3 w
  22. * GNU General Public License for more details.
    4 ?& ~& ~' }! k( M1 S$ C$ p
  23. */
    ' `) |0 u/ u) K& b8 d

  24. & X6 g, }1 ^% E$ W6 f
  25. #include <linux/module.h>
    7 y5 r8 t3 Z3 Q8 ~1 }
  26. #include <linux/init.h>
      A1 }7 a) i' p, N0 ^" T
  27. #include <linux/errno.h>
    & d* ^* c' C+ o7 p, }, m
  28. #include <linux/types.h>' i9 ]* x' ]  r% s" n/ p
  29. #include <linux/interrupt.h>
    4 m9 n. W: m. q  A8 U* b
  30. #include <asm/io.h>
    " A  ?1 }* f& g" R1 J) n
  31. #include <linux/moduleparam.h>
    ! }/ w! |$ T+ U9 J. Q  T7 B
  32. #include <linux/sysctl.h>
    , Y4 Y  m/ S# n6 o1 g! ^4 `
  33. #include <linux/mm.h>
    + R' O2 e( }; Z3 z  ~1 p# g
  34. #include <linux/dma-mapping.h>+ _6 {" N5 D! y# ]1 n/ u5 P

  35. # w) Z4 n. v- f% C6 Y
  36. #include <mach/memory.h>2 l1 J4 Q) l: D3 m4 y" {3 R0 U
  37. #include <mach/hardware.h>
    ' a, k* L1 y4 T
  38. #include <mach/irqs.h>
    ) v$ y: k" ?/ s6 w' I
  39. #include <asm/hardware/edma.h>
    % S6 i2 U! R$ s* @1 @) B% e

  40. ' N# `* r# h; Y, f, w: |
  41. #undef EDMA3_DEBUG
    3 Z+ z9 Z+ D+ a. w
  42. /*#define EDMA3_DEBUG*/
    , D) H' J# w1 Q/ W# ~

  43. + n9 D: Z7 i  k7 }
  44. #ifdef EDMA3_DEBUG6 a6 {! t: e; O/ E) l- X8 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * e3 F& N6 `+ J2 K; d& H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 y" L9 W* k! W% x4 o; X7 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 A# X  J8 ]  v9 w3 v3 i
  48. #else
    . Q9 x3 Z5 I1 a7 {, g8 B0 K& I/ ]
  49. #define DMA_PRINTK( x... )
    " N' m' ]8 G; Z4 v$ R) I$ @
  50. #define DMA_FN_IN
    1 e5 W, k: I+ K! R* ?
  51. #define DMA_FN_OUT% r" d% Y; F  [: T0 T% j6 C
  52. #endif. g/ F% _; f" j' Y" J( S# g

  53. " p$ |2 A, k: x2 c0 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 q- X0 N! O- z0 e
  55. #define STATIC_SHIFT                3
    4 A; d) Z" J7 \6 s
  56. #define TCINTEN_SHIFT               20
    $ `5 \. A5 [) C" D8 y- l5 d
  57. #define ITCINTEN_SHIFT              21
    : L: c1 h- Z0 t! e
  58. #define TCCHEN_SHIFT                22- M1 ~" Q- s5 v9 A% O6 w1 g" {7 U
  59. #define ITCCHEN_SHIFT               23/ k2 P& P% p. [; q# z" S% B$ @

  60. 3 m* I, |6 u- `) j
  61. static volatile int irqraised1 = 0;: T* H' R4 M( A# c" ^: x2 Y+ E) q( Y
  62. static volatile int irqraised2 = 0;
    : l5 `1 v5 a& i

  63. & P: \) P. i4 h* `$ ?, c$ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i# n# x% a- a; g& g$ z! J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! |+ X! L  `+ X, w4 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 t8 q7 c; ]7 b$ t3 C; _

  67. : V6 y: x: E+ O8 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    1 t1 T. p  A, [! W# r
  69. dma_addr_t dmaphyssrc2 = 0;( K0 K. O2 E1 T. _% s  A' @
  70. dma_addr_t dmaphysdest1 = 0;
    4 p( t% I5 b7 E
  71. dma_addr_t dmaphysdest2 = 0;8 y* [8 `% A) ?1 k- A
  72. & @- Q5 t+ t: {- b2 I: p) p+ a
  73. char *dmabufsrc1 = NULL;
    % d% y0 M. ]# M/ j) u. c; p  I
  74. char *dmabufsrc2 = NULL;. K" V  |- ~: Q2 V
  75. char *dmabufdest1 = NULL;  s7 @% `  N6 z' F9 B+ C! q1 t
  76. char *dmabufdest2 = NULL;4 K) U! E# M4 b6 x

  77. 6 O; z$ d6 n) i% P
  78. static int acnt = 512;* X' D2 P4 C9 u$ e
  79. static int bcnt = 8;
    7 d0 T) X6 {( B
  80. static int ccnt = 8;
    / I( {5 V7 S& g3 U9 X

  81. & S3 g% o8 a* Z$ @( r4 U
  82. module_param(acnt, int, S_IRUGO);
    2 }" `3 G% Q) K/ o2 q. J
  83. module_param(bcnt, int, S_IRUGO);7 H6 M1 J/ A% Z/ q' I7 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: u  X5 \7 C' e& |' P

" ]0 z! J" ~# {9 F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* G8 N  f& a1 c6 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ j6 Z! V# m& H' S" c5 a) _+ @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  T) q- Y, [+ B
4 X. p+ k: T9 A( [
) M2 P- P) ~( P# v( ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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