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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 }& w7 e* `' f: i8 \/ ~. Z1 H
  1. [code]EDMA sample test application4 v! O3 E5 [, c: \9 b
  2. /*4 L  i3 N' M& `+ |
  3. * edma_test.c: U( y: n) `  f
  4. *
    , V! r, `1 _5 X
  5. * brief  EDMA3 Test Application
    : U- n2 k4 H( `; U" }9 m5 j
  6. *. B6 }& U: Z+ |2 Q" l
  7. *   This file contains EDMA3 Test code.* {+ B. m" ]( j! E  A
  8. *
    6 Q# D) d+ Y  u5 L) k% Y0 B0 ^& a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 n2 S" P) `; i: P$ B+ v2 q, h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ }' P3 M' w4 a2 f
  11. *         TO CHANGE.
    + c0 ?* `2 k/ H1 ~9 _& n' O
  12. *% q$ Q: V7 @! H2 _0 t- O# v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . v* m1 X- {% U- T
  14. *5 A; `- l* D8 J+ x. V: q; w
  15. * This program is free software; you can redistribute it and/or
    : l) l- C8 H, ~! k' K1 u
  16. * modify it under the terms of the GNU General Public License as
    + G2 \) f* c1 l8 e9 u3 {2 P4 }
  17. * published by the Free Software Foundation version 2.0 S- N& A0 o2 t+ Z
  18. *
    ' c$ ~, q* Z4 x3 g: R# l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 ]7 y/ [. S: l7 G0 i
  20. * kind, whether express or implied; without even the implied warranty
    6 j* |, W- i  U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 R) s3 o$ B6 @2 E7 ~2 `1 B
  22. * GNU General Public License for more details., c4 e) n' |- t& V
  23. */
    8 z  j( D' Y8 C1 c# f
  24. . W' K5 e; m, K6 l$ x0 ], Y7 o
  25. #include <linux/module.h>8 K. i7 O5 h0 D7 R; N! V. d9 }. M4 F
  26. #include <linux/init.h>
    : A. J9 `/ X  u# S
  27. #include <linux/errno.h>! x" B! ~. |9 o, W
  28. #include <linux/types.h>
    . j% x/ {7 k1 J" |  N
  29. #include <linux/interrupt.h>
    & n* }$ X  u# E0 s1 f" v
  30. #include <asm/io.h>+ n% M+ C$ A9 j- @
  31. #include <linux/moduleparam.h>/ i1 t2 o+ \" d2 q, Q, a9 v# ^
  32. #include <linux/sysctl.h>
    % F8 ]3 K+ w& g& _
  33. #include <linux/mm.h>
    ) u/ j; m- ^9 P0 T% f6 o
  34. #include <linux/dma-mapping.h>
    6 ^% t" ?# E; y% p1 L: b
  35. ! k9 ]( Z. G0 `# D
  36. #include <mach/memory.h>% j' y& B) |+ n& D+ X4 K. J; [
  37. #include <mach/hardware.h>
    % a! B: n, U) v1 x- {5 b' Z0 z& M# p
  38. #include <mach/irqs.h>. C# \: |" }5 y4 q9 g. {3 N' \
  39. #include <asm/hardware/edma.h>
    ! u6 L  u) Y9 P9 o

  40. 2 m; c: n2 A; Z
  41. #undef EDMA3_DEBUG
    5 [& I- b; F2 W: k0 _+ Z5 |
  42. /*#define EDMA3_DEBUG*/
    ' s7 b: A7 z8 S

  43. $ _% M# R9 u. ~1 F* H- T- A& Z% f
  44. #ifdef EDMA3_DEBUG
    ; i" @+ m8 [0 o) b( ]; @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). N# c: n0 Z* g: Z9 m9 p- W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : A. ~- X* w8 Z/ C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! Z4 _! \" _, v. Y5 @  e! `
  48. #else
    * o$ s* _- Y4 X8 q2 O3 k
  49. #define DMA_PRINTK( x... )6 P! P. J/ q! D: [2 d  B: H# ~
  50. #define DMA_FN_IN5 A6 i4 H/ ]( n9 T
  51. #define DMA_FN_OUT
      s" t3 v( a0 b3 `5 Q
  52. #endif
    ( a" T2 j4 w6 g; K- a

  53. & ?" L! k6 p7 g8 B  a6 A* \5 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( }9 T) q% R/ T* j/ j
  55. #define STATIC_SHIFT                3  j+ Y4 }2 A, F8 o' {
  56. #define TCINTEN_SHIFT               20
    4 l, o- ~; B3 d4 {- T! i/ q# J
  57. #define ITCINTEN_SHIFT              21' q* ^4 `' q+ E- I0 _
  58. #define TCCHEN_SHIFT                22
    ' N  ?' j7 E0 [2 T- c) k" W1 i- F
  59. #define ITCCHEN_SHIFT               231 K1 a9 ^0 ]8 V& j3 H
  60. / I! C" ?  r( N9 [# J
  61. static volatile int irqraised1 = 0;
    6 G6 N( C1 k1 c2 t7 a2 _* I! C
  62. static volatile int irqraised2 = 0;: _3 a" y; {% f0 B' s! @

  63. & b' o! P/ |  |* z+ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " @/ K0 v* ^" K) i5 E9 N: p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  C0 l) N4 c8 P! m' a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 b. c3 ?( F. ^' o* u
  67. + ^4 K2 R5 X4 U  F* K% k0 ?" M! F
  68. dma_addr_t dmaphyssrc1 = 0;
    - V+ b: @6 q- ^6 `& Q
  69. dma_addr_t dmaphyssrc2 = 0;
    7 {1 {0 f& G: o$ f# b( g+ U" ]6 T  Z
  70. dma_addr_t dmaphysdest1 = 0;
      K5 N' X) o. C+ a; O
  71. dma_addr_t dmaphysdest2 = 0;
    $ d( c; n2 I6 ^) V# R3 T8 Q" e' X2 q
  72. ( ]( w" Z* k  U
  73. char *dmabufsrc1 = NULL;
    # x. o! |8 T2 c
  74. char *dmabufsrc2 = NULL;
    ) c% k! |" q- e6 h+ u$ U
  75. char *dmabufdest1 = NULL;- h4 w* w# F. i# i' Y9 Y
  76. char *dmabufdest2 = NULL;) n7 s3 g2 n- d  P7 G0 G/ U
  77. 5 I9 |, r( d4 w( L8 x! M( A4 p- Y- i2 n3 D
  78. static int acnt = 512;: n6 p, W$ |' T# [# K" {
  79. static int bcnt = 8;9 u( y! Y8 E8 \- u( t
  80. static int ccnt = 8;& y, w7 m; l+ i. Y9 Z4 l4 ]
  81. * c; ]. _6 y- K* ~( i( k
  82. module_param(acnt, int, S_IRUGO);- a* W+ E# P  w5 V1 `2 o: {
  83. module_param(bcnt, int, S_IRUGO);2 S) H: l+ I7 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 d2 @" B% K- C# c  }4 K
/ D% A6 Z" F6 R; Q  [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- @/ e) u6 W& r0 C' D' P7 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 }% x. `; T& S3 O" f0 D" X" P+ c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ H2 P$ i" ^/ \' ?. h/ ~2 }4 l5 x' F

& O3 |; }& [' b8 x
. W$ E+ ^5 s+ `2 n; K+ s! J) m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 13:49 , Processed in 0.040660 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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