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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 O* J8 B' U: T- h+ Q1 d$ ]
  1. [code]EDMA sample test application$ x; E* D. \* Q
  2. /*
    3 a- K" f- R# ~- `
  3. * edma_test.c
    % s! P1 J$ K! p. {' r
  4. *
    ) C- g" h1 ^* G% I. p6 _
  5. * brief  EDMA3 Test Application
    ! V, B8 W1 d2 M4 T" w' ?
  6. *  W5 X8 X9 [/ P* i
  7. *   This file contains EDMA3 Test code., M4 h4 ^6 v* B/ Z
  8. *) C! `+ {1 Q% ]" T3 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: X3 I/ w5 F8 e" [+ h; a; h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. g# g; E, {1 K( y
  11. *         TO CHANGE.
    7 o3 g: ^, x  A) ^
  12. *8 }& u" D9 L8 }* v* @# z# C. A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 I$ m: U, W+ W. A
  14. *, w/ U* F7 G9 a% T; `6 E
  15. * This program is free software; you can redistribute it and/or* g7 X# ]3 F1 A% s8 Y, }, {  S
  16. * modify it under the terms of the GNU General Public License as
    " c4 D8 F) y$ V
  17. * published by the Free Software Foundation version 2.
    ! F" |- _3 k6 G/ h6 w& K' e" x$ P
  18. *
    . y( J6 }( l0 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 A( ~5 K! ^/ c& t+ y
  20. * kind, whether express or implied; without even the implied warranty: R  U) H% Q: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 w0 a. v" b9 z0 ]5 V
  22. * GNU General Public License for more details.
    $ B! l/ y3 ?8 o+ M0 L0 e2 h
  23. */; b  ^8 N/ Y8 I6 m/ @) N
  24. 0 f* h4 t+ i% S
  25. #include <linux/module.h>
    6 o  [1 J; _# S4 F9 k5 v  R1 u
  26. #include <linux/init.h>
    4 g% Q+ r+ ^. Y) \
  27. #include <linux/errno.h>: |: l' T9 l. C8 j( Q/ e; W; \
  28. #include <linux/types.h>
    / t* E1 e% ~# D! v
  29. #include <linux/interrupt.h>
    % e' n  r* ]# q4 S+ @7 N, p: k- U& D
  30. #include <asm/io.h>
    ( ?) N" D$ ^% h" }
  31. #include <linux/moduleparam.h>& z5 b# v  a2 ^2 e
  32. #include <linux/sysctl.h>
    2 q+ U' C, ~( X) d9 B, @6 d
  33. #include <linux/mm.h>5 c/ i3 o1 x' }' l$ B" j8 j
  34. #include <linux/dma-mapping.h>) ^9 L8 q% u& r9 O6 a& m2 B# x4 O

  35. 3 g2 T. C5 ]+ Q+ T  b6 _( T6 u
  36. #include <mach/memory.h>6 E5 i& D- h: l3 t( D7 B
  37. #include <mach/hardware.h>
    1 b7 @; a1 _8 }6 r6 z
  38. #include <mach/irqs.h>( @% @$ K. G: \! M# T  W4 s
  39. #include <asm/hardware/edma.h>
    3 i/ k& T7 Q- M
  40. 7 j1 `% A& ]& Z7 Y; G
  41. #undef EDMA3_DEBUG
    8 U; C( C5 N9 I2 Y
  42. /*#define EDMA3_DEBUG*/5 _# t" p: B3 E* l7 g6 U0 d7 X! [$ ~
  43. # D# A( {9 y3 g; s/ `# ~7 ]( G; c+ x
  44. #ifdef EDMA3_DEBUG
    , [9 j+ _; X. l# U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 Q2 A- W8 S% i2 W3 y9 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* U- \7 q. Z4 d) t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' @8 Q. x6 S- a7 x, n
  48. #else6 w5 `' _+ c7 y
  49. #define DMA_PRINTK( x... )( d7 ]" s5 t+ e
  50. #define DMA_FN_IN8 {6 C! ^$ O( k6 N1 k
  51. #define DMA_FN_OUT  m$ w7 h# R, s# u: O
  52. #endif! C7 I& B0 `; c

  53. ) Y0 I/ ?+ U, I( U: S% Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# ^! p3 P# Q9 X: t% T
  55. #define STATIC_SHIFT                3
    ( G0 ^: a6 R: R# x! |$ E
  56. #define TCINTEN_SHIFT               20- n+ B% o' P0 W
  57. #define ITCINTEN_SHIFT              21. e6 \- O/ [! _  J. p2 |" i: S5 q! Z
  58. #define TCCHEN_SHIFT                224 K- ?' I* u( u
  59. #define ITCCHEN_SHIFT               23$ s8 K9 q* U7 {9 r$ ]( l

  60. ! q* E1 N0 E' ]1 Q- C
  61. static volatile int irqraised1 = 0;
    9 \, w! z8 Q% f) g* N
  62. static volatile int irqraised2 = 0;# V5 k7 |2 i8 n7 Q

  63. ) B( i: w" \+ x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) f  c# \6 ]% `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " X# X/ u! k7 P8 j, J+ t: I; S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `1 x& O- b; m4 w
  67. 0 B7 `; i: T5 ]& Q  f4 _) u
  68. dma_addr_t dmaphyssrc1 = 0;
    + W4 H( o* _0 v
  69. dma_addr_t dmaphyssrc2 = 0;
    . A* B+ g0 z6 I; O- l
  70. dma_addr_t dmaphysdest1 = 0;
    ) g* @& y1 O& [
  71. dma_addr_t dmaphysdest2 = 0;- {% q! f& Z# n" r
  72. 1 T1 l8 f$ Z+ E+ o& `
  73. char *dmabufsrc1 = NULL;, F" F& v2 u$ |( C, S4 V' x9 ]
  74. char *dmabufsrc2 = NULL;
    7 |' }: x0 B7 _
  75. char *dmabufdest1 = NULL;
    8 [* e" Y/ ^) @; t& e
  76. char *dmabufdest2 = NULL;) h5 Q+ J1 l- S; }
  77. & v* |$ Y$ V* [( O
  78. static int acnt = 512;
    ( ]2 S$ T* T/ {9 r  v( b& M- V# c
  79. static int bcnt = 8;
    , s6 G( }% u0 w* h
  80. static int ccnt = 8;
    3 [1 I. _0 {3 V0 w2 L* y8 w( i

  81. 0 [8 b0 Q* |8 y/ {' U7 y) o
  82. module_param(acnt, int, S_IRUGO);
    - Q7 ^2 M+ p9 b0 S) G
  83. module_param(bcnt, int, S_IRUGO);' C  Y% d+ j5 g: B! j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( b& Y7 E4 T: f: g0 p4 ]' |9 y/ O4 C, J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ X3 x$ D$ x! I5 @  x& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: q- z+ c' p2 ]) R9 {. `6 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 v0 _; K+ b* ]- R, r& I, {1 y
# }9 i0 N  _& k0 }6 Q
# r! ~8 K1 ?4 M; C: u: ^  Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 01:37 , Processed in 0.039338 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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