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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ^: E+ i" t7 E( w" M  R& G
  1. [code]EDMA sample test application% A* K# s+ ^+ l% S
  2. /*. F5 r# z5 |" T
  3. * edma_test.c# A6 k+ z/ \' q% P& B; E
  4. */ G  ~8 y& i2 t. M
  5. * brief  EDMA3 Test Application1 Q- Y/ \: K9 Y! E. v
  6. *
    , ]" ~) e) v5 j# S; |6 H
  7. *   This file contains EDMA3 Test code.2 m9 _" k; [8 C0 \% l7 B
  8. */ g2 k9 k: G3 D1 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% M0 [7 W( k! p5 p; J. j5 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & z2 l+ _6 ?$ A; {
  11. *         TO CHANGE.
    3 m3 h1 [$ S& ?  {% d/ D% w
  12. *& v8 s: N. h+ ^+ |" ^) i) V1 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 j( [3 t1 V% a
  14. ** i3 B8 K: S4 k3 j2 F
  15. * This program is free software; you can redistribute it and/or
    + K& r8 l% X. D6 c) E3 v+ i
  16. * modify it under the terms of the GNU General Public License as
      X% W! A. \* Y9 @
  17. * published by the Free Software Foundation version 2.+ X9 q+ w( C6 q3 u* [
  18. *# b7 V: W( @5 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: S& G6 |# U5 o" O$ l
  20. * kind, whether express or implied; without even the implied warranty5 N; R+ k! w( J7 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# V  Q) Q# @+ S$ M& @
  22. * GNU General Public License for more details.
    ' t# p! P& d+ ]. w6 V* M
  23. */, X; M3 A" Q* F* A' B

  24. * }" \  _9 k2 ~5 N
  25. #include <linux/module.h>7 I, q' M% l3 B+ K& T4 @
  26. #include <linux/init.h>
    ' P" f  d/ |' N5 T
  27. #include <linux/errno.h>
    + _) t$ T$ N8 H% M3 a7 g
  28. #include <linux/types.h>
    ) K/ Q0 I8 U9 r) U
  29. #include <linux/interrupt.h>3 q4 z: z  g! ~. M+ N9 v; h/ [# H
  30. #include <asm/io.h>4 c( l8 X) ~( C- S% _4 [7 d( N! s
  31. #include <linux/moduleparam.h>
    5 e, C5 b& s# w& u% B! M( }
  32. #include <linux/sysctl.h>
    ! {5 @* v( E. O& t; z1 n3 J
  33. #include <linux/mm.h>& A: A0 A# g2 l. w: v/ {4 Y1 m$ ?
  34. #include <linux/dma-mapping.h>
    1 z4 N- D6 f: C
  35. 4 M% b; a1 l) a6 X# h0 [5 e
  36. #include <mach/memory.h>
    % B9 ]6 I7 r- R. `  C) `/ m1 r
  37. #include <mach/hardware.h>1 }' P% B' m5 c! K) d5 l, g2 T
  38. #include <mach/irqs.h>
    1 @8 T- d( ]2 X7 @" f6 H7 T0 Z# @
  39. #include <asm/hardware/edma.h>% A0 S& x. {9 g. d

  40. : n/ `6 p  T, v2 x5 j+ H1 {' C* }
  41. #undef EDMA3_DEBUG: U0 J# u. i0 U4 l+ R+ F) C
  42. /*#define EDMA3_DEBUG*/
    . Z* v6 a) e' t( ~2 p, x4 Y& d
  43. * q. ~3 {, [9 N0 Y, D
  44. #ifdef EDMA3_DEBUG/ i5 U  y. z1 d) s" G8 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) s" ?0 u- D8 h) }2 w2 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 @2 t' R0 E9 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% q" w4 {5 }7 e$ t  {( V; f% q
  48. #else- g9 E$ y# D: ^( ~' H3 [) g
  49. #define DMA_PRINTK( x... )% k$ M' C8 j( _/ N' {4 u3 N( ^
  50. #define DMA_FN_IN' g  n( m2 l+ v
  51. #define DMA_FN_OUT
    . d& y9 W. |) ]5 H
  52. #endif
    $ c8 Y* }9 p; p

  53. ; _; c/ U" x$ R3 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 ~" [7 b/ \6 ?
  55. #define STATIC_SHIFT                3
    , W0 Y; \9 x$ Z) b% x2 b9 Z
  56. #define TCINTEN_SHIFT               20
    * y% T- `7 ~& T: s
  57. #define ITCINTEN_SHIFT              21
    ( f% K7 S2 r) e' B0 g. G4 V6 n
  58. #define TCCHEN_SHIFT                22
    , V  Y" R+ M5 b0 l9 ^
  59. #define ITCCHEN_SHIFT               23
    : P: Z4 U) g3 W8 x3 U2 J

  60. - e2 `3 T0 C) U
  61. static volatile int irqraised1 = 0;
      A. d" q. G4 k- l" O
  62. static volatile int irqraised2 = 0;6 L. H4 u+ a# Z  Q
  63. 0 T* e' x% t9 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) u  [8 v0 Y) b/ A5 C9 Y$ ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: o9 {7 Q3 m1 k6 H0 W9 S- H) G+ J. D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 g4 G2 S2 T# Y$ P3 e* V

  67. 7 d1 [* N$ U) n5 h
  68. dma_addr_t dmaphyssrc1 = 0;) \, k  F5 r& E) A* W& d- U' P
  69. dma_addr_t dmaphyssrc2 = 0;
      k) W- }( S* k
  70. dma_addr_t dmaphysdest1 = 0;) |: q- z$ x& ?+ V" Z' M( ]
  71. dma_addr_t dmaphysdest2 = 0;
    % c0 U; v6 C8 k

  72. + L+ D! e/ M1 [3 O' D* |
  73. char *dmabufsrc1 = NULL;
    / N1 o, R9 ]+ L' M
  74. char *dmabufsrc2 = NULL;8 u7 o' F/ _5 T; E
  75. char *dmabufdest1 = NULL;
    ' x+ k" O- [7 a  `$ [, w( G: H" I
  76. char *dmabufdest2 = NULL;+ [/ I& S2 i0 k- A* s! J

  77. ' _; }, p" n7 ^$ F3 N
  78. static int acnt = 512;
    6 a9 u" m  z4 s4 y
  79. static int bcnt = 8;& g4 k9 e, `: _" [: l' |" f) s
  80. static int ccnt = 8;
    / u) K4 u! p0 _9 R# i, o
  81. & d0 Z& i6 s& f0 B! T2 @1 E
  82. module_param(acnt, int, S_IRUGO);, }/ U7 }3 f" L' o5 W/ {4 G
  83. module_param(bcnt, int, S_IRUGO);
      N' A) L) G+ y" F# H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ g- }% L5 I# q4 z' M: b& I6 n9 F# `9 `
( [: r% M7 `3 v7 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ f& L9 ]. X7 ]3 U: k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n7 Z0 U9 R; A6 a0 t' E( T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 Q. \8 v" P, x
9 @+ v0 B3 ^' y6 }  z2 L, P# x2 ~2 s
9 ?2 Z1 |8 o7 U4 n& j" f4 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 06:02 , Processed in 0.040915 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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