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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! T, l' w1 N0 y. h
  1. [code]EDMA sample test application) P- h6 z- M6 f( A  G3 g% _( @* z
  2. /*
    7 l% }: E0 L% k4 o
  3. * edma_test.c+ M: C5 q# I% d2 R1 D. a
  4. *$ P+ D3 {- L# z- b0 ~: i
  5. * brief  EDMA3 Test Application
    1 s4 V% [% K0 y
  6. *  @/ H7 s3 y' O6 r! l
  7. *   This file contains EDMA3 Test code.
    ' m2 I! T2 w5 d9 q. o  g
  8. *6 o; i& M3 R6 F4 M1 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# p& r+ i- c/ j+ p% v; J6 J1 Q& ~5 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 T6 F& W$ w  p8 t+ W; b
  11. *         TO CHANGE.0 I; w2 r2 t+ q% ]  m/ ]7 X9 G0 M
  12. *. ?: V, O6 E1 C  v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v0 u7 T1 C9 G. T! I
  14. ** n5 n8 T- E$ X$ _; ]0 o2 T/ B* c
  15. * This program is free software; you can redistribute it and/or
      u( u( {  s, b4 P- {# F+ o4 T- c# x3 |
  16. * modify it under the terms of the GNU General Public License as
      X, u9 p* z7 A) ^# B- Z" E
  17. * published by the Free Software Foundation version 2.( _+ a8 _9 n4 F5 L: O( H; O3 ?
  18. *
      \$ ]: r3 P& k5 J1 b4 T; g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 d( b) d. I. P& x. Q
  20. * kind, whether express or implied; without even the implied warranty
    9 A3 w+ N7 I  X& j8 [" H$ o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! m/ q* K0 I2 M( L5 |
  22. * GNU General Public License for more details.
    2 ?9 {  M/ G# K: H0 R
  23. */* T: V& v/ @$ M

  24. $ c( E- `& U1 R" S
  25. #include <linux/module.h>
    ' f: m  O8 {' p. V! \7 [3 h
  26. #include <linux/init.h>
    - y) @/ U0 _- N" S- r9 J2 l
  27. #include <linux/errno.h>9 |3 V2 C/ ]1 y
  28. #include <linux/types.h>
    ' v! D( f- R6 i4 t; O
  29. #include <linux/interrupt.h>  @0 S8 o8 e7 e* \. ^) V3 w
  30. #include <asm/io.h>; f3 Z- @: i( g
  31. #include <linux/moduleparam.h>, E# O8 S! y0 V% c
  32. #include <linux/sysctl.h>
    : ^% Y1 p1 _) G+ \/ Z+ {
  33. #include <linux/mm.h>
    . Q" A9 a* G4 \! |; w
  34. #include <linux/dma-mapping.h>
    8 I! ^3 B/ w! [8 l  ]* a

  35. ; g4 k8 l' E3 D4 F' u+ U1 Y
  36. #include <mach/memory.h>8 Q$ h/ r0 \& I- _
  37. #include <mach/hardware.h>
    3 E* ]1 |+ B3 `
  38. #include <mach/irqs.h>; h8 n/ h, A6 ~' @
  39. #include <asm/hardware/edma.h>
    ' B8 S& v" I* ^. h* Y! O: A
  40. ) g( a; F8 b8 a* `& q
  41. #undef EDMA3_DEBUG
    ( t# `1 j) ]! S4 U
  42. /*#define EDMA3_DEBUG*/
    , k! o& f, ?/ d, p) r" u7 a, m- m
  43. 8 C  f" _! J  d* ?" _  V  U
  44. #ifdef EDMA3_DEBUG
    ( C9 b/ k" z( i2 s7 J$ Y5 Q/ p% E' E+ G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  o  {4 N  b8 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . D  b- H; ?& t) Q' X& M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ^" Y+ u0 [( }4 G6 i* V  }: F
  48. #else+ J( W3 J" i# v0 L
  49. #define DMA_PRINTK( x... )
    + A- x$ p3 _8 q& n8 O: z
  50. #define DMA_FN_IN. B. x1 v1 ?5 E/ i! b/ I  |
  51. #define DMA_FN_OUT' y; r" d1 V6 U9 z1 y
  52. #endif
    # j( `5 t8 s, C$ a; T! m6 P" I/ T
  53. $ k% j- }6 e' \- \8 v, N: `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : s/ K2 }' I6 s- f2 q$ L2 a; p' P
  55. #define STATIC_SHIFT                37 X* u# s9 o; `
  56. #define TCINTEN_SHIFT               20+ y3 M' a/ k0 A1 w& w  u. x" ^7 M7 y
  57. #define ITCINTEN_SHIFT              214 ^. U! R) K) b
  58. #define TCCHEN_SHIFT                22
    9 d* F- H3 F, J% t, k0 |
  59. #define ITCCHEN_SHIFT               23
    8 w: }) M0 l7 y7 a7 D5 O8 I
  60. : }; H8 c. s. a1 g
  61. static volatile int irqraised1 = 0;
    $ y, l% Q1 A' {" I+ m" @2 e! W1 e6 v
  62. static volatile int irqraised2 = 0;: s! Y- {' ]8 Z7 u+ Q* I
  63. - I& E) `! K2 ~! f; d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `$ }, l" _) j8 h5 k) ^3 W* h* O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 x5 I& r$ T  _$ H$ M# S( ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f5 N# ^0 {0 E! u1 k: L5 s

  67. 4 d0 ]  ?9 Q4 d
  68. dma_addr_t dmaphyssrc1 = 0;
      S3 |6 ?& R( @3 H, _& u2 J) T
  69. dma_addr_t dmaphyssrc2 = 0;  z5 K- |) ^& C  D. p1 e* x6 J5 c1 {
  70. dma_addr_t dmaphysdest1 = 0;
    : }/ m3 z) \! u# g
  71. dma_addr_t dmaphysdest2 = 0;
    1 v- q2 H  [) ~+ g
  72. / G. n; r  {5 |) r3 p. ]. _7 ]
  73. char *dmabufsrc1 = NULL;* \. ~* W" R. v  h+ h
  74. char *dmabufsrc2 = NULL;
    + l+ c1 p' ^: d5 }$ Z
  75. char *dmabufdest1 = NULL;
    % W$ K" V" A7 @
  76. char *dmabufdest2 = NULL;" j7 G7 g6 E  R$ G: N) Y( S
  77. 6 B6 n$ i# _. e- x" O6 |" Z
  78. static int acnt = 512;; x9 N; ^7 L6 F8 Y
  79. static int bcnt = 8;' V4 X$ c1 r5 o7 d( z
  80. static int ccnt = 8;
    ; W# O8 t- ~4 E: Q6 ]
  81. 5 Q; C$ ?3 \$ |2 \& b3 ^( ?* u
  82. module_param(acnt, int, S_IRUGO);2 l' ]5 Q- K% a7 y
  83. module_param(bcnt, int, S_IRUGO);' r: h1 Z. N, g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; U: j9 S5 A) Y3 `6 W4 `9 E9 Z5 p0 b4 C% Z0 l3 b( d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 H1 {* T$ a( o8 d9 ^- _% G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ e8 ~. ^. @+ q- g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' o  {; a8 R/ `+ w. j  q: r/ `' [* @: O' l, e
8 z8 w2 S7 g6 H* N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 20:08 , Processed in 0.039088 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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