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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b7 w1 U% U9 ]6 l
  1. [code]EDMA sample test application$ E  A, a. r* _* V' w
  2. /*
    9 y" a1 Z0 n3 ~7 B
  3. * edma_test.c  E6 z7 x7 a: }; b7 _4 A
  4. *
    / p% a  F' C% s5 t' i2 b
  5. * brief  EDMA3 Test Application; A- i4 n4 W) U4 I, l
  6. *
    . J- o) |$ E- a. ]( j3 A
  7. *   This file contains EDMA3 Test code.$ B' K# c' v( Q1 E, E; n( l9 F
  8. *
    & e& J/ u- E" ^9 I! j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) B  F" y; ~( n7 b" }/ F1 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; o6 w% m" O% ]0 W) t: I6 V; A: a
  11. *         TO CHANGE.) J, a9 i7 x* \9 w; D: G
  12. *
      ^+ S, j) d) Q; e7 C5 T  g# Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% r! h8 ~4 G7 I' g; H
  14. *: ~. W. d) I' _, b/ ~% m( U
  15. * This program is free software; you can redistribute it and/or
    8 N- h& j' b) `: b- ?4 Z1 y1 d$ Z  n
  16. * modify it under the terms of the GNU General Public License as: h$ p8 D; M! j- F/ e
  17. * published by the Free Software Foundation version 2.
    " A6 N# w( a3 s8 c# L) p
  18. *
    $ K2 `! ^' h* }+ I' K. A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # `$ `* e/ \8 x9 t
  20. * kind, whether express or implied; without even the implied warranty
    , m- t  C, b. C1 U- A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & l& Y8 q) W: s* n1 _2 D
  22. * GNU General Public License for more details.
    $ F) V6 C& D" A) Y
  23. */
    6 y% U! o/ V% q% C- N3 ]- G3 X
  24. ( _6 j- F! q0 y8 u
  25. #include <linux/module.h>
    ; O3 v+ T" G: B
  26. #include <linux/init.h># K6 u) y4 W& F) k! t
  27. #include <linux/errno.h>
    1 Y3 T  h8 ?  q, Q& q
  28. #include <linux/types.h>7 Z7 _; d0 f+ d1 K  q0 U# S; @3 ^
  29. #include <linux/interrupt.h>
    " }1 Z0 z* s- S+ K# w0 m$ l; @
  30. #include <asm/io.h>
    ( G  o7 K" x" @- F* E5 V
  31. #include <linux/moduleparam.h>
    8 Z/ M6 x9 C! ~' C: ?
  32. #include <linux/sysctl.h>
    5 i, f" B% w! d: k' R& a
  33. #include <linux/mm.h>. z& E0 F+ }: S
  34. #include <linux/dma-mapping.h>2 R' H- Y% c3 b5 F. J
  35. 1 I* G/ w# i4 d/ ~
  36. #include <mach/memory.h>3 G% _. @/ |6 j5 \# u
  37. #include <mach/hardware.h>! E" S" h# n) P- k2 U: y. x: N
  38. #include <mach/irqs.h>
    + `+ n) \* Q4 ~
  39. #include <asm/hardware/edma.h>, {& V' u- D% r$ \
  40. ! J/ G* j# L7 s! A
  41. #undef EDMA3_DEBUG" F$ X# h- x$ B6 e
  42. /*#define EDMA3_DEBUG*/
    / S; N0 b- R; f; t% E1 v; |

  43. 7 K$ ?) {" Z3 G$ ~
  44. #ifdef EDMA3_DEBUG7 H8 L1 K5 I) L8 v. L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): M0 y' |+ Q/ w9 n. [$ O5 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 [. p! N% k+ M! x3 {- R9 o) R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 p& K$ i; D# u
  48. #else
    & g( W; j% W; ^' Z# T; C
  49. #define DMA_PRINTK( x... )( L4 t  B+ H0 I& x! h6 H
  50. #define DMA_FN_IN0 c4 c; }1 D1 w& U
  51. #define DMA_FN_OUT( g3 P/ H5 K2 J* }( Q; }* g6 V% m/ G
  52. #endif* h1 [* }1 V$ f7 {7 Z/ \9 d

  53. 6 z5 J" j# {5 p& q2 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 M2 j1 g0 s* ~8 h# q* i- h5 P6 k
  55. #define STATIC_SHIFT                3
    9 P1 w" Z1 k; H% }  S4 d: U  s
  56. #define TCINTEN_SHIFT               20  ^, ]+ @1 q$ w
  57. #define ITCINTEN_SHIFT              21
    9 Y9 C0 _% u  l' g7 y$ [' m
  58. #define TCCHEN_SHIFT                22, X+ r. t4 B5 J6 v* Z
  59. #define ITCCHEN_SHIFT               23+ ~0 u7 Q$ t3 y

  60. # x# F' n$ B3 V$ o3 |
  61. static volatile int irqraised1 = 0;
    4 y1 P/ C' m' R& w, R
  62. static volatile int irqraised2 = 0;
    4 V' S' }, h! Y- n$ p1 _% i( M

  63. 9 c. j& _7 k  Z. d& _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; w; Y$ J+ A0 G. j" b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 H( z4 k1 m* D9 g1 P; D4 }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C, `) l. w" [7 r
  67.   J; f7 L. _- j) u; i5 V
  68. dma_addr_t dmaphyssrc1 = 0;
    6 M" Y+ @, w& J$ t' [0 n2 Q. G
  69. dma_addr_t dmaphyssrc2 = 0;+ B% ~) [7 {5 _( i: G& N9 z
  70. dma_addr_t dmaphysdest1 = 0;
    % j8 P$ X5 e0 i
  71. dma_addr_t dmaphysdest2 = 0;- s/ I! [) {- B" d# b9 o/ F
  72. , ?. g3 j) Y' z- R* j- O
  73. char *dmabufsrc1 = NULL;
    4 w9 ]4 e# c3 ]1 J" k8 |. K
  74. char *dmabufsrc2 = NULL;
    & t% G- r2 x4 \- D, }9 Y
  75. char *dmabufdest1 = NULL;
    8 D8 D1 M  n2 L  N
  76. char *dmabufdest2 = NULL;
    7 m# b/ K1 ~& _  I6 S8 s
  77. & x. t, v5 S7 T; s& f& S
  78. static int acnt = 512;: f* }( y& |4 o& P
  79. static int bcnt = 8;
    9 b7 I" M( I& g6 w/ Q7 J
  80. static int ccnt = 8;
    1 n* {, o0 f9 N2 {/ F

  81. 7 F+ i4 m1 q2 R2 C
  82. module_param(acnt, int, S_IRUGO);+ ~: s/ U' r# H/ q' C
  83. module_param(bcnt, int, S_IRUGO);9 B* y0 X6 v- M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& y9 E5 u3 l) V- o3 @' t
: [$ I$ x  w1 [; g$ q8 l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# l4 P% h* a9 q- j# I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( P/ E. M& a7 V  B) ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ i, R6 S, |8 r$ d8 d: E$ Y( I/ g5 L3 m
7 B2 C; e5 j2 ~! f) P& ?6 z& ~6 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 02:55 , Processed in 0.039367 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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