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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 G3 x- g) g' Q, g& K1 G
  1. [code]EDMA sample test application
    % q8 a9 j. ^7 o6 _8 _9 G
  2. /*1 `* h% e5 `1 s
  3. * edma_test.c
    # W) \7 q8 P* G2 P3 Z
  4. *
    0 ^' J5 M0 t- H1 v
  5. * brief  EDMA3 Test Application" m; P* v5 `) A3 y6 h0 G8 R; D. R
  6. *
    % @4 y* T$ h7 {- s, F* b6 O4 r
  7. *   This file contains EDMA3 Test code.3 b+ b6 w2 y- _+ ^; L
  8. *
    & Z9 g, Y! z! v# H6 r: [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ e/ F5 x7 C6 c9 _$ E- B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Y. I* k* m( I/ n! b# n0 S  u" ~
  11. *         TO CHANGE.4 r9 `" C" v; b: F
  12. *
    / B4 A7 N: V/ c: q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ D. H8 L& L/ w0 D
  14. *" M& H9 r( z3 \  @
  15. * This program is free software; you can redistribute it and/or9 P" l! i/ E8 M, d# [+ B
  16. * modify it under the terms of the GNU General Public License as
    7 E) z6 e* H4 z' `2 j* c
  17. * published by the Free Software Foundation version 2.
    6 W" T! U% C$ t# x
  18. *1 E, E/ c  g3 v9 ~* K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * x2 H# L" L$ i- P( f
  20. * kind, whether express or implied; without even the implied warranty
    : q( s6 G3 Z6 Z. H+ ^" j7 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      b, L% Y; z- s
  22. * GNU General Public License for more details.) a$ f; s  R9 U9 A8 J4 N
  23. */
    9 Y, W- G; c! _; ~6 T
  24.   ~* z* z& q# X& v8 A
  25. #include <linux/module.h>& {2 i6 T& ~$ P  }% a, F: o
  26. #include <linux/init.h>8 b( q3 w/ S& n' E
  27. #include <linux/errno.h>' g& H. p- [; j5 A
  28. #include <linux/types.h>
    / K8 E0 f# h% ], i: L9 ]$ L; O
  29. #include <linux/interrupt.h>
    # ^4 ^8 B/ o. n! C
  30. #include <asm/io.h>
    5 [! E4 l! H% p, I
  31. #include <linux/moduleparam.h>
    4 l; \0 l- \* @. w4 G& c! g0 |
  32. #include <linux/sysctl.h># \' t" T3 X0 {- i9 C5 I7 H1 [
  33. #include <linux/mm.h>
    - i. G7 D( |: a- i4 ?; l
  34. #include <linux/dma-mapping.h>: X; i& H6 f" E1 ^
  35. # a! T6 U/ z: T2 \/ S; g) u+ W
  36. #include <mach/memory.h>* Y6 z3 t1 A6 ~
  37. #include <mach/hardware.h>+ I; ?" Y" [3 C: e* O5 l
  38. #include <mach/irqs.h>1 I7 a  Y' G5 z" n( E- J
  39. #include <asm/hardware/edma.h>
    7 L( P! Q3 R; o, p
  40. & D. |% N" c" M; K# `3 X2 ~2 U; ]2 C
  41. #undef EDMA3_DEBUG' ~8 E4 T# R" w' F  U8 n
  42. /*#define EDMA3_DEBUG*/" m1 S& _: e: n" ?2 _! j9 p% G# o
  43. 4 L8 e; {/ R- l# `; m
  44. #ifdef EDMA3_DEBUG, a7 R, r& o% e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - s% }4 x. C" x2 K$ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 l  S: E" S' Q9 D. u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' h" C# @2 o' t' K0 z/ H. H: c; [  N% ~
  48. #else; a" _/ [/ Z" i1 h
  49. #define DMA_PRINTK( x... )' ^+ P' S3 l: L- O* |/ m6 A
  50. #define DMA_FN_IN
    6 _) Q) I0 j3 y1 }& T
  51. #define DMA_FN_OUT+ X+ b! t; c, u8 [; A- z( a/ d
  52. #endif
    + R# B5 a7 l5 K  `/ d! j

  53. # ~) j- s) O' n; H7 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). d% E; C) ?9 s- H
  55. #define STATIC_SHIFT                3
    ; B& _) n7 z' [& x1 N! x
  56. #define TCINTEN_SHIFT               20
    # J3 |' t( o  ?6 X  a# ]
  57. #define ITCINTEN_SHIFT              21
    6 [- H: B4 A' \0 g9 r; p6 M
  58. #define TCCHEN_SHIFT                228 v4 ]( `8 i! e$ P. @
  59. #define ITCCHEN_SHIFT               23
    3 {  y+ T1 d+ [6 O+ _7 O
  60. # a- I: `% ?: f" o. l
  61. static volatile int irqraised1 = 0;
    8 A* k) b9 w/ i/ e
  62. static volatile int irqraised2 = 0;4 S8 O. U" I- v' P. }5 R
  63. . q# T; t1 a* M& m, a& P! ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & r0 A; E$ W7 B4 }* o2 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : m) b3 y; l, p% W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 u* j4 I) q5 S/ i: q5 _; B
  67. 0 w2 b! @$ ?) h4 n6 _' b
  68. dma_addr_t dmaphyssrc1 = 0;9 B: ]  x  L. J- v0 ?4 b5 R" R5 Y+ ~
  69. dma_addr_t dmaphyssrc2 = 0;
    & _+ ?6 B/ ]; E
  70. dma_addr_t dmaphysdest1 = 0;
    + v: C# f/ T7 D* R
  71. dma_addr_t dmaphysdest2 = 0;
    " Q( |% D6 ?0 ^

  72. ; a0 e& z: a  o5 y" h
  73. char *dmabufsrc1 = NULL;/ N. Y$ Y1 y0 _9 @( c$ _
  74. char *dmabufsrc2 = NULL;% ]2 V* [) ^. l0 l5 ^" i! ^
  75. char *dmabufdest1 = NULL;2 i' T- k) `2 y! k7 _6 S
  76. char *dmabufdest2 = NULL;# i9 V; t) J" `; E4 j, B% j
  77. - r; v0 ]* A$ }# p( e8 q% L
  78. static int acnt = 512;/ M4 q) K  [! }) o& r
  79. static int bcnt = 8;; l. ], e9 A. o  M
  80. static int ccnt = 8;
    3 ?) m9 n9 \7 Q4 F

  81. $ z4 N4 S8 b9 L8 l: Y
  82. module_param(acnt, int, S_IRUGO);
    8 R  }) E6 V% m. l7 V* H# [
  83. module_param(bcnt, int, S_IRUGO);
    : x9 o! ~/ b% I+ d: W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 f; [9 P  c0 ]" ]8 g8 `7 t
& |+ K" g2 S  W! s7 R5 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- F4 F: e/ ?$ W6 o+ \6 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% X. Y( n7 f; K4 C& |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% w8 a2 b6 N3 V! ^
7 y1 `+ T# u# Y4 q6 j
& N9 p. B, O# S5 [2 C& }2 W. R' W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 08:14 , Processed in 0.046373 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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