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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 Q: ?& l  @9 X
  1. [code]EDMA sample test application9 y  t# k( i' I7 I% h$ o
  2. /*, I3 w; [7 X2 {& v, P( |
  3. * edma_test.c
    + h, Z, w) e( R0 K6 }
  4. *: f& E) W0 ^2 y# q5 A
  5. * brief  EDMA3 Test Application* I- C& T, Z) L8 A$ z1 a
  6. *' l) S1 ]* s7 q
  7. *   This file contains EDMA3 Test code.) q5 a* o( d8 O5 M
  8. *
    ! Q% i% @5 }5 P& a" C" c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 r: v+ d/ U. @# b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 c6 g: e; g: Z3 ?1 h
  11. *         TO CHANGE.( B& b/ V# p2 B5 G+ a- |
  12. *( ]; `+ V) c4 g, t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / J! e/ W5 l! j1 D; L+ A) B
  14. *, s* o% o; x( L; ]5 `+ @
  15. * This program is free software; you can redistribute it and/or
    ' @( V5 {) X0 \3 J7 F% I3 B2 U) ]% o" I
  16. * modify it under the terms of the GNU General Public License as$ {& h9 s% F# t4 Y$ J* M
  17. * published by the Free Software Foundation version 2.
    % K0 k, X) g' k; `8 s0 t) ]1 Q
  18. *
    6 m  ?; k1 |1 V% q3 t- P# C* d1 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' q$ ^3 j. ]4 Q5 H
  20. * kind, whether express or implied; without even the implied warranty7 g& c, x" h0 o+ |" X; v+ T) ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 Y+ D# g- o% @" {2 i/ H1 e
  22. * GNU General Public License for more details.- Z8 S5 h) X* V4 j
  23. */+ K* o' ^' V4 u# d' Z* ]& B
  24. 2 l: p9 r( Z3 D+ J
  25. #include <linux/module.h>8 o4 I% h4 `: i5 _
  26. #include <linux/init.h>7 f( s  |* l+ M8 l
  27. #include <linux/errno.h>; L6 M6 v( x  u! f
  28. #include <linux/types.h>/ I+ g: ~7 g' F8 y6 m$ u) @& K
  29. #include <linux/interrupt.h>
    ! j3 [' S  b5 _1 _" Z$ y+ ~
  30. #include <asm/io.h>
    / ^2 D/ M6 n/ a; r+ L
  31. #include <linux/moduleparam.h>
    8 l3 h5 F& u. R+ v' X( q
  32. #include <linux/sysctl.h>
    * A4 Y  q4 c& H1 s" N7 i& e
  33. #include <linux/mm.h>* Q' a) @" }6 L% G/ p# o3 ?  _5 X2 o+ A
  34. #include <linux/dma-mapping.h>" E% u( t2 Z- ^
  35. + {5 P2 `* K, P
  36. #include <mach/memory.h>: p' S, F: ?0 l9 C
  37. #include <mach/hardware.h>
    ! Z& F6 n' i  i9 c
  38. #include <mach/irqs.h>
    " T: [8 R* x) {3 x4 @
  39. #include <asm/hardware/edma.h>- x8 e! D0 n+ M. {4 R
  40.   c/ D0 t- R5 N5 x* H- D. M5 N
  41. #undef EDMA3_DEBUG$ x$ [& X. u0 c! Z# t
  42. /*#define EDMA3_DEBUG*/- i, G' Y9 V9 g" Y

  43. + p" A% H, H9 B. N$ M) c
  44. #ifdef EDMA3_DEBUG: Z9 D' S* S3 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 T; M1 q, c( q0 Z1 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" |! @# e+ f9 y$ }( M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . |& o2 w* k& n% ]) x
  48. #else, @7 {- N4 ?) F% E: N+ Q' E. s
  49. #define DMA_PRINTK( x... )9 D+ k* d* ?! M
  50. #define DMA_FN_IN0 H$ c8 x/ H  g4 @1 `6 V
  51. #define DMA_FN_OUT/ Q( Y" ?# O  o* t8 n
  52. #endif
    & q/ o* @$ D6 y; |, F

  53. : ]7 z+ Y' ^4 Q8 |$ ?2 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % n1 A0 t, u" L& @9 g. d
  55. #define STATIC_SHIFT                3/ U. Y9 L3 l* I5 b5 d5 r3 f
  56. #define TCINTEN_SHIFT               20/ Q6 t& }6 o& _& j) Z
  57. #define ITCINTEN_SHIFT              21
    - m  d3 g6 s5 [  n$ u6 ^# o
  58. #define TCCHEN_SHIFT                229 e2 }0 w/ Z5 Y# i/ `
  59. #define ITCCHEN_SHIFT               23
    * K9 X" I2 N( ]2 d2 u( L( U
  60. 0 r1 X/ [9 n6 C" g1 X: D9 \
  61. static volatile int irqraised1 = 0;
    ; `' W- e* k- A4 t8 G  }* l$ u, L
  62. static volatile int irqraised2 = 0;: h0 G. z7 L, G7 H9 K% {
  63. 2 {/ M- z+ P* [7 u! @- M$ }" J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s  P8 f0 g- }, k7 e! e2 ]5 ?( L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 U$ y- z. y  M) V% B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  c9 ^2 P& y) D+ `
  67. . O" o; ~5 u9 x- g; p4 ?  A1 K( e
  68. dma_addr_t dmaphyssrc1 = 0;
    6 \1 W* ]3 s) F2 p' R
  69. dma_addr_t dmaphyssrc2 = 0;8 ?3 {  x; T; r# c6 v6 F
  70. dma_addr_t dmaphysdest1 = 0;
    # ~# r3 p4 Z% Z3 w& C( `2 y
  71. dma_addr_t dmaphysdest2 = 0;4 {% n6 q. E7 ^4 j5 R0 z
  72. # ]+ D1 A: \8 @
  73. char *dmabufsrc1 = NULL;
    1 U2 c3 d' f* R/ m- O. \3 z# |% q
  74. char *dmabufsrc2 = NULL;
    2 Z- o  O5 G6 d9 s0 y5 [, e
  75. char *dmabufdest1 = NULL;; r- e: u/ I! J  B8 M
  76. char *dmabufdest2 = NULL;, X! @3 S5 [! ^

  77. 2 d6 v) v. U, K0 v+ w1 S8 x5 Q
  78. static int acnt = 512;9 D. U0 V( u6 D  O
  79. static int bcnt = 8;
    4 A  D( [$ a% n0 j" N: M
  80. static int ccnt = 8;8 q% F! Q; P4 l& P  |$ ]

  81. & R+ R0 `' {8 Z" t" h
  82. module_param(acnt, int, S_IRUGO);/ B! h- C8 x* \* r
  83. module_param(bcnt, int, S_IRUGO);
    4 X1 @; d7 h' T  k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( Y3 B4 p+ M6 z3 V+ l( G7 E1 s* d# D
9 ]9 X4 M3 H" G. s" e$ }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' b' b- V, d& s: r  y+ Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* u5 \# E0 h; U% T( z" m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: H) ~6 I' z  f; l
, c. [' C" c# G3 \' F& q& [. U# v' B
! I) q7 C# S) y2 U/ ]  o4 z- S# s# s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 21:34 , Processed in 0.039458 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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