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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 v: U. M) Y# @* E
  1. [code]EDMA sample test application3 n1 i1 `  i  g  Q1 D
  2. /*7 Q: `! I) h) ~/ p
  3. * edma_test.c  R5 U" T8 ~9 U. b- K8 F9 V! K
  4. *
    ; s0 Y8 _+ D; i3 ~& a; u) h3 t. O
  5. * brief  EDMA3 Test Application# {1 O4 r% H' e+ L# S" o0 j
  6. *9 `7 d' v& }! J7 P: }
  7. *   This file contains EDMA3 Test code.( k" v2 i( f- i2 q
  8. *1 _! n# i" y3 N$ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 h, C$ ^) g& N* f9 n1 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  T/ j9 x  C* j+ U, o0 X  c
  11. *         TO CHANGE.
    . D, g. t4 T8 N9 `0 c
  12. *
    2 G9 R( Y' W, K3 b$ T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  a7 z0 g* w' a8 B
  14. *
    - [0 u  [9 ?3 z; t/ V( q
  15. * This program is free software; you can redistribute it and/or2 P2 D) I! ?4 K2 V+ J5 b
  16. * modify it under the terms of the GNU General Public License as2 }' j* T& g$ h* b! t
  17. * published by the Free Software Foundation version 2.
    # w+ U3 D0 Z6 n+ q' {9 L
  18. *
    7 ~6 k, [6 r: L2 V6 H" U+ A& K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 u: O# `( P0 A7 u. d4 \3 ?
  20. * kind, whether express or implied; without even the implied warranty% x- p# O; I3 e( m0 Q" Q. P) d! e0 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 j5 w" r3 i: |( m4 T
  22. * GNU General Public License for more details.( q! ^; g0 W9 \5 `4 ~" q$ ]
  23. */
    * x) \2 }& }3 |0 \; s

  24. . W- h' N) {0 \% A3 F- X' W
  25. #include <linux/module.h>) D# Z& M1 B& X3 Z* a( |5 X$ V+ U
  26. #include <linux/init.h>2 @/ f) e# P) k$ p" G0 b2 s5 I
  27. #include <linux/errno.h>5 @5 I; P" c' S
  28. #include <linux/types.h>9 K) K* F. ]9 K
  29. #include <linux/interrupt.h>
    / D5 ?3 X" i0 \# T/ W
  30. #include <asm/io.h>0 `% k- b9 n% t1 T7 J5 Z" k) B1 H7 @
  31. #include <linux/moduleparam.h>
    ) r" A8 z# e/ @8 y
  32. #include <linux/sysctl.h>5 ~# f+ W! a; `# N8 r
  33. #include <linux/mm.h>5 {: h% Z$ C' F2 l( ?
  34. #include <linux/dma-mapping.h>* {3 d( S% }- H# ?2 Y" n, X6 r
  35. 8 M+ v! \5 n$ m
  36. #include <mach/memory.h>- @. h  {. o. W6 M9 j
  37. #include <mach/hardware.h>4 w$ |. @. E% u) M  s6 y4 J; y
  38. #include <mach/irqs.h>8 w! {' U" R3 k$ k* Q$ H, f
  39. #include <asm/hardware/edma.h>
    1 r! M, W6 T/ c" a: A' J4 x
  40. , h0 z8 @) i% k! g+ z" H
  41. #undef EDMA3_DEBUG
    6 w  f0 _2 T7 \& g9 a5 Q. _9 u4 E
  42. /*#define EDMA3_DEBUG*/
    1 J; F/ V. K4 U# _  ^- J" w4 H
  43. 2 v: D; ~3 a4 r2 @. W1 Z/ N
  44. #ifdef EDMA3_DEBUG
    % |$ a4 Z  ~  f* a' r# i5 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      z: t/ y' W  \5 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      i- K0 o( w! E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ R1 V: V) i! X' N) ^! i) C9 d
  48. #else& E1 S. M8 r  b) G/ J: q6 z
  49. #define DMA_PRINTK( x... )
    ! @$ R5 t; X8 R
  50. #define DMA_FN_IN8 D" B$ b& \; G
  51. #define DMA_FN_OUT
    . u5 i. W$ o2 h5 Q- n/ L
  52. #endif
    ! F3 j* S, L/ @- }
  53. 6 v) \7 B2 R  `' E3 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! K2 v3 L6 Y+ r' |
  55. #define STATIC_SHIFT                3% c; l$ C+ E9 B  l" X3 f; |
  56. #define TCINTEN_SHIFT               20
    ) `  L, s, J8 P1 ~( v8 y5 |5 j5 S
  57. #define ITCINTEN_SHIFT              21
    & S2 @: R5 Z6 k1 F8 b# i( M
  58. #define TCCHEN_SHIFT                22- M: L. f  i1 u
  59. #define ITCCHEN_SHIFT               23$ U5 i# C" M  f6 w) g+ Y! c8 d6 h
  60. 0 u- q8 }( H  T+ f9 R
  61. static volatile int irqraised1 = 0;; a, [7 ?+ O0 Z: s' @1 T& ?5 X# }
  62. static volatile int irqraised2 = 0;, q3 G; H; u- e" F9 i& C
  63. + \. M4 V( g7 ]1 N$ @* T6 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y' n6 R1 G: M' c" h3 X, n/ G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 x2 q% V0 ?8 D2 B' r* y: t' ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 N' E$ @! f9 k

  67. 3 `( \3 m, a& K: f# ~; c
  68. dma_addr_t dmaphyssrc1 = 0;* G6 J3 K" q3 C3 l9 Z) t
  69. dma_addr_t dmaphyssrc2 = 0;
    & {  [- i0 e; o) b# `; D% [
  70. dma_addr_t dmaphysdest1 = 0;4 G# P% I1 C  c1 T( J) J
  71. dma_addr_t dmaphysdest2 = 0;
    2 d! b1 y& l% t0 s& I% F! b
  72. 0 c* h$ r+ s' G: t( w2 v! G5 s* Y
  73. char *dmabufsrc1 = NULL;
    8 m! P2 U9 H) @' l; z
  74. char *dmabufsrc2 = NULL;
    % K' c0 L8 w7 V- a& D
  75. char *dmabufdest1 = NULL;
    : T# X) d+ n2 n. }  t( R
  76. char *dmabufdest2 = NULL;+ i  W$ z. ?4 Z

  77. * Q; [8 r% j% L# e7 l
  78. static int acnt = 512;
    + n9 H) Z6 b* t+ r  F; r
  79. static int bcnt = 8;% f& v$ X* Z8 [! P0 i4 i$ b
  80. static int ccnt = 8;
    ) Y/ A: Z1 c  |2 L

  81. ' _$ n8 ~/ s5 `4 G+ I3 y
  82. module_param(acnt, int, S_IRUGO);5 d0 t8 V' N9 z5 `$ W0 @) N( ?/ w
  83. module_param(bcnt, int, S_IRUGO);
    7 Z: r: p* W9 Q! z0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 I: p! [7 ~9 p. i$ W# J/ g; d7 X/ T" Y% Q3 C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, v+ t3 o* ^. T2 S3 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- m: t- |' F  f' D5 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 S  A  m* K2 i" \
7 a* Y4 N! s3 a  G  }$ J- t8 x* u0 L8 P$ ^, Y0 {6 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 07:34 , Processed in 0.046851 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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