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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- Y& {; |/ x9 V+ _
  1. [code]EDMA sample test application
    - }# `( c8 c6 S' i
  2. /*, z' p9 k9 e# [" D
  3. * edma_test.c
    : o. |7 ~/ a! [: c
  4. *
    * ~$ ?  t( L: v" P0 U
  5. * brief  EDMA3 Test Application
    " I" _; v% f7 w3 X# G& s
  6. *7 C7 ?) g: K0 A6 n4 k$ o
  7. *   This file contains EDMA3 Test code.
    ' h2 T! a" P* s
  8. *
    ' {6 H% d4 Z5 t5 Z* Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 K$ M: }; S. I, |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, K4 R7 N  S& }2 D; R; y3 B& u, x. c
  11. *         TO CHANGE.% \; D& ?" A+ F; L, C( K) y
  12. *
    3 `: \) }! z8 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 @  m$ p+ q6 {+ k& u( ~6 p5 ?+ M
  14. *
    1 `, S' Q: K1 A/ Z
  15. * This program is free software; you can redistribute it and/or
    " Q3 u+ Z! o6 M4 B5 E% w; k
  16. * modify it under the terms of the GNU General Public License as
    ; y  ~: M) h1 Q1 F8 P
  17. * published by the Free Software Foundation version 2.$ O/ ]: {, h2 @* Y
  18. *
    ; S) h4 A$ ^8 [0 Q1 {! B6 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ }- @+ a+ J. ^$ r- \* _( g
  20. * kind, whether express or implied; without even the implied warranty9 E% q9 C" m/ n0 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& P  G0 x" U  [9 Y
  22. * GNU General Public License for more details.) M+ w0 e: ]. W  K7 q
  23. */
    2 y' O  p# l9 i' J: C

  24. ' @  E' f9 _- f+ t
  25. #include <linux/module.h># S& k, Q0 N  n& R9 U
  26. #include <linux/init.h>
    ! f  y6 D6 H4 q0 d7 U, ?! B- i
  27. #include <linux/errno.h>
    - @# d3 n+ ?% p: P. O
  28. #include <linux/types.h>. I+ b# j) F; z8 M0 }8 n) [
  29. #include <linux/interrupt.h>$ m' ^% Q6 b3 ^* H7 x
  30. #include <asm/io.h>
    6 h2 Y  I3 Z  {3 e! m* u
  31. #include <linux/moduleparam.h>
    , d- A9 A. P" _9 K) a( Z0 [
  32. #include <linux/sysctl.h>8 g. x" E3 l- h% c/ i1 D0 F& F
  33. #include <linux/mm.h>
    - }/ X# Q2 ?9 R* q! T
  34. #include <linux/dma-mapping.h>0 }& `7 A9 i! M) K$ S- w- ]

  35. 7 w, X: i( W' a1 l, b& l
  36. #include <mach/memory.h>; h# K  i6 c# j
  37. #include <mach/hardware.h>
    ( \# f6 Q9 a3 r9 P! N
  38. #include <mach/irqs.h>
    . l9 s7 A% l0 N+ P  L5 ~
  39. #include <asm/hardware/edma.h>* B" f( p2 j! ?' z- y. t+ G
  40. " c2 Q! C! c; `& U6 f# ~6 v3 G
  41. #undef EDMA3_DEBUG3 J( `6 `8 V% p7 B5 N- b4 h
  42. /*#define EDMA3_DEBUG*/, d: [" ~  C  }5 ?" W! D1 {2 N, T

  43. 4 @; U9 N4 z7 m# `* F% D
  44. #ifdef EDMA3_DEBUG
    : S9 w/ Z" x- I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 r5 @0 E7 F. V: @. Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# E8 T4 P! h' G9 G: o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ @2 \# p) T# k( J  C
  48. #else2 _6 t! C. u$ h
  49. #define DMA_PRINTK( x... )
    ; L' d) l' b  O) A- N1 q
  50. #define DMA_FN_IN. H  R& g$ T4 T: x: v
  51. #define DMA_FN_OUT
    # F. ?4 ~/ t9 l0 F& w$ y
  52. #endif
    " K. d4 F4 z8 j9 F3 f

  53. 9 M7 Z4 v" j) E2 N# c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 B7 H7 s. m- I$ q1 C$ q' w
  55. #define STATIC_SHIFT                35 C, x; D. U1 W) Y! O- Q9 |
  56. #define TCINTEN_SHIFT               20: n  j) o1 T: q* B* h9 u
  57. #define ITCINTEN_SHIFT              216 C6 l2 A- n5 c, ^# m
  58. #define TCCHEN_SHIFT                22
    , `5 k1 E8 N6 g9 V; \
  59. #define ITCCHEN_SHIFT               23! z% J9 n  d$ B) A; w
  60. % u; k: d9 C/ l
  61. static volatile int irqraised1 = 0;( t5 I5 b  u2 G4 j
  62. static volatile int irqraised2 = 0;" b$ |6 r1 H9 D+ I. i
  63. / R3 Q! f0 E, Z+ E4 o4 A* A% ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T7 V0 t' Y' G* i' a* L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t! @5 u& T: ~) X: R& U: o! @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~( v) E9 [7 d8 c7 [
  67. , c* z0 h, n+ @) Q: S* I& [1 I
  68. dma_addr_t dmaphyssrc1 = 0;/ D: N$ g6 }& e7 C
  69. dma_addr_t dmaphyssrc2 = 0;! |: N! u# c2 g! ]
  70. dma_addr_t dmaphysdest1 = 0;8 L3 c/ l) ~' Q, j
  71. dma_addr_t dmaphysdest2 = 0;- E& Y8 R; H* \/ O0 H4 v% U
  72. 3 [" I, v' ]- T) U8 E8 k
  73. char *dmabufsrc1 = NULL;% U6 G2 O1 Q% U4 F* e
  74. char *dmabufsrc2 = NULL;( [3 t- q7 }5 W0 K2 l% i: V% k
  75. char *dmabufdest1 = NULL;
    . y# l- Z5 ]% ]# ]- A! B
  76. char *dmabufdest2 = NULL;/ V. Y( ^; c# R

  77. 0 c* ?$ v0 S3 w9 z$ H2 x9 N( g7 p
  78. static int acnt = 512;8 M/ h/ q: H: a; Z
  79. static int bcnt = 8;
    7 v( v0 X* p/ y; ?6 X
  80. static int ccnt = 8;
    $ t1 E: e8 P  D9 T/ K
  81. : T- s0 r+ `) E& N% m$ i5 {7 D
  82. module_param(acnt, int, S_IRUGO);2 a0 ^9 e" g0 U9 ~- p! e
  83. module_param(bcnt, int, S_IRUGO);( o& v9 @8 J( y3 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( x( U5 U2 ^4 v( x0 O- i! |0 u5 G
' k2 F: i6 k. a+ T. G% c+ y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. ]9 ^- }5 H( e. C9 `1 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 l, Y8 V4 }, V8 p# j/ a" e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 U8 W5 h' _& ^! u- g# H
. _8 U7 Y7 x/ B- S5 |# a) Z0 ~6 E2 t6 ^. Y+ @& K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 19:54 , Processed in 0.039389 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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