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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ P4 _) L* Z+ k( U* k. W
  1. [code]EDMA sample test application& f' ?" f* _3 b1 T0 d* w3 ~6 {* I
  2. /*
    - g8 d$ n' L) P( Z! S: i) B4 K
  3. * edma_test.c) F( V$ R2 l. Y* h
  4. *
    ) [7 K5 T1 x6 U5 ?' K, t
  5. * brief  EDMA3 Test Application' @6 V" x6 G1 d# y* L
  6. *
    ) k2 b# ?2 |) `( i5 n2 o
  7. *   This file contains EDMA3 Test code.4 W! M. Y  c+ T- p+ b
  8. *
    & L: C6 i; ^( F3 F: |$ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 X5 E8 N8 z+ K0 |7 u6 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( W* ]. o2 h% M2 I3 v
  11. *         TO CHANGE.! F8 _/ l( ]+ i; B9 K% W
  12. *
    ; I' Y$ L4 X" X7 @8 s3 U; p+ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 W! m; ]( V5 Q+ k
  14. *! S# Y8 e( @& D
  15. * This program is free software; you can redistribute it and/or
    ; E( J) Y1 i) |+ m: c
  16. * modify it under the terms of the GNU General Public License as  m" T/ G1 }4 x' h5 s$ d7 X
  17. * published by the Free Software Foundation version 2.; ~6 Q+ G2 L6 o& m! H& m  Z
  18. *
    0 a! w4 N6 S6 R  B/ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ?* ]/ ?: y) J! M& {8 I5 v/ l1 T
  20. * kind, whether express or implied; without even the implied warranty7 A/ ?% m6 _- y* n% @0 j( r# Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 U3 n5 h. y! l. a  C$ q
  22. * GNU General Public License for more details.- C, w- h# @. c
  23. */1 q0 o/ D$ }$ `! i
  24. " k# @+ y& u6 T% s& z8 P, B
  25. #include <linux/module.h>: G. O3 w: t! {
  26. #include <linux/init.h>! x5 W0 I% P  V7 |
  27. #include <linux/errno.h>
    $ p2 B" W$ G' t# @3 J9 k! C
  28. #include <linux/types.h>
    ' [& X+ f9 P# Z2 V0 j/ @
  29. #include <linux/interrupt.h>+ G  b( Y; q& N1 Y
  30. #include <asm/io.h>' g& ]( R& W+ c% n' S* s9 p
  31. #include <linux/moduleparam.h>8 y0 Q/ A5 ~- P
  32. #include <linux/sysctl.h>
    ; T- Y, |2 o! K
  33. #include <linux/mm.h>1 e/ p) _6 u+ s& y, w
  34. #include <linux/dma-mapping.h>6 }/ A2 O& w1 ]8 i' d3 A- f/ H" Q

  35. 5 i. M: j2 f5 N3 ~% w9 D6 J
  36. #include <mach/memory.h>5 b$ w% X* I: r* Y* C5 b" |5 p* Z
  37. #include <mach/hardware.h>8 e. ]. T/ k" A5 f  B
  38. #include <mach/irqs.h>+ r9 O8 K6 z$ ?: y9 W/ L0 q: K( C
  39. #include <asm/hardware/edma.h>4 y+ m3 h# H- F) h- D
  40. 8 P! h6 e/ t- Q. Y+ G" J
  41. #undef EDMA3_DEBUG
    # T8 v4 O% W9 K; y
  42. /*#define EDMA3_DEBUG*/
    - @! C7 D/ P' d! i8 t/ l* [8 ]9 W

  43. 6 l& e9 j" r; i+ R! P% |# N
  44. #ifdef EDMA3_DEBUG' K- Q* K: b% _7 ]7 w! ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " o! w( k* t9 ]- H8 A0 y8 F5 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- \4 J% }: t& m' A1 s, l8 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - G# k& K' e% V5 \/ f
  48. #else
    * f5 H6 X) B2 Z1 q8 A; f
  49. #define DMA_PRINTK( x... )
    * E+ P* ~8 ]3 l% I; |( O; B. G
  50. #define DMA_FN_IN( p' c1 Y4 t& U4 n6 H( l3 P2 k
  51. #define DMA_FN_OUT
    / {( K, f( V/ t* x/ {7 ~
  52. #endif
    + `- z( z3 Q4 [$ k7 A( m) Y* _% X- V

  53. 6 W9 u- j# U% S: o. W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 w: M7 r; ]! u6 p, a
  55. #define STATIC_SHIFT                3& v5 L: f* O6 ^% w: s$ a
  56. #define TCINTEN_SHIFT               20
    $ n, F: I3 k1 T
  57. #define ITCINTEN_SHIFT              21
    ; n0 q2 V; V! w
  58. #define TCCHEN_SHIFT                22" ]+ {8 v6 a- F/ g" o+ t. d" Y, l
  59. #define ITCCHEN_SHIFT               23
    / ]. p* ^& J" v2 z8 v, Q9 Z1 D
  60. 2 i1 I8 y0 o# G" u# T$ W
  61. static volatile int irqraised1 = 0;2 M6 T# {6 ~$ T4 s% M' R9 ^' T
  62. static volatile int irqraised2 = 0;$ p" w" c1 D) Y- L  g; L' h

  63. - z0 g1 z. S$ J6 ?6 \, B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 {' F  F" W5 d5 C) W1 p; X/ W9 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F4 w5 u$ O* a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  g$ B/ d. N9 N& Z5 ]
  67. 9 C/ u8 i4 t  R1 i) d! C
  68. dma_addr_t dmaphyssrc1 = 0;
    ; T& U+ v% ]9 {% t, g. F1 T& e
  69. dma_addr_t dmaphyssrc2 = 0;
    2 J. O+ `4 C  h
  70. dma_addr_t dmaphysdest1 = 0;$ n: c4 l, G( x% Q0 t) n+ i
  71. dma_addr_t dmaphysdest2 = 0;0 `1 v$ [! }0 l( I$ P

  72. 3 m( ?# Z; T' J+ [
  73. char *dmabufsrc1 = NULL;' d: R- {: O% {  g+ ^
  74. char *dmabufsrc2 = NULL;; v, \* `8 x; g4 p% {- R7 ^) p
  75. char *dmabufdest1 = NULL;" g2 i. h' W8 i) ]3 U2 D7 B1 @
  76. char *dmabufdest2 = NULL;
    - w, R- G% K# t2 j* ~

  77. * f- g: S, x1 y! f. ]# Z
  78. static int acnt = 512;: M6 V5 v% s. J" [
  79. static int bcnt = 8;
    7 j" N0 d+ @: w& J, [
  80. static int ccnt = 8;
    $ k, `3 o6 j6 n3 x' k' R
  81. ; G; B/ O- e* N$ x: o0 s
  82. module_param(acnt, int, S_IRUGO);
    ) h# a% v+ _0 K) j# j- r  P8 h
  83. module_param(bcnt, int, S_IRUGO);* i7 ]$ d* u7 b1 l" c- `8 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) J$ }" `) H* O
; N: k# W) A4 L! S7 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" A/ ~7 n8 S/ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" q$ q- i4 L! ~" v. T; J+ z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; l' v+ e2 z/ q) e# z
2 P3 p# r" B; c0 p3 C! x6 |/ h7 J" G8 {/ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-2 20:47 , Processed in 0.045263 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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