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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, w+ x! ]' m: d* U
  1. [code]EDMA sample test application4 J7 w& O9 f2 N) X! q; s
  2. /*) k/ r( X! N$ Z) [9 @
  3. * edma_test.c
    0 W: _! L/ P/ A' n$ S( i1 Z
  4. *" e# ~8 X0 x4 N' V/ C
  5. * brief  EDMA3 Test Application/ C3 d0 g, u+ a
  6. *- T: b( v: f6 m6 \  S2 r8 \
  7. *   This file contains EDMA3 Test code.! i9 q; x, h4 P, ]+ R
  8. *  f) r: g5 y& A+ Q1 {+ O6 E" X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! d; K9 j( x/ u0 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; d+ |- P* R/ [
  11. *         TO CHANGE.
    - ?, L/ T' h. m
  12. *0 s- a% Q  B% @+ y6 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 n. K1 T# K7 E; k; j0 @
  14. *# p# q9 `; r0 s" f2 ]
  15. * This program is free software; you can redistribute it and/or
      u6 ]2 D0 N2 i
  16. * modify it under the terms of the GNU General Public License as
    7 _" y! v* m& W$ c9 v
  17. * published by the Free Software Foundation version 2.
    5 }7 N4 b+ N& Z4 B: \
  18. *" o1 C* q  [2 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      s+ Y! n- w4 k
  20. * kind, whether express or implied; without even the implied warranty
    2 q0 R  f% Y3 D4 W; d# b. _9 D% C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * R! w7 T) l7 {" l4 G, K. T: q3 ]
  22. * GNU General Public License for more details.4 r; |' S9 {* ^6 _) [
  23. */
    3 e* Q/ n4 V" ^: S0 G

  24. # _9 z7 X/ r1 _3 h% ?$ E
  25. #include <linux/module.h>! |* C! C( w* A4 u! ^
  26. #include <linux/init.h>& S; l, c+ Z+ L. k  D" o- l: L
  27. #include <linux/errno.h>
    / i' Y8 H. l! I4 \( F9 f
  28. #include <linux/types.h>7 d; b1 y: z' N
  29. #include <linux/interrupt.h>
    " ~: h& R, u  S9 }/ w+ H4 g" G2 m
  30. #include <asm/io.h>
    4 o2 B% t5 w* r$ i
  31. #include <linux/moduleparam.h>" ?$ r& i1 l* o  @; O6 B
  32. #include <linux/sysctl.h>
    - w; V; t# k& h1 Z/ z
  33. #include <linux/mm.h>0 ~4 P+ _) \/ @' Y6 {  m* b
  34. #include <linux/dma-mapping.h>
    ' {" @' r9 j: R: M1 i

  35. 4 T8 {) S6 q3 Y: C5 }7 D: h# v
  36. #include <mach/memory.h>
    2 i, Z1 j0 S) s& _* Y9 e* p
  37. #include <mach/hardware.h>- z9 I/ N2 ^- {! R
  38. #include <mach/irqs.h>% A: W2 u1 B+ i% Y
  39. #include <asm/hardware/edma.h>( Q5 F! `6 g8 ^/ b2 D. R+ z5 U

  40. 9 O  |3 p$ ]% R+ f  g
  41. #undef EDMA3_DEBUG
    ' t& Z' M0 B$ ]9 h. i; J* N' N" C) m2 U
  42. /*#define EDMA3_DEBUG*/, S  D  X$ g* z# I

  43. 3 J2 F4 D/ I) v( p
  44. #ifdef EDMA3_DEBUG" O  V9 B* t3 a5 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 K# {, Z' \5 q2 p4 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* W- P' Y# O9 B- ~/ v& B# u: c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ?. S' G3 |9 K5 f- d6 L1 V
  48. #else
    - m, N# Z: ?9 S4 X: d  t
  49. #define DMA_PRINTK( x... )1 [  w) r# p5 k1 p' |) s: I
  50. #define DMA_FN_IN' z7 h, P& e1 b, ?( w3 `2 W
  51. #define DMA_FN_OUT
    + G: Y. V8 K/ ?+ }9 i
  52. #endif0 A  k) ]5 j) x2 }' W
  53. : ~  y% Q# F3 M9 w! X- s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # O. p1 A6 G, m% P  I& A; E
  55. #define STATIC_SHIFT                3
    , f- R+ F$ b8 r6 [9 F2 z
  56. #define TCINTEN_SHIFT               20# m& V* W" g! b7 Z* T
  57. #define ITCINTEN_SHIFT              210 `. C% p( o. T  Z) s; T' L. ~
  58. #define TCCHEN_SHIFT                22
    ) O& d3 k" @# d) w1 o2 i( V7 z+ ~
  59. #define ITCCHEN_SHIFT               23
    6 N4 \" t/ J6 k& `) J% v

  60. % m8 u" Q! R7 G6 x( M  x8 U; @
  61. static volatile int irqraised1 = 0;
    7 W- ^' G1 Y; q. ^# T
  62. static volatile int irqraised2 = 0;
    0 c$ I1 }; @; [
  63. 3 a- c% ~' g# T  z& J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 W8 ]. P, ], k0 U5 ], a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 r7 H4 ~1 w* [& Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, W- n% K# ~& p! Q; k+ }0 ^7 j
  67. 0 @4 c  h, E, U
  68. dma_addr_t dmaphyssrc1 = 0;( ]$ L0 F, v5 C7 J. \
  69. dma_addr_t dmaphyssrc2 = 0;
    % Z8 {# D2 M: \: E# l2 G% [# B
  70. dma_addr_t dmaphysdest1 = 0;8 |7 M/ Q$ d7 e
  71. dma_addr_t dmaphysdest2 = 0;$ B. t5 C& f; F, N5 O* V

  72. * B+ ?2 s; Y) M: y7 j: T( b
  73. char *dmabufsrc1 = NULL;
      G- t& ]; E; L
  74. char *dmabufsrc2 = NULL;
    6 a8 _! {5 ?4 ?8 ~9 N8 ]
  75. char *dmabufdest1 = NULL;& d& _, A$ S4 V5 {& h% Y+ s
  76. char *dmabufdest2 = NULL;
    1 Z& N2 h. v: O) H& y6 L2 n' i7 x

  77. ' N$ d; Q8 \5 D- b
  78. static int acnt = 512;) u* s7 r6 w- c
  79. static int bcnt = 8;
    ' S1 x! V! d. {8 }7 L
  80. static int ccnt = 8;
    8 J6 o' }5 i2 Y; v: _' p
  81. % M% e7 G" h  V8 L* V, Z
  82. module_param(acnt, int, S_IRUGO);
    & d% ]" k% p' y" ^+ f$ X. ]- s" v
  83. module_param(bcnt, int, S_IRUGO);0 [2 w# I' O; A5 U8 d& }+ F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- T0 r+ g, n8 d! b8 {. i
5 [+ P5 s  n8 U+ l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( \: G) J5 b! s4 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 T- p& O. J  A4 K0 _4 d  O: I/ ?' r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Q3 l# A1 P9 I/ n8 p9 e# \
" ?( P, Z+ t# \
! A8 W6 H8 {( A0 S- J$ C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 17:11 , Processed in 0.040140 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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