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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 J/ I0 W4 g* w* z
  1. [code]EDMA sample test application' O% S# o, t0 M9 f
  2. /*
    9 {* e+ Z1 o- i9 e
  3. * edma_test.c
    : f( t1 @' s6 x. T$ X# @* Z# D
  4. *( d+ Y1 y0 J) e2 w; R, o2 s
  5. * brief  EDMA3 Test Application$ \( m/ ]* Z% T( O
  6. *
    : f6 z+ }. W7 _1 C& S
  7. *   This file contains EDMA3 Test code.& k6 I# W# h: p
  8. */ s3 ]# i" Y4 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; C! a" G0 C4 x  y& u  \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 l3 H- F8 A- S3 {. V4 x
  11. *         TO CHANGE.( v, k1 Q2 `; [# x
  12. *
    2 ], g& J3 k( D* o& o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! v0 O9 r. |6 T
  14. *6 |! j5 k7 n. c8 Z
  15. * This program is free software; you can redistribute it and/or# O- v( e+ _9 n% o) I8 n
  16. * modify it under the terms of the GNU General Public License as/ R! }" s$ V9 ^; ]% z0 p. ?. {
  17. * published by the Free Software Foundation version 2.
    6 p( |+ e5 K9 t% M3 _1 q
  18. *
    / P% t) y0 D* _/ k; o7 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 I  D' S* q$ W" d  ?
  20. * kind, whether express or implied; without even the implied warranty2 u9 C) e4 u/ J3 x* o1 R4 U+ h! u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + R* I. y: D3 x! f; _- `  H
  22. * GNU General Public License for more details.
    / u  V4 c6 G4 h
  23. */
    8 Y7 A8 r4 c5 N1 Z( q
  24. - e! w' T6 W! A- ]1 B& j
  25. #include <linux/module.h>6 q+ z" A( T0 w5 d5 @" e" Q
  26. #include <linux/init.h>! c# U; G5 x% q, n3 B' o& j
  27. #include <linux/errno.h>  V9 N, v' q8 C" \
  28. #include <linux/types.h>$ y; h: p( A1 t0 i
  29. #include <linux/interrupt.h>
    1 ~, ]; D* P" q, ?0 b
  30. #include <asm/io.h>
    4 m- Q4 N9 Z* \  s5 {" ?
  31. #include <linux/moduleparam.h>
    3 ]2 e1 b7 J: @0 X& Y# H1 D8 l
  32. #include <linux/sysctl.h>
    6 c1 @  K1 q' A: Q2 |7 {
  33. #include <linux/mm.h>  B& _& L% n5 ]8 b
  34. #include <linux/dma-mapping.h>
    & n: y4 ^; E7 I1 ?
  35. + H# a$ _( S, ^: P: V
  36. #include <mach/memory.h>
    6 z8 `* }( |$ C: U
  37. #include <mach/hardware.h>- {/ r/ d5 ?  @" }6 L6 b* y
  38. #include <mach/irqs.h>" Z, |! i# x$ b9 \- v5 O$ f0 f
  39. #include <asm/hardware/edma.h>
    ; {% |  P2 h1 ]
  40. ; ?  g/ `% ^* c4 ]& V$ g4 D, ?' u4 u
  41. #undef EDMA3_DEBUG+ F, r; I. q/ u/ C1 o; O+ v5 M) s
  42. /*#define EDMA3_DEBUG*/
    0 y+ e& n4 |+ G% K! j  }# b

  43. 4 H$ j4 w3 H5 R0 ~7 u
  44. #ifdef EDMA3_DEBUG0 W7 ?% K7 T: m# m- n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % U' O! Z2 s1 J' [' A9 N% v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 }- k/ `. _% K& x4 n& q1 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % U8 U0 `! q( ?7 T6 g
  48. #else
    ) `, K$ ?0 S# C- ]* U
  49. #define DMA_PRINTK( x... )
    ' _2 T: W; ^1 r- I
  50. #define DMA_FN_IN
    & G% K( @3 {+ e, _$ ?
  51. #define DMA_FN_OUT' T% l2 S) d. V! \, d/ E. ]5 S
  52. #endif
    - W; K0 O, C2 f; q" t  y

  53. ! \, A! L1 s$ f0 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ y4 {+ C0 q% W/ X9 A
  55. #define STATIC_SHIFT                3
    3 u6 f( n: y, s) t' o' u% j0 i
  56. #define TCINTEN_SHIFT               20
    + l2 H6 D* o( i, Q
  57. #define ITCINTEN_SHIFT              21
    2 N4 b8 D% H: W7 t# C  t& u9 e
  58. #define TCCHEN_SHIFT                22
    " g0 g; O$ i# n3 F* x
  59. #define ITCCHEN_SHIFT               23
    . _: u- I; i. z4 J7 w$ C9 k
  60. 3 k& J; M- \( X% J
  61. static volatile int irqraised1 = 0;: }8 M0 l6 }' C& G
  62. static volatile int irqraised2 = 0;: R6 t3 w! D3 ?: S" l  D/ \& m. A  k

  63. $ X) [. `+ L, F7 L. ]$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o" S% o7 ^4 s; k; s: ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ m9 X* m) ?. S) ?& ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ^7 g- c5 k: v( c

  67. , ~7 ?* V6 t1 y& V6 Z+ ^: I2 j5 i0 t
  68. dma_addr_t dmaphyssrc1 = 0;9 G+ d, R% |- m8 r9 m  C( p
  69. dma_addr_t dmaphyssrc2 = 0;6 |$ O" r/ e8 |, ?* E
  70. dma_addr_t dmaphysdest1 = 0;
    : n2 m7 f$ C. s* I  F
  71. dma_addr_t dmaphysdest2 = 0;
    8 O9 W' f) t+ D1 i1 E- z
  72. 3 X* C" F0 X3 x8 ^% G# A
  73. char *dmabufsrc1 = NULL;% S( h4 }  ~0 Z3 R, y" G2 J
  74. char *dmabufsrc2 = NULL;
    ! X$ [) e  i" ~* U) X: \0 m
  75. char *dmabufdest1 = NULL;
    1 v7 q% l, |( ^& ?" u, ~
  76. char *dmabufdest2 = NULL;
    $ x# k. g$ z  X) I' i
  77. 8 L) u8 Q0 [! I: @
  78. static int acnt = 512;
    - i4 F# l  Y: r/ z
  79. static int bcnt = 8;
    1 u4 j1 q, U' o  Q2 z% r5 L+ G
  80. static int ccnt = 8;5 x- M) l1 p7 A

  81. 0 P: b: T- h+ P% k% o
  82. module_param(acnt, int, S_IRUGO);
    4 ~+ k2 d' c  [5 s2 J
  83. module_param(bcnt, int, S_IRUGO);1 I+ G; u( M6 w- _" q6 F" A6 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* a' D: ^0 w7 h; x, X5 y7 Y$ U% h: }
6 E4 f3 [! X- r& ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% S2 t# C* R4 |$ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) W- E) p$ G# {% G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 a" f# o  \8 d* r8 |' K4 r  v
0 f' a4 y: X) Y2 G
0 u# p" k( Q/ b- t2 G" E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 20:31 , Processed in 0.043143 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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