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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ o% E: J" {7 n1 ]4 {
  1. [code]EDMA sample test application# }9 d  H, F5 U2 V' P
  2. /*
    , O. _: h, H" H4 g, f, q3 A& }
  3. * edma_test.c
    4 G$ X5 u' s% p
  4. *8 E, R, x1 y! S6 d( G- z/ J5 T  H- p
  5. * brief  EDMA3 Test Application" v  u/ Y) z1 G( K5 {8 S0 c# {
  6. *0 z9 ^8 [6 Z, F4 b7 J# g
  7. *   This file contains EDMA3 Test code.
    2 c; b* ?/ K2 G
  8. *" t5 Q" J* ~" D1 p; Y( f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; |1 q& B: m9 f) n; K" u" u& q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 ~  [' p" s, W. L
  11. *         TO CHANGE.
    3 V# W7 B1 a0 x8 a
  12. *; `* i# G7 r% C! ~! l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + t- |/ j8 l8 v2 ?" M% o
  14. *
    1 L9 t# {) f& W& c* j- ^
  15. * This program is free software; you can redistribute it and/or& X) h3 k( g$ ^+ ~: o) b6 O( s' e: b
  16. * modify it under the terms of the GNU General Public License as
    & f6 F3 `! y( k4 j
  17. * published by the Free Software Foundation version 2.
    & O1 w- `1 U3 P
  18. *1 T& c1 V0 X- H; c$ c* o; L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; A, @+ X% X: C$ C( m# t& i
  20. * kind, whether express or implied; without even the implied warranty. N- C) J' ]  L$ X4 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 j7 w- b/ t2 u) d' b% J: k2 a
  22. * GNU General Public License for more details.
      r7 r: A1 g- `2 v* t6 a3 d; z
  23. */0 W, \' H( t$ t! h
  24.   H' |% W4 i( C& a9 b& F. A' _) m" a9 u
  25. #include <linux/module.h>
    " J$ \" F- e. l# ]/ o" D2 L/ Z/ A
  26. #include <linux/init.h>1 R, T3 {! v) N& c. f
  27. #include <linux/errno.h>
    4 y4 d) K$ u% N! J; [
  28. #include <linux/types.h>
    6 D: m# J7 A2 g) c5 \
  29. #include <linux/interrupt.h>
    % K7 j5 ~2 @6 m% N2 Y! v
  30. #include <asm/io.h>
    : d9 S( t* ]' [
  31. #include <linux/moduleparam.h>' U/ w, D4 @  A. s
  32. #include <linux/sysctl.h>
    2 T$ J$ ]0 G- y
  33. #include <linux/mm.h>+ k% H5 o/ M! H) u* o7 U
  34. #include <linux/dma-mapping.h>
    3 \$ V8 N/ k( w6 w, N  W
  35. 1 z2 f+ q- M* I, d8 k; k* Z$ g! }
  36. #include <mach/memory.h>' Q, x5 o- u5 N6 ^* e' q4 `
  37. #include <mach/hardware.h>
      h7 K+ q: m( A( C" _- |2 L# h
  38. #include <mach/irqs.h># ^8 w( w+ a5 N8 L; w
  39. #include <asm/hardware/edma.h>+ c2 l4 z+ K1 D8 m& N- E

  40. 1 J2 H- a. r+ M( `* m5 |4 d  @
  41. #undef EDMA3_DEBUG- A! s, A  R8 o1 n
  42. /*#define EDMA3_DEBUG*/" y4 p2 ~  r& v' H! ?+ f
  43. $ m* Y: ]* v6 P/ S- n1 l0 _
  44. #ifdef EDMA3_DEBUG
    % k" F& k7 X9 G) W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' s3 h  o+ |5 Z+ T1 o5 n7 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 @3 a1 ~- [- r/ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 o  D4 M: n  k' k' O
  48. #else; R- D& k7 u' U* n$ y
  49. #define DMA_PRINTK( x... )
    ) D1 |1 U0 K( _" J  W9 {; y: u
  50. #define DMA_FN_IN' v' y% u/ y4 ~$ t) s- |! R) q8 K1 y
  51. #define DMA_FN_OUT
    " k8 ?5 j+ [( s
  52. #endif
    7 G0 i! E# L7 k3 w! B% U/ J, K

  53. ; H' E- ^% J( r( ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% D$ J5 e8 m# o7 r4 M5 x
  55. #define STATIC_SHIFT                3
    + H8 P5 E; ~8 A0 Y
  56. #define TCINTEN_SHIFT               20
    8 `' F/ Y  H9 I! p
  57. #define ITCINTEN_SHIFT              21
    % v9 e. L! q1 E9 P! T
  58. #define TCCHEN_SHIFT                22
    0 ^! v. E& }- F3 o1 d
  59. #define ITCCHEN_SHIFT               23
    2 _( \# G3 h  x% w8 s" h

  60. 3 I' t  A, m# l- [5 ~
  61. static volatile int irqraised1 = 0;% N6 C- }4 ~! f: c4 Y' r) T
  62. static volatile int irqraised2 = 0;/ V% d0 \. q& S  @

  63. 8 a1 X4 B. U0 {$ m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 N! h% G* k  p2 Z! r, e5 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c0 w5 [5 E, F4 U5 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( I4 N* t; J# p
  67. + K# Z& K  R5 r! G
  68. dma_addr_t dmaphyssrc1 = 0;3 I/ S+ M) Z! }
  69. dma_addr_t dmaphyssrc2 = 0;/ A- o( j4 u  r- N
  70. dma_addr_t dmaphysdest1 = 0;% Z- Z1 {. A3 ^# p
  71. dma_addr_t dmaphysdest2 = 0;
    4 e: ?' `) A7 B
  72. & F8 w+ ]9 `" o& K0 I
  73. char *dmabufsrc1 = NULL;) g) J# e% @8 |  r
  74. char *dmabufsrc2 = NULL;
    . e- r8 b+ ^: t5 g8 M( k
  75. char *dmabufdest1 = NULL;
    ) ?  C0 F  |* p
  76. char *dmabufdest2 = NULL;
    " Q! z2 }3 [4 N' A  u5 t% [9 a

  77. / ^  m* j: C! r; P3 `
  78. static int acnt = 512;4 c# c' g- T& @" \) o5 f# u
  79. static int bcnt = 8;6 \% d9 Q$ E2 ~* [
  80. static int ccnt = 8;
    . ~6 k( B( n4 v8 s# {8 s) T6 V
  81. $ i! P+ a# F: Y- _) T+ t
  82. module_param(acnt, int, S_IRUGO);
    " I- Y! C3 ]6 u0 G. o
  83. module_param(bcnt, int, S_IRUGO);
      [6 I- j- X- K8 U; P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; T& d4 @* R' W  q: R3 \9 v/ Z& N( c$ @7 M2 U9 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 V* k' K( B0 G0 k9 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! i! l8 f2 _8 O0 c9 n" N& o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ g5 I* ~, F2 O& S" i8 w% _/ V" N) E$ Q

3 ~0 @9 m% Y9 o( _7 j& k( Z  o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 06:04 , Processed in 0.044401 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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