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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Y; j# U3 X; e( Q/ T5 V
  1. [code]EDMA sample test application+ E, o# ?* @  ~% F
  2. /*
    9 R( @7 c" w/ u3 Y/ Y0 B; i+ G" ]
  3. * edma_test.c
    - O8 B) n3 l$ B1 h% j  X! a
  4. *
    ) ^: |% U* ^7 `& x8 ]1 D# x4 a
  5. * brief  EDMA3 Test Application* p5 y2 ]* U  N' C# Z" y
  6. *
    * a0 c, I: `5 q  J
  7. *   This file contains EDMA3 Test code.
    1 W) U0 z! u! a( c3 G. k
  8. *+ n9 D9 V; U% g) N! W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 }8 z; j- A9 V6 z9 F& i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 g* _2 M+ ], w- ~8 @9 P( P6 b
  11. *         TO CHANGE.
    ! U- f8 ?6 Q# K' h0 k4 |0 S
  12. *
    6 x6 V, W) N* e# o4 ]* \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # M% U* m( ~% z
  14. *& S$ P* |2 }' w& F
  15. * This program is free software; you can redistribute it and/or! v1 ~; ~) T0 o& `+ t3 e- J
  16. * modify it under the terms of the GNU General Public License as
    8 o: u6 c# W$ g$ _" k: E) ?  x. v$ E! T9 o
  17. * published by the Free Software Foundation version 2.
    ) Z4 K6 K8 C. G* |
  18. ** v* o, L6 ~# I' x+ T, ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 w4 a0 Y8 W5 ^1 l+ M  P
  20. * kind, whether express or implied; without even the implied warranty( |! c  \: d  G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & y" `$ E; u+ l: r* i) I" B* i
  22. * GNU General Public License for more details.
    7 ]6 V1 }) H" [
  23. */7 A, L& h$ [* E6 O

  24. / c, b7 c2 s1 G* ^% B+ Q/ u' {8 Q  i
  25. #include <linux/module.h>$ d9 y. @1 ?( Z1 X+ k$ a& v0 O' I8 J5 T
  26. #include <linux/init.h>" B/ ]) _2 s: G! g0 S9 B
  27. #include <linux/errno.h>
    ! t4 f7 m8 i3 U
  28. #include <linux/types.h>8 y6 i) T5 s$ U6 f. ^8 |$ o
  29. #include <linux/interrupt.h>9 M9 t2 @8 p" ?: f3 W4 |: I
  30. #include <asm/io.h>9 B( t+ J1 [6 V2 {) g1 m
  31. #include <linux/moduleparam.h>+ G# x$ w2 G/ a3 J4 G( L
  32. #include <linux/sysctl.h>; K! `+ n4 y- @7 _. A- _
  33. #include <linux/mm.h>
    7 O, Y2 d6 E% e5 ?, m
  34. #include <linux/dma-mapping.h>$ I8 f8 F7 M( v* a& V) k% u5 b
  35. + K# |/ {# `4 @7 F: H) Y+ w
  36. #include <mach/memory.h>( y! c* y) I5 n' I/ b* s- S
  37. #include <mach/hardware.h>$ d- E3 Z# G( e' V
  38. #include <mach/irqs.h>+ M& o1 g# V- j4 |" ~) I+ q6 H
  39. #include <asm/hardware/edma.h>% O2 g' E: f7 O5 Z) G4 `

  40. 6 _3 ?  C7 }8 M5 d: k4 g
  41. #undef EDMA3_DEBUG4 m- E! J% H( E# ~7 O  B* ?0 |
  42. /*#define EDMA3_DEBUG*/- o* r3 f: T" {/ Z- b5 Q" R
  43. ! K$ ?( d4 a# C+ N$ W9 Q) o+ w
  44. #ifdef EDMA3_DEBUG
    , i: n6 l0 q, `5 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& `2 t% c# R! o% e& g; x0 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 O5 H* C, i& t* b1 g: d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & \# E/ J$ r- o3 C
  48. #else% Z5 b# B9 ?3 t$ ^5 J
  49. #define DMA_PRINTK( x... )
    + b/ z$ Y" B; G- R
  50. #define DMA_FN_IN+ i+ g4 S  n# ~
  51. #define DMA_FN_OUT
    + |! @' k: w) x! w
  52. #endif
    6 Q/ ]( @: I/ M0 H# [
  53. ! Z/ \, O7 B6 X4 m7 t' _* W7 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 N2 m6 N/ H  G- o, D" x" m% F/ o
  55. #define STATIC_SHIFT                3
    / `( |0 R: D2 w0 O
  56. #define TCINTEN_SHIFT               20* t- N3 u6 a9 E$ n+ v7 V0 p0 s
  57. #define ITCINTEN_SHIFT              215 F0 j/ B: p2 k, {5 I
  58. #define TCCHEN_SHIFT                22- M* Q7 f/ l1 ~
  59. #define ITCCHEN_SHIFT               234 P) v8 Y9 `  p  L$ B
  60. : ~2 U! f' u0 f; L/ g& T- ?4 R
  61. static volatile int irqraised1 = 0;5 }3 f; `) y. q% l+ j* B! R
  62. static volatile int irqraised2 = 0;% n4 v% {# s' t! y! C# |  F% }

  63. # ?& F$ s$ i1 k$ s) d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W% z" y+ }1 \8 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( b7 m5 {# z& h& {$ K2 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w  \7 w, o$ ]
  67. # r% L# D% [6 y* |
  68. dma_addr_t dmaphyssrc1 = 0;; O& _- [( z: ?0 d# n
  69. dma_addr_t dmaphyssrc2 = 0;
    * K! |2 V2 E, j! ?5 _
  70. dma_addr_t dmaphysdest1 = 0;
    - P, \# s3 y+ y2 i- w' U
  71. dma_addr_t dmaphysdest2 = 0;
    8 k0 v  o, V$ ?! \" B! l

  72. 5 W$ h' V4 M, a9 ^
  73. char *dmabufsrc1 = NULL;
    5 @; [" G& P3 c8 `$ K6 M
  74. char *dmabufsrc2 = NULL;4 V) t) T$ e. f: o) a. i
  75. char *dmabufdest1 = NULL;
    $ Y6 g! Q# ^# ]+ N' L
  76. char *dmabufdest2 = NULL;
    5 O4 z. ?2 Q5 ?
  77. 1 G! v" m: q( B0 ?1 H
  78. static int acnt = 512;
    9 _: n: S6 P! k+ j  V4 h
  79. static int bcnt = 8;
    4 D7 ]4 b, j7 b  @0 q+ r  K
  80. static int ccnt = 8;
    : _& Z4 ]/ t9 j$ f1 K: P% ]2 r' t$ H. _
  81. ) M: s! Q/ O3 c+ Y5 n* @3 Z) F0 y
  82. module_param(acnt, int, S_IRUGO);# v: x/ O* f5 W' j8 t# I
  83. module_param(bcnt, int, S_IRUGO);
    8 l& t3 Y/ n8 U8 n# ~% x& S7 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* M! U3 o8 P3 {5 y* X; x
9 d. Z$ T% p7 O( Y; \* Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* X0 `8 B5 l( b  x& ]3 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ~, m7 l$ h+ x9 Q0 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 q% U% L  R. }3 p+ n- t

2 I  D* ~$ X( k- O- H: p7 i
7 p1 m# ]7 L8 W  t) b& i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 20:30 , Processed in 0.038406 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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