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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % L! o/ F& z. x$ m" V# _. D
  1. [code]EDMA sample test application. `; y$ I# ?1 l/ d! ~3 n% m# X
  2. /*  Y: Q1 I- w3 [0 A+ z
  3. * edma_test.c# ~4 t. F3 L" b) X* I6 y% [& w
  4. *" m% L# ?1 Q5 Y, i1 J9 R
  5. * brief  EDMA3 Test Application( Z4 l, T* O2 k* r
  6. */ B6 ]% j9 x3 K* i1 `
  7. *   This file contains EDMA3 Test code.
    ! h" Z$ B; k! L
  8. *. Z, ?# ?2 a/ r4 N1 f( j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 C# [0 H5 o0 ~+ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^# f- _" [- [# r- Q$ S. R
  11. *         TO CHANGE.' g' `/ u* g$ e$ k4 B
  12. *$ X$ R; F8 v" t5 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 s% Z& @5 y& L  X7 h1 V+ p8 B
  14. *- F- I; B% F5 y- D- N: x
  15. * This program is free software; you can redistribute it and/or
    4 [  g/ \1 G! N  v7 S
  16. * modify it under the terms of the GNU General Public License as# a5 E1 _* T: a  f% S) b
  17. * published by the Free Software Foundation version 2.
    * v% @% a1 j4 [/ G5 e& U
  18. *
    0 @% w0 q' z5 r- t! p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 B# _$ a: b# V5 L% W
  20. * kind, whether express or implied; without even the implied warranty$ r: c2 Y1 Y) H, I4 B8 K) w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' `# M$ y! I2 Z* U
  22. * GNU General Public License for more details.
    / c5 K( }2 j. l) ^
  23. */+ [. T/ M0 n! y

  24. ' I. n  {2 V' \% a; W  A9 N+ E: E
  25. #include <linux/module.h>
    . p1 u1 _) e$ T, s1 v7 _& Y! E
  26. #include <linux/init.h>- }- ]4 u) Q- d6 E
  27. #include <linux/errno.h>
    2 [7 W: `2 x. \8 ?) K0 Z5 {. `5 X! r# r) t
  28. #include <linux/types.h>% k% o9 c6 o+ V9 f1 K
  29. #include <linux/interrupt.h>
    + E- h+ G; p- ^9 L+ T
  30. #include <asm/io.h>3 |; q' e  `+ R, o5 N
  31. #include <linux/moduleparam.h>
    ( s9 C5 Y- o$ q# Z
  32. #include <linux/sysctl.h>/ g. T( `2 J9 p# d& r3 L
  33. #include <linux/mm.h>
    - n9 P  r$ r8 b! z
  34. #include <linux/dma-mapping.h>
    % j2 s" i" s9 F0 [$ G3 j$ [: P

  35. 8 e6 g' @' ^# z5 H9 e4 K# {# J9 ~) E
  36. #include <mach/memory.h>
    , Q) a( Z, o! @- L
  37. #include <mach/hardware.h>
    3 `9 X; V0 A# J  {6 ^- |
  38. #include <mach/irqs.h>
    5 Q& Y+ v7 M1 K; a/ Q
  39. #include <asm/hardware/edma.h>3 W' F& a: [& o* ]2 V0 a' x8 Y

  40. ! W( v- [6 e4 X
  41. #undef EDMA3_DEBUG
    ; T9 F5 M; U8 ?: s
  42. /*#define EDMA3_DEBUG*/2 u. P0 k% u& Y1 Q2 f. K
  43. , B) k4 R" @) ^6 E
  44. #ifdef EDMA3_DEBUG$ }: d) Q2 X, Z% G$ X* ^5 ~- C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , g3 y/ x; w0 |% Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W% o% t+ }! W0 B. I1 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % L+ L6 D4 Y; c4 D
  48. #else
    ! P# l" @0 `& w7 J$ N$ [
  49. #define DMA_PRINTK( x... )
    * v9 k' x' Y+ L! E0 f* j  p6 b
  50. #define DMA_FN_IN
    , ^# r; V' }6 W
  51. #define DMA_FN_OUT
    ! s% G7 q' r( O  j% d
  52. #endif
    , S! _) f4 C# H2 q
  53. 8 V( z" f4 x- w5 ~( h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& H9 T9 q# n; n0 ^6 \  n- X% H: `
  55. #define STATIC_SHIFT                3
    , p! h7 |( \* G7 c6 E9 }' A1 Z# p
  56. #define TCINTEN_SHIFT               20
    " I8 [, ~- d+ i
  57. #define ITCINTEN_SHIFT              21' \, ~5 z$ |" Z) t6 v5 b* M
  58. #define TCCHEN_SHIFT                22: h8 x" b. j3 Y# w6 [5 `4 p
  59. #define ITCCHEN_SHIFT               23
    4 Y# ?; i9 {8 S
  60. 0 f) D( K2 {4 y6 C4 c% G
  61. static volatile int irqraised1 = 0;# ^% d+ ^7 r0 L' Z( b# f# v
  62. static volatile int irqraised2 = 0;
    ( O; m/ W5 j# V% |
  63. ; [, |6 _& w3 W. A0 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % [/ W. M7 J  `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Z; y# Y8 f! _1 u7 x7 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w1 }$ w5 r9 [. B6 c
  67. 4 z, G3 T/ x  _1 a1 v
  68. dma_addr_t dmaphyssrc1 = 0;. `& ]8 y6 q7 L$ T3 Y; h/ r0 \. q4 a
  69. dma_addr_t dmaphyssrc2 = 0;
    ; j5 k  k$ n5 H- P
  70. dma_addr_t dmaphysdest1 = 0;7 H, A( V) {5 Q) K' U% e6 I+ ]+ y
  71. dma_addr_t dmaphysdest2 = 0;9 c3 c; ~) s, Q/ u+ ^. g

  72. ; h- x3 j, P, F
  73. char *dmabufsrc1 = NULL;8 L, q; P% a% E7 D0 q
  74. char *dmabufsrc2 = NULL;/ N' u$ M# X% ?; g$ u( S, M# f
  75. char *dmabufdest1 = NULL;
    . T2 Y. B1 j# p+ Y$ O
  76. char *dmabufdest2 = NULL;8 w* `; x5 Y* h) h6 q2 D3 s
  77. ) [4 b+ r  q/ W3 m# t! V
  78. static int acnt = 512;1 Q2 R# C# K; J
  79. static int bcnt = 8;- _( Y7 z6 k! a$ @& _* A. Q
  80. static int ccnt = 8;
    3 c$ r3 p, j* N; [$ [' x: p

  81. 8 i$ v; I0 u5 P: U0 s4 ^
  82. module_param(acnt, int, S_IRUGO);
      u: Y% @$ T% z7 r' |/ Z
  83. module_param(bcnt, int, S_IRUGO);( b0 L- p0 a  l2 E, D4 U5 Q- [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. W0 J9 e: ~( {+ [
# t! S; B- ]7 C, ~7 x' |" C6 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ G9 ^7 J& {$ {: |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* T( A, }# W0 ]4 N* D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 F, x6 o# v7 b; ]+ E4 v( `$ i+ ~2 E$ h, M' O" Y3 b& v
: ?0 i8 w  N2 u1 Z% M$ |) g* `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 17:50 , Processed in 0.037483 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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