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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 q, [: R) f. H# @
  1. [code]EDMA sample test application# ?1 E) N% b6 o, E. x
  2. /*
    . f+ h0 b. e6 W7 j# y% V0 R* p8 A
  3. * edma_test.c6 J8 O" y  b7 V  W# l* I5 ?+ G
  4. *
    ; |. T; k9 s9 `9 g& {
  5. * brief  EDMA3 Test Application
    - g0 m. k9 |2 v
  6. *
    1 e* I# y; ~4 F  O
  7. *   This file contains EDMA3 Test code.
    - G' ?* Y( l4 Q! P: B% y/ P+ `/ s
  8. *8 h, V3 _6 ~: D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * Z$ N) p" W! M  L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 U6 C( X! H1 V1 [$ X
  11. *         TO CHANGE.9 U* Q& T6 Q% R8 s4 h0 C2 o
  12. *
    - K7 O; D* J( L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 T5 U& [! A! \8 q
  14. *
    ' `2 K% S/ t9 S
  15. * This program is free software; you can redistribute it and/or7 d, V0 ~3 r2 J7 o4 q
  16. * modify it under the terms of the GNU General Public License as4 i) R$ j/ F5 _# W* `' w! i
  17. * published by the Free Software Foundation version 2.- F3 `. d- p/ i* }
  18. *
    ( P" [7 o' a) P, g, A% y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " q- a5 ^( a( ~. J& `/ n" F
  20. * kind, whether express or implied; without even the implied warranty
    ! N$ p( K7 l0 _- |" W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 o# C  Q& f& y2 k& l
  22. * GNU General Public License for more details.
    / K% L* u& \3 Y# C9 N, T# D" J" |* ~
  23. */
    . L: a- o* C" g& i2 n6 w9 J# G  C

  24. % i. J8 R6 K4 t9 X! z
  25. #include <linux/module.h>
    ' F1 V9 M+ ^7 n! Y6 N
  26. #include <linux/init.h>
    % f+ c' N9 z0 d+ M
  27. #include <linux/errno.h>9 z% {* r  v- W1 S* x4 M7 ?$ J
  28. #include <linux/types.h>4 J" T  ?- ~- A
  29. #include <linux/interrupt.h>
    8 E5 E" W# W( n% c9 {7 H
  30. #include <asm/io.h>
    & I) U( z: H6 @( b6 P3 |) ?5 q
  31. #include <linux/moduleparam.h>6 ^; L/ x+ {6 v  B) q9 G
  32. #include <linux/sysctl.h>9 d+ a$ j4 [+ [
  33. #include <linux/mm.h>
    2 B0 G( `0 e/ s6 T
  34. #include <linux/dma-mapping.h>
    7 T  I* ^% {  x3 R8 T7 B
  35. ( G4 i& u& ?, c3 ~4 i
  36. #include <mach/memory.h>
    ; s6 W, N, C9 |
  37. #include <mach/hardware.h>
    ! o7 c* }& Q' `+ I) T
  38. #include <mach/irqs.h>& C" z& b! v/ ^) `& p/ F# y5 ^
  39. #include <asm/hardware/edma.h>: c  R0 o& w  w. f: N5 s1 y( L
  40. ' f! }0 l, q  C5 @& A
  41. #undef EDMA3_DEBUG
    # V1 M% w' U2 ]' @: f
  42. /*#define EDMA3_DEBUG*/; y3 y$ ~8 l+ G/ z5 i" p# f2 ?
  43. 4 N9 ]: ]7 |. u; V% s# a7 m& h
  44. #ifdef EDMA3_DEBUG+ ?1 N: a! p6 G, N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( M1 K: K3 P/ k8 ^0 V/ E/ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; Y5 X7 ~0 N- R7 g2 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  e% r& S8 V& E5 n
  48. #else6 y: S1 R! h  @+ a. |& `7 F8 K: S
  49. #define DMA_PRINTK( x... )( o6 h( A5 q* E
  50. #define DMA_FN_IN# ~0 g2 n- D( Z- t, ^! j
  51. #define DMA_FN_OUT& W& J4 R( i6 O
  52. #endif$ O% e, ^- n- i0 o
  53. ( o! v$ S5 ?4 }( Y* y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( F* X5 `0 ~! N  w
  55. #define STATIC_SHIFT                3
    # u0 y! U3 O  {; K7 I3 i* H
  56. #define TCINTEN_SHIFT               20- Z! |1 Y& W: Z9 l% u3 u5 c
  57. #define ITCINTEN_SHIFT              21
    + G4 t/ D5 i% \
  58. #define TCCHEN_SHIFT                22
    & u7 x$ H+ `0 m8 @7 t. E
  59. #define ITCCHEN_SHIFT               23! S  l5 T! R. V( W4 v5 R. l
  60. % o6 O/ K5 [" c* a3 S6 b* s" D
  61. static volatile int irqraised1 = 0;0 e4 V8 ~6 [+ d- [* N
  62. static volatile int irqraised2 = 0;' \3 R7 e+ R+ I4 o7 Z$ W
  63. . K" M7 s! E; N" r5 p$ O( w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 i7 A0 ^. [" \9 S- \2 J7 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e7 B) b2 Q8 g: s. h+ q4 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & v6 A$ i+ G6 r% r
  67. ; G4 M9 z- w* K8 ?9 H6 i! J, ?
  68. dma_addr_t dmaphyssrc1 = 0;
    9 L' p7 {* a$ K2 _' t7 ~
  69. dma_addr_t dmaphyssrc2 = 0;
    0 j6 D* V* D+ F4 d" D7 P, c5 r
  70. dma_addr_t dmaphysdest1 = 0;
    2 V4 P9 ?5 c* ?7 {( A
  71. dma_addr_t dmaphysdest2 = 0;
    ! o* E5 @  }! V
  72. * K2 g5 r  e( T2 t
  73. char *dmabufsrc1 = NULL;
    $ l& g) Z* R# d( W4 J
  74. char *dmabufsrc2 = NULL;4 M6 _. q( i8 d  s6 B( C
  75. char *dmabufdest1 = NULL;
    2 _7 e2 S# E/ o# p5 X( E6 C* W
  76. char *dmabufdest2 = NULL;
    ! V- ^- z7 Q& d6 w9 Z5 E3 Y5 q
  77. 2 h3 ~( ^% _/ h% m8 w, {( X3 H) D  ]. x
  78. static int acnt = 512;8 z1 c( A9 o; u6 z0 U
  79. static int bcnt = 8;
    0 ^- f$ G! r# i7 e
  80. static int ccnt = 8;: ]; a/ z8 \/ P+ A4 G; e
  81. 4 ?9 s" @* F" E7 \' e' B
  82. module_param(acnt, int, S_IRUGO);" u  z: \( c8 O, ?" A& Q' u
  83. module_param(bcnt, int, S_IRUGO);
    7 J9 a: x- B7 ?( C  I% U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! z% g* }& r& M" W
$ u; g1 v8 i( ~+ X7 P: D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ u; ^8 G7 W1 e% n; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ R* X/ e2 s3 t4 F! S0 }4 _  W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ z5 H0 l, u) F% l; B, U9 v, E

9 ]" P) t* S6 k5 a  _, G
: {9 L* l& g6 D1 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 21:16 , Processed in 0.052828 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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