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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 t1 m  g( M% e) J, E5 F, v
  1. [code]EDMA sample test application
    ! r9 R; }: U3 V$ d5 m" o) j
  2. /*
    0 k$ p* G6 k; A4 P
  3. * edma_test.c
    1 a+ c+ o1 r+ ]
  4. *. J+ Q" x. ?6 b9 O
  5. * brief  EDMA3 Test Application5 Z! V! y+ u* B! x
  6. *
    1 D/ D2 N& w3 g/ g+ B/ G
  7. *   This file contains EDMA3 Test code.
    * N0 w; ?( |% j/ R& H9 f; A
  8. *
    - c0 w  s- X# ~! n, r& Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  Z. ~5 {0 H! P1 O. M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 \# o; q$ J3 R
  11. *         TO CHANGE.  [& ^5 J" L- A8 z3 j' _
  12. *
    8 K, z/ e+ q2 L# `$ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 |$ h: E7 C. Y+ P! V( O0 \
  14. *
    0 [: x( S6 @- d1 A0 q3 G
  15. * This program is free software; you can redistribute it and/or
    - q( ~; W- ]; J
  16. * modify it under the terms of the GNU General Public License as
    - a4 }; o. E) r& o0 r( }
  17. * published by the Free Software Foundation version 2.
    , s# m4 ?9 o: y1 X. V
  18. *
    4 k. b, k; o* `4 j+ b' b& U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 g, U$ n8 i3 R/ e, Y9 c
  20. * kind, whether express or implied; without even the implied warranty0 L, ?* O! z- }9 g' _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) b& \- {  d4 B6 b& G+ @0 a
  22. * GNU General Public License for more details.1 M% R5 D' m' G1 u+ |# @; b
  23. */
      e- @2 I0 ]1 Q% B( g4 y* {
  24. & H- D( ?5 E- {, t
  25. #include <linux/module.h>8 q: n) V3 {/ W6 ~3 i* \
  26. #include <linux/init.h>. K7 a1 Y& \4 ^6 A. H( d1 u5 K
  27. #include <linux/errno.h>
    * k3 c: y& _) G  C! h7 {
  28. #include <linux/types.h>
    8 S/ p- i9 H. X
  29. #include <linux/interrupt.h>7 ^, u% J: H; Y" |
  30. #include <asm/io.h>
    # `2 v2 ]  C3 `, O6 P. A
  31. #include <linux/moduleparam.h>. n3 p/ C+ t) h; r, s2 W
  32. #include <linux/sysctl.h>
    * }3 e6 k$ h6 C
  33. #include <linux/mm.h>
    5 V- V" o. e6 I& x! h4 i' d, P
  34. #include <linux/dma-mapping.h>- V" H+ b* u' v( h. d

  35. ) H- V( U2 @' s1 ~; q: B
  36. #include <mach/memory.h>
    # F' Q' D' s) `
  37. #include <mach/hardware.h>
    4 q0 Z* h4 Z4 R: l  r3 T
  38. #include <mach/irqs.h>
    0 c$ o9 G/ p& e7 M# Z# y! q
  39. #include <asm/hardware/edma.h>9 M! l8 y, M0 e2 x  V9 b2 L6 W

  40. 4 H9 a7 ~- u  v. _$ ?: ^2 g" I8 W
  41. #undef EDMA3_DEBUG
    + t4 X! T' h6 a. h& D
  42. /*#define EDMA3_DEBUG*/
    & f+ R5 z( a+ ^7 Z5 ?+ F
  43. * M% E/ B4 L+ N% @5 S
  44. #ifdef EDMA3_DEBUG# \9 B% g5 ~! o. P2 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & S1 Q# Z7 V$ }7 n3 A. b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): `3 }! A9 \" L8 \8 f$ g$ `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . M& }. s) W& r0 h2 o
  48. #else3 ^% h# z5 l2 z: }, [
  49. #define DMA_PRINTK( x... )
    9 \6 Q2 u5 a" u9 e& j$ W, E7 @
  50. #define DMA_FN_IN
    5 M% C& }/ F- i7 o
  51. #define DMA_FN_OUT/ T7 K% H& m) H7 f9 Q6 i
  52. #endif
    - {0 C, d# N- ~) N+ W2 j7 g
  53. ' o+ j5 J/ \" g3 Y5 {0 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " x0 ~+ n5 K" y8 [: K* z: C
  55. #define STATIC_SHIFT                36 h6 H& d0 W) w; _
  56. #define TCINTEN_SHIFT               208 N. T5 P/ I# k
  57. #define ITCINTEN_SHIFT              215 H. |' I6 {, H# L1 e. r6 d
  58. #define TCCHEN_SHIFT                22/ s! L" a% o9 W* i4 E  ^! j
  59. #define ITCCHEN_SHIFT               23: G, H$ O4 N& e  k& i) A" w

  60. 5 T3 u, g% ]0 K2 H9 ^/ R+ m
  61. static volatile int irqraised1 = 0;
    0 I7 O1 h+ D( `5 P
  62. static volatile int irqraised2 = 0;9 C! r" A  e+ ]7 f

  63. 1 t9 k+ c7 e! B/ m* A% H0 r( z5 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 L9 w7 C$ h- Z/ g/ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + H! t/ V' J5 B( T+ T0 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " D# ^; O( N* [5 q2 l( J7 i
  67. . \0 F' @- ?* S4 d) o4 O) f8 s$ c
  68. dma_addr_t dmaphyssrc1 = 0;
    2 E4 \- [7 j! J- H
  69. dma_addr_t dmaphyssrc2 = 0;
    9 k/ y6 I3 p1 v  h# ?% i- Y
  70. dma_addr_t dmaphysdest1 = 0;$ S  i. h$ q5 N  I6 ^2 j7 E
  71. dma_addr_t dmaphysdest2 = 0;4 S4 ^" L. E+ e8 R7 S

  72. : f5 Z9 U8 {$ _1 S! h/ I- p0 \- K
  73. char *dmabufsrc1 = NULL;
    3 |) z; v- P) J- a* ^4 V
  74. char *dmabufsrc2 = NULL;
    0 ?  |' E2 Y$ k3 h  E3 O+ @: m
  75. char *dmabufdest1 = NULL;1 t5 P1 ]3 J% f1 ?3 `' a2 q% Z* E
  76. char *dmabufdest2 = NULL;
    - e) Z0 k, e( |/ p- L# o; Z" S

  77. 3 j# z, {0 P# O  h( W' ~
  78. static int acnt = 512;5 I$ E* g+ Q1 j! E9 ?
  79. static int bcnt = 8;
    $ Q; i; d- ~% K( c( \' y
  80. static int ccnt = 8;
    ! c6 d( ^7 x9 D: i% X
  81. & Z8 j7 A8 A9 u* g8 ^$ `
  82. module_param(acnt, int, S_IRUGO);$ b. O# ?6 ~1 r, d5 ^/ r: e
  83. module_param(bcnt, int, S_IRUGO);
    # G- y3 A* s6 p' T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# O2 P/ e, z! x3 ]0 Z* A5 M
& u& v/ j8 |4 Y' K" v& ]  O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ A# K5 R- R6 q! {) t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# {! h" g" M) q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ~; x: B  R, d2 v: R  h9 s0 ~
5 t/ H2 J+ _& H% R8 l$ Y
3 k, d3 m: U, ^% M. @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 11:20 , Processed in 0.040550 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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