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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. G. Y! p# a- t% E: K) B3 C- C
  1. [code]EDMA sample test application
    - S$ H( g7 R. ]8 E& v# x& K
  2. /*7 F8 r% p/ N9 Q
  3. * edma_test.c& Q6 i9 F. b$ D3 ~
  4. *
    $ ~1 }; \" D9 D" P
  5. * brief  EDMA3 Test Application
    / T8 m# l$ k% M" a" r7 ^5 f
  6. *
    ( d) d: D# F+ g0 {: m
  7. *   This file contains EDMA3 Test code.
    $ u; q" l) r8 p/ r- w
  8. *& o2 r# S- V3 f& |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - C) K, m3 ?; Y& j& v! }( U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 K9 S3 n; x& T8 Z; a) z
  11. *         TO CHANGE.
    . k: f% v3 I& ~8 K* Q- |6 @
  12. *
    1 Q, j/ H2 j8 n: ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) m9 V/ q9 @4 }! |& @3 q
  14. *
    0 z7 Q, S' V# R9 [5 B
  15. * This program is free software; you can redistribute it and/or4 W7 z1 Y  m, {: l
  16. * modify it under the terms of the GNU General Public License as
    * ?8 F( w# q* e& Y
  17. * published by the Free Software Foundation version 2.
    0 {* f9 w! Q- b) J+ l6 a
  18. *: Z) r; A1 ^) h7 |, m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  R! P/ D' _2 \- m% G
  20. * kind, whether express or implied; without even the implied warranty
    * H& S( ]- r3 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . f, D7 W' l& b
  22. * GNU General Public License for more details.) M* ^% c* ?3 A0 _$ P# K. V" G
  23. */3 i! H3 x  M; l% [" @) B

  24.   [$ d0 ^/ m! `  c3 j! |6 B  @
  25. #include <linux/module.h>
    / f$ D7 u! B% \7 e. `: v- u
  26. #include <linux/init.h>
    - z7 d3 @: P* Q; L& @- s# [
  27. #include <linux/errno.h>1 U/ r+ l, ^" f! U/ @& {/ r
  28. #include <linux/types.h>
    & k9 r/ _6 R7 k" ]
  29. #include <linux/interrupt.h>" E) F. w5 M1 u. N6 S' P
  30. #include <asm/io.h>
    $ ]8 ~' M5 E) p+ c  \
  31. #include <linux/moduleparam.h>9 Z4 f; j+ L% j8 S' M" D
  32. #include <linux/sysctl.h>
    6 C" T* J* i, D0 E# ^
  33. #include <linux/mm.h>  H9 q$ x* U, c& c
  34. #include <linux/dma-mapping.h>9 U: v* U6 I1 T- U6 h& w

  35. " ^/ m5 e( m2 V9 g
  36. #include <mach/memory.h>/ H# P4 b. a, J/ A3 a2 d$ c3 d5 q. {
  37. #include <mach/hardware.h>
    ( E# o) K* \/ e9 k! e; B
  38. #include <mach/irqs.h>
    - Y  f# Z7 `7 Q2 Q
  39. #include <asm/hardware/edma.h>
    4 l8 g( L8 V" x8 O

  40. ) F2 A' U3 X  e5 r; R
  41. #undef EDMA3_DEBUG3 O. u( B/ h- M1 ]
  42. /*#define EDMA3_DEBUG*/
    : {+ `0 P+ I4 [7 j* c
  43. 4 m8 [2 n9 V/ N1 ?- ^& X* E
  44. #ifdef EDMA3_DEBUG' _% d0 ^. q* e, |/ L* L1 P+ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# Q# D% _" X; m: M" E+ q2 @+ X5 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 o8 p1 h6 J( A: }( n5 @/ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # {) G7 }; E$ @0 E" a  N
  48. #else
    ( Y) j. D/ K& `3 \3 U
  49. #define DMA_PRINTK( x... )
    4 M/ f7 a* r* X' e+ o
  50. #define DMA_FN_IN* n* g- ^; {( a) m7 |" {1 n, w
  51. #define DMA_FN_OUT. V0 Y0 U7 I# T/ R2 e, Q
  52. #endif+ ^( v; n: O( Z9 q( w* B9 ^! _1 ?. m
  53. ( \" z: S7 q( I. g; D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). U. A$ a3 L5 y. S+ b! m& q# D# }
  55. #define STATIC_SHIFT                3
    0 s$ Z: `( e2 F/ V/ H- f# Y
  56. #define TCINTEN_SHIFT               20
    1 E: @: ~3 l0 p5 v* A+ m2 [
  57. #define ITCINTEN_SHIFT              212 H7 v3 [" f9 z/ {9 R; m: ?$ h
  58. #define TCCHEN_SHIFT                22% E' f; X6 }8 g" j8 L5 v4 m8 y& i4 ]2 f7 o
  59. #define ITCCHEN_SHIFT               23
    0 O& e6 ?9 C3 t8 c

  60.   ?1 [' L. P' h1 X  T
  61. static volatile int irqraised1 = 0;- r/ r- ?0 |6 Y
  62. static volatile int irqraised2 = 0;
    4 v0 j( b7 n- T* K# a
  63. 7 e' g  B& z. i# t+ u/ @3 E4 p2 e% o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' \+ g: R( _2 h) X+ {# C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + o* A, G* U! M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 I4 P; a; w# M, ?

  67. * p$ ^# ?4 W' e& S0 f
  68. dma_addr_t dmaphyssrc1 = 0;
    7 x0 e: O. M0 D# p/ U) B5 j& I9 H% l
  69. dma_addr_t dmaphyssrc2 = 0;
    & W% s, D; v6 W# Y" Q  Y
  70. dma_addr_t dmaphysdest1 = 0;2 J, G8 q, e. n9 N  Q/ ^5 S! ]. {) B
  71. dma_addr_t dmaphysdest2 = 0;8 N: H2 m0 H3 I3 f6 e7 }7 z
  72. & H; G) Y3 m/ c. ?' @- s# `
  73. char *dmabufsrc1 = NULL;
    % v; Q$ F0 i% N* x7 j1 w- j: V
  74. char *dmabufsrc2 = NULL;
    2 I. _6 Q' y1 q9 I& N7 q6 f, d" C
  75. char *dmabufdest1 = NULL;
    & N3 v, L9 I; D: l$ O- R; V
  76. char *dmabufdest2 = NULL;
    + N" o! o, v; J8 Z

  77. ! n% V" `: }8 C
  78. static int acnt = 512;8 E; I, z9 \* v7 U- n
  79. static int bcnt = 8;! I2 L3 I9 {8 S5 \4 O" V
  80. static int ccnt = 8;
    . w: S- k8 `# G, J

  81. $ q& Q5 ]& L; k' N$ ~; o) f" G" i
  82. module_param(acnt, int, S_IRUGO);7 j/ q' w6 U$ A
  83. module_param(bcnt, int, S_IRUGO);
    % T% n4 @0 h8 `! F/ [/ _- W$ z3 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 F$ a/ `, p6 F6 o- k

6 p4 d3 I! q- @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, L$ W+ L4 ]1 S5 o, x: e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Y4 `6 r2 g# g( ~! E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i" C. P7 v4 T# a
6 J( I% [2 ]" J- k. K
, v1 E+ \0 n7 g" r& W# L, h; j7 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 13:05 , Processed in 0.040903 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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