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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / |5 U! B/ H6 H( G
  1. [code]EDMA sample test application
    ) W! [# k: C; W2 w% W; j
  2. /*
    * z8 O. z2 v. e# a
  3. * edma_test.c/ Z# I/ ^- ^& t! p) S
  4. ** ^0 O* j( l' Z# `! ^
  5. * brief  EDMA3 Test Application( `. [5 G! R: _8 k! H
  6. *
    4 C2 D4 i6 Z) {1 K+ j6 e3 |& p
  7. *   This file contains EDMA3 Test code.
    + y9 y: F* u1 b
  8. *
      r1 g" g9 E  M! H1 Z$ c( A7 b8 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( S* S/ q) k- G0 I9 {. z7 l' h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % X5 l5 r9 G+ f/ ~, K
  11. *         TO CHANGE.
    " y+ v7 z/ i. K" ^
  12. *: ^" j! {8 Z: @& E' ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , \8 y8 a3 S( a! b8 a
  14. *5 M8 S: Y9 [% L* o
  15. * This program is free software; you can redistribute it and/or- f) ~; a5 ]  M" C4 h; ~
  16. * modify it under the terms of the GNU General Public License as2 J7 z  s( j1 j4 i, i& E8 t
  17. * published by the Free Software Foundation version 2.& u$ n) Q& d7 u8 }
  18. *; x0 J2 D4 F5 u7 T$ L" l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  R# x' ]. n: J/ K# O: D+ p! k
  20. * kind, whether express or implied; without even the implied warranty
    & ^" T) \' \- n8 Z, }2 O( m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + x7 p1 K. {$ C4 O) }: T& }
  22. * GNU General Public License for more details.
    & Q, n4 \4 F# m! `" d; d) ^
  23. */
      h1 @$ C* Y& B' n0 P( G/ Q

  24. ! e& c' S! I/ ~" T: G. ~: ]2 k
  25. #include <linux/module.h>
    " P5 h; k' g" @3 L
  26. #include <linux/init.h>
    - w& @$ f5 M$ x6 {3 R8 L0 ?
  27. #include <linux/errno.h>
    + t; @, M3 j0 L$ b" M9 ?) V
  28. #include <linux/types.h>
    2 h3 u/ r5 s* D7 N
  29. #include <linux/interrupt.h>6 Q& M- M5 f" F  L( D  ]
  30. #include <asm/io.h>
    # l4 m) q$ q  C5 h* f5 J9 S( ^
  31. #include <linux/moduleparam.h>+ T/ o: `' M  @8 \8 ^) l0 g
  32. #include <linux/sysctl.h>
    ( r7 [2 N  g! h, K
  33. #include <linux/mm.h>
    7 F# ^* F, u1 G4 U
  34. #include <linux/dma-mapping.h>, Y0 B9 Z. k( W8 I% ]
  35. & Q$ |6 O, F- W: r7 Z5 A$ r
  36. #include <mach/memory.h>4 l: h- S$ `6 a7 D6 u
  37. #include <mach/hardware.h>
    $ s- F! D. f" V0 l; S: M. X
  38. #include <mach/irqs.h>0 A4 N  d0 i: h  e! ^
  39. #include <asm/hardware/edma.h># E: e" C4 X- H( i2 W- k

  40. 0 n5 _# R+ q2 D! i" [  Z' x" M
  41. #undef EDMA3_DEBUG
    6 a& l2 L7 I1 I5 m+ g
  42. /*#define EDMA3_DEBUG*/, H6 K3 {" @" a# g

  43. % B& {9 c1 ~, U: q2 c
  44. #ifdef EDMA3_DEBUG
    & a: K4 a5 v+ ^' {; n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ G9 g" R9 a! D' L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & [; [9 u% T) q; U3 K0 S: ^8 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 {% }0 v9 ~  Q/ h; P+ u
  48. #else
    4 N: @3 K" R. g3 q4 P
  49. #define DMA_PRINTK( x... )
    , q- H" D+ ?1 U. k/ m, W5 A6 F& n
  50. #define DMA_FN_IN+ l5 _4 h& ~; Q( B
  51. #define DMA_FN_OUT) D, c3 G2 r5 x1 d) Z4 j' }: G
  52. #endif
    1 s! n, u& e, l
  53. . a3 ?  b0 d& L- {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 x' O2 ~/ D, ~! k7 I8 ~3 N
  55. #define STATIC_SHIFT                3
    1 K' o3 u! i) @+ ^0 ]4 w$ Y
  56. #define TCINTEN_SHIFT               20
    8 z3 \1 [7 D5 i8 z2 M3 w2 P$ L
  57. #define ITCINTEN_SHIFT              21' b3 v! A( A+ h
  58. #define TCCHEN_SHIFT                22
    & P3 v9 ]" t* j3 |! G
  59. #define ITCCHEN_SHIFT               23) [: M- C9 D6 }# C/ y7 Z

  60. ( t) }1 Y" ~( _3 g/ {) ~  Y
  61. static volatile int irqraised1 = 0;$ G: X. K- m( h; l3 ?0 j
  62. static volatile int irqraised2 = 0;
    " f& P* z$ N' G* u. P4 Z  t
  63. & I! L( B- r2 e- ~% g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' M5 a+ |7 _+ P+ B! U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " k% C# l8 O& y3 n. D0 y( |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ]& q( ]* L- X; e/ h; f

  67. + V0 h; w3 W- F+ }' G/ m2 l
  68. dma_addr_t dmaphyssrc1 = 0;1 e! H  v/ [$ o# H. ]- C- B
  69. dma_addr_t dmaphyssrc2 = 0;$ x# e" y0 S7 B/ y8 i5 k" D
  70. dma_addr_t dmaphysdest1 = 0;
    ) t: a6 @& B0 {) N
  71. dma_addr_t dmaphysdest2 = 0;7 @/ s# `5 `6 d5 X7 h, p$ f% ?5 g: D

  72. + I& c! i2 x. J* [4 F! {/ R6 b% h
  73. char *dmabufsrc1 = NULL;5 s. z. f& K1 b6 {  v+ t/ O4 G
  74. char *dmabufsrc2 = NULL;
    ' B- q; _( c8 U- h9 ?8 f4 Z( ^
  75. char *dmabufdest1 = NULL;
    . _. u7 [" e. `! Y
  76. char *dmabufdest2 = NULL;
    $ I% W9 `7 w( Z" s. |% w% Y

  77. ) m8 F' }% H' Y2 \/ I
  78. static int acnt = 512;. Q- X3 A; \  }* _9 Y7 C! Z$ n% S
  79. static int bcnt = 8;
    ! y8 p. _* T: A4 {; H
  80. static int ccnt = 8;
    9 p  L2 [0 b! h4 K
  81. % ~. v- [* Y2 ~/ I. Q3 }  L
  82. module_param(acnt, int, S_IRUGO);9 [: @5 S  T. `1 b* v" h& t
  83. module_param(bcnt, int, S_IRUGO);
    : d* N: U. {) ^- v3 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ \# `) k5 i; E9 |8 k) B% Y8 b2 J# v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ q' M$ {! M9 }2 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 l+ o9 N: M! C8 X0 O9 U5 {, ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! G' \# u* H% P: x4 h! o

, J  u. w) F9 h% F0 j9 w9 i
6 j1 o4 m3 o% p" {9 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 13:02 , Processed in 0.040208 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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