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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H5 e$ i. ]5 H- Z1 S* {' Q
  1. [code]EDMA sample test application
    - I3 U2 C4 Z9 X. g$ v% z
  2. /*
    " }' l1 z, @4 G  q- a' s7 K
  3. * edma_test.c
    2 u3 i+ ]' V8 Y) D
  4. *
    ' c) D' a' {5 ]- o* A
  5. * brief  EDMA3 Test Application
    * H8 ]. |0 h6 I
  6. *
    : S( r9 @9 l, w: y# S0 C2 R0 G/ }
  7. *   This file contains EDMA3 Test code.7 t; d( ^5 H6 _# ]! r& V4 ~" U
  8. *
    7 m2 u- x' F3 |  J8 e6 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & Q7 [- o8 i; t% t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 \& _7 c  j% F2 M
  11. *         TO CHANGE.
    + r7 l& ^. L" C; d/ C3 U9 y# z
  12. *
    4 @; G$ h( E5 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 F7 a( @% ^* ]( w2 i( k9 ~- j, n; v
  14. *) ~$ D3 J) _8 o+ D' {
  15. * This program is free software; you can redistribute it and/or
    2 _- P6 c  c* @! p% N- u
  16. * modify it under the terms of the GNU General Public License as7 k. a1 m9 o4 F3 G) Y) d! Q
  17. * published by the Free Software Foundation version 2.
    ( q* p9 h6 s  C$ n
  18. *$ |3 P" \" v7 Q+ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 w/ y; A( x/ V6 R9 l3 [3 Z  A) m
  20. * kind, whether express or implied; without even the implied warranty
    5 S6 [7 ^" v0 f: h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & h9 ]& F& ^/ G1 y6 q% _
  22. * GNU General Public License for more details.# V8 s5 @# R: o) d2 T
  23. */' n# h$ T+ w' [0 q1 e; n
  24. * M! ]* O# t/ R, a% x7 w, g
  25. #include <linux/module.h>8 x5 i. @  q2 T2 w" Z
  26. #include <linux/init.h># d1 a% q) J- G/ K7 d
  27. #include <linux/errno.h>  G0 q7 M7 Y  O5 S" p
  28. #include <linux/types.h>1 T9 C+ ^, M4 b0 v
  29. #include <linux/interrupt.h>
    , k- e+ v: H2 l6 s7 c* A
  30. #include <asm/io.h>$ a0 J, p3 B4 b8 g
  31. #include <linux/moduleparam.h>
    1 j6 L' K0 A9 B" ?. f1 U
  32. #include <linux/sysctl.h>
    # t$ v( |! J- J* b( u1 v% O1 f. n
  33. #include <linux/mm.h>
    $ n1 |- D/ ]! E3 o3 Q! x- Z
  34. #include <linux/dma-mapping.h>0 n+ X: t, X" a& s4 ]  u2 r

  35. 0 o) @% r$ V$ U  @/ C
  36. #include <mach/memory.h>1 h8 ~: ~) Z# t4 U0 [; b
  37. #include <mach/hardware.h>
    5 A" f- Z  a! |. J$ m) z
  38. #include <mach/irqs.h>" v% W: B6 ^$ z7 \
  39. #include <asm/hardware/edma.h>- a+ ]( A6 d3 x6 E7 `. j
  40. ; M  r0 x9 e) N) }
  41. #undef EDMA3_DEBUG! R$ n/ |  \7 f$ L% Y
  42. /*#define EDMA3_DEBUG*/! B0 P1 }9 a% x5 F* f- x- J  X

  43. 0 J* p0 e6 t# u6 y$ u" g
  44. #ifdef EDMA3_DEBUG" Y. i1 u2 i0 }8 h* ~  T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' W  q( D6 p* j. r- q6 r! z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( N; `, P# c- G0 ?$ U% A$ V. t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 o% ~$ {" ]; I4 \
  48. #else
    + b% x: Y) ]" l# s  s; t; l
  49. #define DMA_PRINTK( x... )
    8 I2 H+ x/ b0 H
  50. #define DMA_FN_IN
    4 I* N# C7 I' `" o. D
  51. #define DMA_FN_OUT+ |/ `4 R, b7 u0 U/ _
  52. #endif8 I0 A4 N- }0 M6 k4 R$ S. m

  53. 9 U# p  F  @! h9 O: C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 H7 F* G% T- y, P- Z
  55. #define STATIC_SHIFT                38 o0 f3 ?9 s" A0 x
  56. #define TCINTEN_SHIFT               20
    ' W  J+ `4 r# S( ]0 ^
  57. #define ITCINTEN_SHIFT              21) a6 r# N; S* P$ O8 o& [+ d2 Y3 Y
  58. #define TCCHEN_SHIFT                22
    9 {4 H8 y. b, S( l6 H0 C; Z( R
  59. #define ITCCHEN_SHIFT               23
      q8 i, r, n. B2 X. v7 D
  60. : I% d# o7 F) M  n# J0 _7 `" o
  61. static volatile int irqraised1 = 0;( |" O! |1 T* l' D) h
  62. static volatile int irqraised2 = 0;. }+ J& }. _5 E8 {

  63. 7 S  d; b- F+ h( v# t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C3 e4 K+ l1 c( H6 |5 S( D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J4 ^+ G5 H  x7 X7 P; \! w" i, h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' s3 f+ r" i( l0 M% T

  67. 6 y  ^  b4 K  B! k) H
  68. dma_addr_t dmaphyssrc1 = 0;5 q1 e. }- v" w5 M5 R
  69. dma_addr_t dmaphyssrc2 = 0;
    + O2 L8 H0 y+ L: {5 p$ Q
  70. dma_addr_t dmaphysdest1 = 0;# {2 l2 G7 O% N: Y, Y
  71. dma_addr_t dmaphysdest2 = 0;
      Q- j& K- Z( I- C8 N
  72. : n9 T: y7 L7 e: W* ]& \# W, G: X
  73. char *dmabufsrc1 = NULL;. R' Z$ U) p* S
  74. char *dmabufsrc2 = NULL;- T+ m. W, u$ j( S# [
  75. char *dmabufdest1 = NULL;
    * h( }4 k) m% q2 z: b. V; L3 U
  76. char *dmabufdest2 = NULL;
    " t$ D3 }, n8 d" v. E
  77. 9 e3 r7 D# ~. z8 @6 K/ @
  78. static int acnt = 512;
    % q: _  S* U1 r1 R+ q4 v2 g
  79. static int bcnt = 8;" k" T) B+ o# c: @# f9 F+ t" F4 b  {
  80. static int ccnt = 8;" n4 b8 S. k8 I( |$ k' Q
  81. 7 A0 [. q7 [3 F2 n- l& g  Z2 [
  82. module_param(acnt, int, S_IRUGO);
    7 E$ I- q( O; M
  83. module_param(bcnt, int, S_IRUGO);3 \3 H; U9 Y# c5 u% u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  F) K  y4 l8 z' |6 ^
5 a, K- |/ ~, a: `: s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  u. u/ Y! R/ z  Y# o& n$ ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; c* E! T  ?8 g' P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; G4 d" B% D$ {( M0 Q6 C4 t
7 q$ |0 ^& P& s
* p* h  m: f- @$ v5 Q" e/ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 09:33 , Processed in 0.038377 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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