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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 h6 b! c7 _+ \
  1. [code]EDMA sample test application
    1 ~. F: M. p- U* }! J( S
  2. /*  i4 @% A# T1 o, E( u! }
  3. * edma_test.c' O3 ?/ n8 ?* R$ k+ Y
  4. *
    5 C/ h) j' E/ \
  5. * brief  EDMA3 Test Application& k- y6 T. W, X. ~: p$ c
  6. *0 J6 e" r* u% [' j8 x
  7. *   This file contains EDMA3 Test code.$ p" s/ k: r- X* G( R4 X
  8. *
    : Z  C: v# I* v, X* U1 ?# F3 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 w& l4 x4 u& X  C! E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 O7 x/ d7 y' ^
  11. *         TO CHANGE.
    " z6 Z4 l" P$ q, r* U
  12. *
    % X3 l0 {2 m  s% U, B& O' P; T" C; ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" D& D( [2 e0 l5 j: z5 ?. }
  14. *$ C7 {4 A6 |9 p
  15. * This program is free software; you can redistribute it and/or* s5 Y# O# C$ ]
  16. * modify it under the terms of the GNU General Public License as% T  G( P3 j8 o; }# T: C2 B
  17. * published by the Free Software Foundation version 2.
    : k7 s) x5 ]/ y$ d6 Z& n3 H
  18. *
    ' e9 S2 B  ^) @" T- t: ], Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 r/ J8 q2 y8 ?' e3 j
  20. * kind, whether express or implied; without even the implied warranty
    - D4 s2 m  N7 F3 w0 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ T0 ~* D3 _2 K3 b1 ^+ W1 J
  22. * GNU General Public License for more details.3 ^3 A: A+ ~3 r- L
  23. */
    5 S  q  o; p0 a

  24. 2 H5 B- \" z# E6 ^
  25. #include <linux/module.h>
    0 @6 S* Y- u7 V
  26. #include <linux/init.h>
    , U+ J* q, {8 H5 P4 m
  27. #include <linux/errno.h>' C0 J% n7 e# t; c+ ]4 k2 `# t
  28. #include <linux/types.h>
    8 j) G; w. S/ r0 {7 v
  29. #include <linux/interrupt.h>
    1 V' o5 p' `/ x
  30. #include <asm/io.h>1 z) C$ g; m2 Y$ ^; s
  31. #include <linux/moduleparam.h>
    * N6 j, B$ H2 g# f3 E2 E- `' I
  32. #include <linux/sysctl.h>5 n6 B9 m) A8 K5 @  U
  33. #include <linux/mm.h>
    0 t* t9 n  i3 ^
  34. #include <linux/dma-mapping.h># i* j0 C* A! n$ G

  35. 4 a; Q- J7 k' M) y2 Q* m( A1 Y) H
  36. #include <mach/memory.h>
    . ~( i7 ~8 g4 y2 `$ p/ ^( u8 B- {. K
  37. #include <mach/hardware.h>! S# P* n. L3 {7 y. [
  38. #include <mach/irqs.h>0 Q- X9 B* x! a" ^
  39. #include <asm/hardware/edma.h>
    7 ?. P' W3 @, q0 k( {

  40. : k$ A8 v3 P. S2 H& Y! B/ k
  41. #undef EDMA3_DEBUG, ?! I7 t, q6 L" R2 F( t& L% c  ]
  42. /*#define EDMA3_DEBUG*/
    ' c! q' E0 C  U! F. D4 D. M

  43. + k9 y9 A0 h: I
  44. #ifdef EDMA3_DEBUG
    ) g7 M# v6 j7 E" a( N7 m. [7 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  m! J6 q! N  m; g( x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; X) y! h, C, U3 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # @  @8 L( Z0 w3 {
  48. #else
    , P1 h; ^7 w5 H# X2 ]' ^
  49. #define DMA_PRINTK( x... )
    - R4 j% y0 w4 {3 i
  50. #define DMA_FN_IN3 |. A' c9 S1 f1 u% A2 r5 V
  51. #define DMA_FN_OUT
    ! N+ q" }1 ?: j* V; R! X8 P
  52. #endif! |* F! m5 E: R! @
  53. ; m0 M+ A) B, z2 c+ S5 C: E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 z8 J1 M" K8 a' ~1 g/ H% T" C
  55. #define STATIC_SHIFT                3
    ( z. ]3 K+ S) d( Y! l
  56. #define TCINTEN_SHIFT               20. W4 c9 e+ x0 ]0 \
  57. #define ITCINTEN_SHIFT              21
    + Q3 h5 g" ]) K5 G5 s4 J  I8 I
  58. #define TCCHEN_SHIFT                228 A6 L, g; [5 d7 ~
  59. #define ITCCHEN_SHIFT               23. e1 i! q$ [- b. B& W+ J1 q3 a
  60. , f+ c, Z, d9 m2 h% D# e
  61. static volatile int irqraised1 = 0;" Q+ i6 @9 k* m4 ]6 U
  62. static volatile int irqraised2 = 0;
    ( w4 U9 E: _3 K" J- @
  63. 7 x0 w  I! Z( l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : [4 `: a0 ]- Y4 K# e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N6 {3 k, Q4 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + [9 U& U+ x3 `
  67.   ~7 W& m+ w/ t$ q2 m: k- i
  68. dma_addr_t dmaphyssrc1 = 0;3 N9 [# y& [1 ~# B% _4 S6 V
  69. dma_addr_t dmaphyssrc2 = 0;: C0 A% R$ x! _
  70. dma_addr_t dmaphysdest1 = 0;
    ; N5 u6 K* V) B" h, h
  71. dma_addr_t dmaphysdest2 = 0;' r* t! p6 ?0 C: B7 ?( Z7 J' }

  72. 2 R3 y. W2 k+ \$ u$ [
  73. char *dmabufsrc1 = NULL;
    ' |$ t0 z, L0 |0 O$ E, j9 q
  74. char *dmabufsrc2 = NULL;
    1 S# f/ s8 s  l- {
  75. char *dmabufdest1 = NULL;* i! E. W8 j# ?* |8 N
  76. char *dmabufdest2 = NULL;
    / t3 H2 m8 l" J  n' c

  77. , W( _* p5 ~. G( W6 p
  78. static int acnt = 512;
    : U# e, |- B- a0 \9 n% I. F/ Q
  79. static int bcnt = 8;- ~8 N1 ^$ ?& q# I* x! @# p
  80. static int ccnt = 8;" ^/ T1 B  n' w* T$ `8 W

  81. 3 g+ |% p$ a8 T1 @; J
  82. module_param(acnt, int, S_IRUGO);. p# g$ @' a" h! n7 D% ?0 \
  83. module_param(bcnt, int, S_IRUGO);  b; O8 g2 q/ E  S0 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 R5 K+ C9 D) i# J7 S
# v* f1 B6 I! h  Z# J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 k) r# \* u* C% o: b; V" I+ r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ @% _6 `' y, D# x+ ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ Z/ |' e6 G& \2 i5 \; d
% s9 k1 s& Y/ z% @
7 s& o4 s- Q# Z; k) U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-17 04:43 , Processed in 0.047241 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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