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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 P' V1 R: M5 c  u9 K. X8 v
  1. [code]EDMA sample test application
    9 x( a/ T( M5 L; Z; ~
  2. /*- ^+ t5 p! i" @
  3. * edma_test.c  n) L9 ~& b7 y4 s) s
  4. *
    ; {. M3 X( ]5 e1 D* D* @- u+ g
  5. * brief  EDMA3 Test Application" n% a1 I7 s* o! b+ E! Z, o* w
  6. *' L9 C* Y) A# g3 m
  7. *   This file contains EDMA3 Test code.  f1 E6 q6 e- ~/ r* _, o2 T- r
  8. *; \. |# S1 Q, v2 u1 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 x# g9 S5 p( Z3 u( x3 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) Z" H2 `' I. O
  11. *         TO CHANGE.
    9 o1 M' v, a3 B+ I1 p
  12. *4 P% Q, E, R8 p& Z) S6 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ z2 ]+ C( X! a% g
  14. *9 \3 u9 {- {; T9 D: D$ r
  15. * This program is free software; you can redistribute it and/or
    - R  i/ L& V) l& w; X
  16. * modify it under the terms of the GNU General Public License as- P' I1 n/ q* }# a
  17. * published by the Free Software Foundation version 2.
    * f& F- p* U, ^5 l3 ]
  18. *. l: Y$ ^7 k3 R2 K, x* e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * j$ j* ?" X- D( M; n
  20. * kind, whether express or implied; without even the implied warranty
    7 ?) u8 x: B( K( W. Q  `+ o0 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . }1 u' ^1 E3 c/ U, R
  22. * GNU General Public License for more details.' J# b% Z8 Z3 Q  s' H
  23. */
    # E1 c* G9 o2 [
  24. 1 x7 M# J" j6 E2 k
  25. #include <linux/module.h>
    4 B  }+ m- @( x" _+ c
  26. #include <linux/init.h>
    6 A6 _; P: P* t" r8 l2 W
  27. #include <linux/errno.h>5 }: ~# f  h' `
  28. #include <linux/types.h>& G: k2 B( @/ x% d; z3 \* O
  29. #include <linux/interrupt.h>/ a4 o/ K1 |6 U0 P3 q' h4 g
  30. #include <asm/io.h>
      U( ]/ b# j: V- p/ i6 f# E
  31. #include <linux/moduleparam.h>
    9 ?3 F. h/ N, M% J3 z- `
  32. #include <linux/sysctl.h>
    6 o; X% s+ R4 y3 }& p- Z
  33. #include <linux/mm.h>
    / a& y5 r5 V! W: V+ ^; ?
  34. #include <linux/dma-mapping.h>7 Y* `5 m6 f9 s: r1 d
  35. : N$ {  w9 z( O0 M- [* m
  36. #include <mach/memory.h>
    0 c8 C' y$ G# _% S2 Z/ c# v3 \$ N/ X( o
  37. #include <mach/hardware.h>" b+ ]8 C5 t7 d1 W
  38. #include <mach/irqs.h>* {6 G2 U9 ^* f7 M8 J9 T2 Y% ]
  39. #include <asm/hardware/edma.h>! Z- S& o+ q. T; ]- j( ?

  40. . \3 }4 d/ T# C8 w# |) }
  41. #undef EDMA3_DEBUG- W8 ~5 w% r7 [4 q, H( _- I
  42. /*#define EDMA3_DEBUG*/& n. @/ p4 `6 ~6 m% J6 W- b
  43. 3 ~: Q" i/ l' V* i& e$ y' `" h
  44. #ifdef EDMA3_DEBUG
    7 e9 y% q0 }' C) h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 o5 H4 O, n7 h9 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      \/ R8 U9 F, }2 Q8 I$ J  I. A. G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' L  r! T4 H" R9 t; ]
  48. #else( _* l' P7 f4 R4 |9 X* @4 P' ^4 v
  49. #define DMA_PRINTK( x... )$ ?6 I' @6 b7 l8 H
  50. #define DMA_FN_IN
    + s/ k0 E0 J6 T" G9 ]7 l, u4 b
  51. #define DMA_FN_OUT' B4 f! B1 n4 f( O# a
  52. #endif/ g( w; J) G+ f$ j+ ]

  53. 1 `' q7 ?+ u  {1 p! z6 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ C# N# |: n' V1 d9 {! x
  55. #define STATIC_SHIFT                3
    ' Z6 D: B& q% e' I1 Q3 L; c# L$ Q
  56. #define TCINTEN_SHIFT               205 @! Q3 L7 F# K4 U7 V
  57. #define ITCINTEN_SHIFT              21
    % V3 I0 a$ u! k( A# Q! W% o
  58. #define TCCHEN_SHIFT                22
    , ~! P' E7 ]0 X) b' w$ H5 A
  59. #define ITCCHEN_SHIFT               23' l- f9 l4 N- P# A0 B9 a5 H$ @& y
  60. * o2 R. L" v5 s: e. j) z# Z
  61. static volatile int irqraised1 = 0;1 J2 `5 a' r+ o9 R3 ~* N9 X
  62. static volatile int irqraised2 = 0;
    0 }3 j% _/ A' W0 |% ^

  63. 8 I3 O9 [1 I! s. V, e6 s! L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y/ ?) @) S: {7 M. f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + Y# z5 ]' C# _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 D. C+ H, y  y4 K' N( p

  67. 8 C0 @+ C3 O6 Q9 {
  68. dma_addr_t dmaphyssrc1 = 0;) A1 ~* K6 A& X% ]1 T
  69. dma_addr_t dmaphyssrc2 = 0;
    , @% Z; c7 @. ~* c
  70. dma_addr_t dmaphysdest1 = 0;9 ?% d# _$ @' D- I7 W$ c. F
  71. dma_addr_t dmaphysdest2 = 0;
    / K# _! m! z! a/ Y
  72. . y  t0 n# u, d+ ~* e& t, g- Z
  73. char *dmabufsrc1 = NULL;& A4 U1 ?! u: E( \5 _2 z- O
  74. char *dmabufsrc2 = NULL;
    - F+ n% V- c. b6 ]1 T
  75. char *dmabufdest1 = NULL;
    ' E& B% R0 ^( i; W
  76. char *dmabufdest2 = NULL;
    7 x) I8 z0 _+ E) _1 u! C0 s: R' K& ~

  77. 1 j5 w( }" Z4 V% v) w2 k
  78. static int acnt = 512;% {1 K( f% b4 J- J5 j
  79. static int bcnt = 8;
    : b. H+ d2 _0 R5 r% y2 f# y
  80. static int ccnt = 8;
    2 t: p: U5 B) }
  81. 3 i2 e$ u4 s, E7 y4 p0 H
  82. module_param(acnt, int, S_IRUGO);
    2 ]! n# f& E' M1 G
  83. module_param(bcnt, int, S_IRUGO);% P) g; e' _/ w' B: i/ \8 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 ~. T4 A! j6 m0 [* V! L# W
8 d6 g9 v+ A# v, t- ^' H9 j' |1 ~$ _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 U8 ~, Y: W# Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 i: x7 ]; h: j1 G& X' K' C* `- q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {) y8 A9 }1 d2 k" D

( F( q6 ~6 N+ [( a' B% F
: w- z2 w+ Y2 u2 q. O5 Y# E/ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-26 05:54 , Processed in 0.044887 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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