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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & [$ z8 U& u3 v6 z
  1. [code]EDMA sample test application
    1 _# e, c2 M" F2 p9 @
  2. /*
    . W1 g5 a2 X' k0 }  S
  3. * edma_test.c
    3 R8 ~; v+ D, K; I
  4. *3 b- R+ I3 J1 m
  5. * brief  EDMA3 Test Application3 w& }$ B; s- T' o% D
  6. */ [# Y- S5 ~4 x/ X
  7. *   This file contains EDMA3 Test code.
    , T( Z7 y) X& ~# D, T% {0 w' M. i( r
  8. ** e) u6 X0 P2 w6 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & F0 b& G2 a( [# ~+ o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / Q$ v, p$ N. ]" N
  11. *         TO CHANGE.% x$ x2 ]9 N2 _( `4 w2 \# P! {
  12. *
    7 o2 w# M$ ^) K: F8 [* p7 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 f2 l0 M+ i" ^0 Q6 u0 [* e
  14. *( [6 N. V. U" F+ I- E. {+ a
  15. * This program is free software; you can redistribute it and/or2 `5 x5 U1 O# i2 Q9 w
  16. * modify it under the terms of the GNU General Public License as
    # @! ]. g6 V, Y8 b) ^5 J$ k
  17. * published by the Free Software Foundation version 2.0 j& n. \/ ^* ~* x, ]+ T% b# O" a5 @0 H
  18. *) D5 E' V# X/ G+ w; i5 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & W. W& X: P6 i6 H) n9 Z2 w
  20. * kind, whether express or implied; without even the implied warranty) t. l: |+ Z, Z  a/ b2 y- V) C0 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ s. I) P3 A. @- f6 P  \1 P2 L
  22. * GNU General Public License for more details.2 C5 x! Y& [& L2 H& b- H' ^
  23. */: ^! C/ O4 s2 `6 {' Y! S1 a' m% N7 _

  24. $ M  h: }5 r9 Q1 }' r9 Y0 Q' F2 g
  25. #include <linux/module.h>
      K6 y: Z2 w% h2 A; A2 ]/ b$ e
  26. #include <linux/init.h>
    % M/ o! B! @: N5 E
  27. #include <linux/errno.h>
    2 _3 ~5 N; e  [
  28. #include <linux/types.h>0 a. s3 Z% I/ g- {
  29. #include <linux/interrupt.h>
    2 B( E* H, u6 D( f5 x
  30. #include <asm/io.h>: b4 @9 R: f/ Z0 E
  31. #include <linux/moduleparam.h>
    * F$ _' [3 n) I6 a/ e3 h4 n
  32. #include <linux/sysctl.h>
    : J9 F2 W$ e; u) o( O+ V  t
  33. #include <linux/mm.h>2 h3 s+ M5 H7 u! p* w3 H/ d  m
  34. #include <linux/dma-mapping.h>5 d0 B$ l: S9 @
  35. ; L) V, `3 q  F& u
  36. #include <mach/memory.h>: |1 Z9 i8 D6 ~/ s$ T
  37. #include <mach/hardware.h>
    . r; p! x8 x4 \; c
  38. #include <mach/irqs.h>
    & Y( E* {0 s) H5 n1 [4 C
  39. #include <asm/hardware/edma.h>  ?, c5 K2 @/ E
  40. 7 v' _9 ~4 s: C* N/ o6 W1 z5 A
  41. #undef EDMA3_DEBUG# G3 W  b; e( F$ c, t; |
  42. /*#define EDMA3_DEBUG*/
    # N- H3 k1 Y" \; k3 }& c0 G

  43. ) S2 a8 P8 _) p' T
  44. #ifdef EDMA3_DEBUG. D+ @: t! D6 Y* I+ h' ]; y& W; X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 [7 J) r: l$ d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 C+ B5 z9 b% u- ~4 J) T* F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N4 ]* P  }% x8 S  t. }+ D
  48. #else' F( V6 M$ y  y
  49. #define DMA_PRINTK( x... )
    " h$ q2 A( q, r  T4 ?
  50. #define DMA_FN_IN
    1 Z/ |* v/ w8 l8 a  w% k
  51. #define DMA_FN_OUT
    - R( x9 F2 X( B4 F
  52. #endif; Q5 s1 p  Q' h& ]* A
  53. * G4 @) n/ z1 g7 ?# H% x' {# M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # {. x: m4 x# p/ D* J
  55. #define STATIC_SHIFT                34 W8 L! x" @& U1 p4 |, g/ i, H8 @" d
  56. #define TCINTEN_SHIFT               20% G  F+ T! W& M4 |" c5 F
  57. #define ITCINTEN_SHIFT              21
    + @* v. `4 ~+ \# o
  58. #define TCCHEN_SHIFT                22; ?6 @- N6 n8 m- e! i% l8 r7 P' g
  59. #define ITCCHEN_SHIFT               23/ d' s; D: A. \5 H6 n& d
  60. : g- N0 k, d7 s; {% O1 l
  61. static volatile int irqraised1 = 0;8 g& z! H4 k# y2 x
  62. static volatile int irqraised2 = 0;
    / v4 @- f" w* p2 T! C

  63. # }$ t% l) y  E. v; n; v0 R" j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \- @" J# M0 \5 q5 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 e1 A  \' X/ r0 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . [2 e6 h* L( O$ t: D3 s. K9 X
  67. 9 ?5 q3 Q+ I. t# t
  68. dma_addr_t dmaphyssrc1 = 0;* o" A% }3 ]7 G4 \
  69. dma_addr_t dmaphyssrc2 = 0;' \! e! z; [3 _& y
  70. dma_addr_t dmaphysdest1 = 0;
    + h6 g2 i$ g3 a$ W# M; B4 V- F, k
  71. dma_addr_t dmaphysdest2 = 0;
      f. }6 J+ Q8 e/ f4 O/ n# `
  72. : O. c  q" a. c) l8 V" l
  73. char *dmabufsrc1 = NULL;$ Z1 d8 r/ z7 e' q$ a
  74. char *dmabufsrc2 = NULL;, d( [7 {- h0 q/ I% Q3 V; U
  75. char *dmabufdest1 = NULL;. r% l# B* a2 q$ {5 n
  76. char *dmabufdest2 = NULL;& m, s  U6 o' {" I8 l8 _* ?

  77. 2 z8 l- _* B' s( Z5 h" M4 v
  78. static int acnt = 512;
    # r) t9 [0 Z! k  b  ]( `
  79. static int bcnt = 8;7 v2 h9 ], A' G8 a( c
  80. static int ccnt = 8;
    ' C1 J: x( m. E9 m0 G
  81. ' t2 I8 j- a5 |% j, |2 r7 v
  82. module_param(acnt, int, S_IRUGO);
    & [8 _0 F( S, @" n8 B* D5 @
  83. module_param(bcnt, int, S_IRUGO);
    , i. ]; I5 f4 o- Q6 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 k# w! E& K" Z% H' e

( J. \6 g# a; E4 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% P* x6 ]7 Y  A( E1 _+ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# W5 x; X4 b- W8 G  d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 @" G) r- b5 q7 D8 f$ U( p
9 d6 h6 G1 C' V
& A( p0 i; j. Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-28 19:02 , Processed in 0.042021 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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