OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 K+ J5 S) W# f5 o# L& `
  1. [code]EDMA sample test application
    # ]  H4 ]7 q* i; D
  2. /*8 {1 q6 E/ y7 O: v( ?" t. o5 E2 A4 h7 f
  3. * edma_test.c
    1 X% J6 Z' s2 w' B7 ]7 {
  4. *
      M; n9 g+ ^. X" u! h  t! w/ F
  5. * brief  EDMA3 Test Application
    & M8 j3 D" a' n% ~. {1 X
  6. *0 N* `, F7 v, T5 f
  7. *   This file contains EDMA3 Test code.
    ( D0 O- b' z+ G3 D( J+ A
  8. *
    ' w4 i& Q3 J6 Y+ X/ H7 W  W  e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ @: g6 ]5 _% P! A5 R! [6 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" i! }7 J) v' i& {. d: R$ ~, P
  11. *         TO CHANGE.3 R) h3 ~6 R& O' Y0 ?
  12. *
    . A! W$ s" f3 }4 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 B6 [9 p* |- R8 E
  14. *
    . i' F# H9 @- A1 f, ~
  15. * This program is free software; you can redistribute it and/or! M1 X" E7 K9 M5 w
  16. * modify it under the terms of the GNU General Public License as
    4 W' s" q: L- s
  17. * published by the Free Software Foundation version 2." c* K* I: J) |3 [5 P' _: B; x
  18. *
    . X  |/ f# u8 e) m7 l1 l# p0 a) m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 j4 `2 b. `2 f% V( W" F
  20. * kind, whether express or implied; without even the implied warranty
    7 E! }0 q4 [4 D5 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 T9 n( j/ ^0 ]! y; P) a; B
  22. * GNU General Public License for more details.
    , m& `5 e1 }: {) M. b
  23. */
    ) n& j* p8 P% {3 T2 C% o+ j1 f8 w
  24. ; s/ @4 F1 T0 l
  25. #include <linux/module.h>0 J( Z* D6 Y2 g
  26. #include <linux/init.h>: U  G3 K6 R5 o8 k& b6 {5 T+ X1 y4 E& t( p* A
  27. #include <linux/errno.h>
    % v1 U6 N/ _% R
  28. #include <linux/types.h>) X# r4 T$ t: F& x6 H5 q
  29. #include <linux/interrupt.h>; r5 J3 E( C, c0 d6 x
  30. #include <asm/io.h>
    + A. `- B/ ]8 W
  31. #include <linux/moduleparam.h>7 R6 J# ]1 D" s: b9 S: j7 {
  32. #include <linux/sysctl.h>
    1 G% F4 P( `' f0 L: C
  33. #include <linux/mm.h>' e* k' P0 O/ v: N
  34. #include <linux/dma-mapping.h>
    1 r$ {& v6 A* T- C0 F

  35. ( W2 k$ a* @" b1 O
  36. #include <mach/memory.h>2 @4 R% D- ?  K. K3 @# [
  37. #include <mach/hardware.h>
    & l- F* L7 s( F6 t8 N( u5 h: `4 n" J
  38. #include <mach/irqs.h>
    $ }6 f: N2 ]. A2 ~( B: O
  39. #include <asm/hardware/edma.h>
    : Q% ]$ k1 B* @$ W

  40. 4 c7 v0 j, o$ Y$ N, A- Z0 K
  41. #undef EDMA3_DEBUG
    1 d1 K5 v$ |& s+ {3 w# |! }; v
  42. /*#define EDMA3_DEBUG*/
    $ H# V( S8 ]# h$ k9 Z( A

  43. 3 A: A! g0 E8 [# i$ L  ?
  44. #ifdef EDMA3_DEBUG
    - E3 A# U$ b2 M& B$ w( a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" W. g' S/ s2 T; S3 O6 N2 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + m8 [+ D* L" Q- j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 q) w7 c# W) _- i" V
  48. #else* T% H% W% J: J- z1 Z
  49. #define DMA_PRINTK( x... )
    & z6 o+ V* z& q0 g) z
  50. #define DMA_FN_IN5 v) d/ s% K/ [& k
  51. #define DMA_FN_OUT% x4 t5 I: Y& F" V, Z5 d5 B" n  m
  52. #endif
    : O. T- F; ^/ U6 X6 C" D- ?; p

  53. 9 b* ^- Z! s5 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  V# U3 B& w5 w! c
  55. #define STATIC_SHIFT                38 Y* K) C+ P! L+ _0 P  q
  56. #define TCINTEN_SHIFT               20& P0 E# l. ^  ]) U6 m2 R/ W
  57. #define ITCINTEN_SHIFT              21. M3 K( f- A6 a
  58. #define TCCHEN_SHIFT                22- c1 ^. @" D1 t
  59. #define ITCCHEN_SHIFT               23
    ! ~4 g, K- _- h) n: B6 D! M9 ^
  60. 3 K# J, `6 _! h/ Z$ i' n
  61. static volatile int irqraised1 = 0;6 W6 }% G8 j3 Z3 X$ l7 M. _
  62. static volatile int irqraised2 = 0;* ]* c5 K0 G$ H5 D9 S5 g3 O
  63. 6 U' v, R! X5 W, o4 C: S. q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 q. b/ Q* i( f' B; O& j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f6 u! `+ Z! e$ R6 Z/ K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " M! v: e& v% L- g/ [6 d% R! O
  67. 7 j5 Q0 u6 S6 P+ |2 k, e
  68. dma_addr_t dmaphyssrc1 = 0;
    ; d/ J" G! o# `- ]5 L4 v/ n
  69. dma_addr_t dmaphyssrc2 = 0;- w* ^0 c6 L8 m' ^- F. e
  70. dma_addr_t dmaphysdest1 = 0;
    ! M0 U5 E, v. G2 W
  71. dma_addr_t dmaphysdest2 = 0;: h" g% b$ w7 }+ d; I

  72. # {, s$ h7 m! c0 m+ u+ Z- _
  73. char *dmabufsrc1 = NULL;
    " i3 `2 X  V3 y
  74. char *dmabufsrc2 = NULL;" H& o0 P4 `7 E6 W
  75. char *dmabufdest1 = NULL;
    $ h* `; F. _. z6 G  D, c
  76. char *dmabufdest2 = NULL;) M+ \/ A3 B# T7 L; q
  77. - Q% B# r4 ?+ z7 Z% U
  78. static int acnt = 512;; }& z: W& |8 j
  79. static int bcnt = 8;
    8 i5 F# V0 Z8 ~/ g
  80. static int ccnt = 8;7 W9 ]3 H  F6 L9 Q' t* z  e

  81. ' Z) Y0 {# E/ Y5 s
  82. module_param(acnt, int, S_IRUGO);8 v+ ]# i8 d& O4 ~9 M
  83. module_param(bcnt, int, S_IRUGO);
    ( Y9 v* C6 v9 g4 G& ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: `* `) Y9 I  Q% X2 W) D, E  p, c/ w& G$ B# P+ e1 z) R6 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 i+ i- B, t+ _% d; ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ S' O' M" g: |4 s1 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' g" w  r  d2 C' F+ T& u

) r8 W1 @( K, Z+ E/ e3 |7 j, ^6 |1 j' X" d) I% a' {# U* Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 13:21 , Processed in 0.036599 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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