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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , b- ]5 s9 A% G, g
  1. [code]EDMA sample test application: ], z$ S' O: f+ ^9 a1 V- I
  2. /*
    5 e: B! O- e& }8 b
  3. * edma_test.c
    ' n& J0 z9 x; s0 [1 U1 S5 w
  4. *
    " P3 k  Z) @7 K: C+ q
  5. * brief  EDMA3 Test Application5 s& d0 @: t' Y0 E  [7 s
  6. *
    : x2 b: I6 ~' V& }# j) f, |3 D4 W
  7. *   This file contains EDMA3 Test code.0 d$ ]7 R( w5 r7 P* t
  8. *# c4 @! \. K. J4 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , v$ s9 D" m2 z8 ^; H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' a7 ?% ^6 U8 @: h7 \( r; x& q) r
  11. *         TO CHANGE.$ i* o" @  S! g5 M; b, r
  12. *9 P+ _, h2 j- R$ R  Y6 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ~* u& m0 ^" X! X  s) n- U. r
  14. *
    * Z# k8 d- N7 y9 K! f6 v, Z
  15. * This program is free software; you can redistribute it and/or. m, R1 [9 O9 u9 v+ o) p# Z8 g/ ~
  16. * modify it under the terms of the GNU General Public License as) `( Y/ |" Z+ I) \/ G2 a* O* r( B
  17. * published by the Free Software Foundation version 2." D3 p' c5 b; u
  18. *) A: s7 e; x7 [5 L4 [( v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - F: O: F) E9 S& [' W- H3 l
  20. * kind, whether express or implied; without even the implied warranty& P" s5 q- |& H, U' A  |' l/ C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 D  E: j0 k; R- h
  22. * GNU General Public License for more details.
    * |" |3 W9 T# B: G
  23. */3 V$ o+ x" v+ c, \9 t

  24. 4 w  ?$ P. I  b( {7 B* X7 x6 r
  25. #include <linux/module.h>
    9 T0 ~+ d5 K4 T" F
  26. #include <linux/init.h>
    + ^  |  `3 m* o- m
  27. #include <linux/errno.h>' d7 I. V& N( l  u9 e
  28. #include <linux/types.h>) G  Z8 S1 U; r3 z% Q, C
  29. #include <linux/interrupt.h>9 h- C, S8 W. A$ S5 I
  30. #include <asm/io.h>; i+ N8 ?% d- `* k8 @- \) z9 v
  31. #include <linux/moduleparam.h>
    " m/ s" @. U6 q0 A. l. T- t
  32. #include <linux/sysctl.h>
    ' J, `  j: V# y) a
  33. #include <linux/mm.h>+ v( j0 a% Y% f$ b0 u( o
  34. #include <linux/dma-mapping.h>
    8 U/ {2 Y; ~2 H- @$ }8 ~1 k& X
  35. 9 z! B1 b9 q& z: l& Q
  36. #include <mach/memory.h>+ e* g" d) Z9 W! P0 e) f0 Y9 @
  37. #include <mach/hardware.h>4 m$ ^; [; x' y
  38. #include <mach/irqs.h>
    ; y- i8 W0 o0 j
  39. #include <asm/hardware/edma.h>
    1 L; c0 C, S+ E3 `
  40. 2 R  f1 T/ X0 C) q1 H
  41. #undef EDMA3_DEBUG
    ) W0 Y5 |0 G1 o; e' ~# {$ @
  42. /*#define EDMA3_DEBUG*/# M1 G4 `9 y) {5 `

  43. 5 ~9 x+ P* E: T( `5 F% P" [
  44. #ifdef EDMA3_DEBUG
    9 a( d/ Q! H( z& ~% t& H! Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- f1 H8 z# d; R. E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( r' S. B4 m8 A- h! ^) A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 R2 i0 X2 w  w% H+ N" _2 h  e
  48. #else
    4 N" Z+ v8 q# v
  49. #define DMA_PRINTK( x... )
    0 K1 U1 \' u3 k1 y* h9 E! [5 m
  50. #define DMA_FN_IN3 f7 m$ t1 E# X# A+ L& m! Q
  51. #define DMA_FN_OUT
    ' \3 \( L9 ]' ^# \" A8 F! I
  52. #endif
    7 }/ H# L4 N. i

  53. ( y* S8 _% Q$ Y* j/ [7 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 R4 n' l- e; C% w( x
  55. #define STATIC_SHIFT                3
    ( Q3 A5 I5 _  ?6 S
  56. #define TCINTEN_SHIFT               205 ^* K8 z2 M0 j4 O& N3 E5 k
  57. #define ITCINTEN_SHIFT              21
    % `8 ^+ \. H  B4 @& a# V
  58. #define TCCHEN_SHIFT                22
    9 i. e1 x5 @0 {% Q' Q) Y
  59. #define ITCCHEN_SHIFT               23% V- D% E/ X6 d: Z

  60. 8 `; p8 Z8 u0 s; C5 Z8 F1 M
  61. static volatile int irqraised1 = 0;
    / E0 q* V8 I3 H) N
  62. static volatile int irqraised2 = 0;
    " a9 U7 [, z- E4 e# {3 H

  63. & B( \/ h. h8 B1 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C2 S. x( {0 `5 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M. o7 y! h+ H! Z2 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # Y: f2 G: J7 l
  67. , `' W) a' `8 m2 ]2 X1 `
  68. dma_addr_t dmaphyssrc1 = 0;
    6 z. b6 J$ H+ x
  69. dma_addr_t dmaphyssrc2 = 0;- _! g+ `( V" H/ m- @" C
  70. dma_addr_t dmaphysdest1 = 0;
      u& C& Q' X* d7 R$ a2 ?
  71. dma_addr_t dmaphysdest2 = 0;
    ; W- I+ u9 R; Q, w- u: a2 O2 Q. G* U

  72. 0 V, k6 f+ u9 e% a; k: S
  73. char *dmabufsrc1 = NULL;% d1 Q/ O9 ]7 g" A
  74. char *dmabufsrc2 = NULL;  }9 k' G5 x, Y
  75. char *dmabufdest1 = NULL;! d# h& S. Z0 ?1 m1 g0 I" q
  76. char *dmabufdest2 = NULL;
    7 d; A+ k- F9 s# M$ k. x0 u0 z
  77. ' v- M8 @, ]/ n; T3 y- {9 F, @
  78. static int acnt = 512;# O9 e3 V. B- o; h% b
  79. static int bcnt = 8;
    ) j" ?# O0 m) B' _9 [- t: P
  80. static int ccnt = 8;! c! c& @, ]% H0 y7 o/ ^
  81. 7 e. t! q! h8 R2 ?
  82. module_param(acnt, int, S_IRUGO);5 t5 d3 H8 }" [
  83. module_param(bcnt, int, S_IRUGO);" [. C, S( B% b3 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 Y3 i# k, h* O' e+ n# Q* R$ M9 k  R" Q3 x9 N2 K, _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, b- D" W/ m$ ^' oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 a, j2 @7 g! G/ ~3 S! _* X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* N9 j6 P, h8 M' _5 w

. Q+ K% O  u; ]% q7 {/ [0 l1 q, L! _0 j0 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 08:49 , Processed in 0.048340 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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