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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H9 D4 Y6 j* @6 w8 K3 p5 |1 z
  1. [code]EDMA sample test application
    - w( v* O  I: D0 C' Y2 m7 O) m6 X
  2. /*
    % B# s- ]: _: B0 Q! e- x( @( m
  3. * edma_test.c
    ( @/ K3 F6 ^* I0 h5 f) W0 e4 N# C3 m
  4. *
    " @+ I0 ]. \# \7 ^4 W; q
  5. * brief  EDMA3 Test Application
      b7 {3 J, J, y' k
  6. *
    ( f& S" \1 h5 W
  7. *   This file contains EDMA3 Test code.- ~* s1 m6 O8 F/ F0 e
  8. *
      z, c0 J! L" r5 F5 V* |: B' W6 Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ t6 n( t% Z0 ]# A: y3 Q5 g7 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 b5 N( F6 _2 `+ D+ n
  11. *         TO CHANGE.' b2 _) b% J1 }; d& u6 `& S, s
  12. *# d3 U) s( k# P& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 A" ~5 m# M* I8 |. j. P2 A
  14. *
    6 g3 r) o% X" L; N
  15. * This program is free software; you can redistribute it and/or( }% P* c  ?2 T* G
  16. * modify it under the terms of the GNU General Public License as
    , s+ `" _  E6 u$ Y2 k& q9 f  z
  17. * published by the Free Software Foundation version 2.; i6 d. U9 G4 y2 h+ A
  18. *& a% f) d/ u5 t% }1 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # m$ O3 K, G/ p1 ~1 }4 w
  20. * kind, whether express or implied; without even the implied warranty6 l2 d: p4 h0 W; ^; X* J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) |6 D- `; D. N) Y& z1 U
  22. * GNU General Public License for more details.
    3 w- O; h# l- K0 B
  23. */- [4 \2 L" h* @/ L0 b4 r

  24. 5 \' z! I! {' d: F8 \+ q
  25. #include <linux/module.h>
    ( y, b: J0 f3 Z0 d) o3 r$ L6 p
  26. #include <linux/init.h>
    . m  S$ G, C9 k
  27. #include <linux/errno.h>7 w2 T3 y6 x* f$ H, B/ c
  28. #include <linux/types.h>
    # V3 q$ |& t6 f0 a! {$ m0 O! j
  29. #include <linux/interrupt.h>
    9 s4 J& J( Q8 i; }5 F
  30. #include <asm/io.h>" W. s& Z8 o$ T$ d
  31. #include <linux/moduleparam.h>& A, V# x- S/ _, m4 k$ f# I, S4 f
  32. #include <linux/sysctl.h>9 \" A+ N. o, W
  33. #include <linux/mm.h>4 N2 ]. ?- j1 p( v9 Z
  34. #include <linux/dma-mapping.h>
    0 M- R8 Q9 T' g2 R5 ?

  35. 9 k9 Y$ a! X& H* C0 d
  36. #include <mach/memory.h>" |) Q1 u0 _" _3 b5 @8 u4 X+ Q0 R; X
  37. #include <mach/hardware.h>3 e/ y9 M1 _1 H+ k+ d4 M. n
  38. #include <mach/irqs.h>/ g' v7 A) b, A4 A- Q
  39. #include <asm/hardware/edma.h>
    0 J0 B) `3 e; N

  40. . C: R) U0 \0 G- Q4 R
  41. #undef EDMA3_DEBUG
    . H3 }& y3 U& `0 D* X9 }+ D5 o
  42. /*#define EDMA3_DEBUG*/
    . l' o8 u  O; G2 Y4 m- i
  43. " {* v4 g/ Y, M% ^; t
  44. #ifdef EDMA3_DEBUG( E, X: U: a3 u" }: }1 _/ Q; D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , O3 L- p% c! K; ?8 P# d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # Z  X7 y0 V, L& O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 {8 V4 |1 w0 w( N, c1 J$ y8 W, D* O
  48. #else
    ; l/ ~& C2 N" n2 I1 z1 w( p; D
  49. #define DMA_PRINTK( x... )$ P- c1 P0 m9 e# u5 k0 d! y9 P
  50. #define DMA_FN_IN) z" ^. ~3 L& Z8 f, s
  51. #define DMA_FN_OUT
    7 A5 U) I" ~, p2 E3 f
  52. #endif
    6 i+ Q6 ?8 f( P) U- M3 [2 W4 D4 l1 N
  53. 4 @8 _8 ^# C3 V0 F% ~+ G; D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- {+ ]$ b$ S! [+ z. r
  55. #define STATIC_SHIFT                3+ g" A; i( Y0 l+ k+ Z
  56. #define TCINTEN_SHIFT               20
    5 e! H4 y8 H5 Y7 A  o  f
  57. #define ITCINTEN_SHIFT              21* ^2 d4 s2 @8 J! ~; k7 C2 p
  58. #define TCCHEN_SHIFT                22
    % s3 d9 m+ q+ S# \1 D+ Z7 j7 _
  59. #define ITCCHEN_SHIFT               237 g" |  A- d: D+ v' W* o+ ~. k
  60. ( t' b, ^& o1 t
  61. static volatile int irqraised1 = 0;$ U) F+ F& h7 o
  62. static volatile int irqraised2 = 0;+ J! O: `+ E( u) s4 I# x

  63. & Q, @) k& _5 j$ |, M& a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : f% m! W) s) r  ]5 H2 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 v/ h8 T& y+ a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 B5 q& a. d5 p8 g& j6 ]
  67. ; e  g& E+ `6 [( q0 d
  68. dma_addr_t dmaphyssrc1 = 0;7 N& c: `9 f# v
  69. dma_addr_t dmaphyssrc2 = 0;6 f- R: b( A% j4 u% y! ?* h
  70. dma_addr_t dmaphysdest1 = 0;
    0 f. _& p' E" X* b3 H  Q
  71. dma_addr_t dmaphysdest2 = 0;
    & ~- U4 j+ ]6 j# k* M4 i, _

  72. 1 j6 d" F9 a) I6 m8 Q+ x
  73. char *dmabufsrc1 = NULL;! e. K8 F; D% y8 f" ^$ ^- f8 y7 ?
  74. char *dmabufsrc2 = NULL;
    1 Y& j! p$ c. g. g8 {
  75. char *dmabufdest1 = NULL;
    ( S' w+ x# U( s& w
  76. char *dmabufdest2 = NULL;- I) V6 M- O, F
  77. ; H* d: s+ H% a% L3 u' w. r
  78. static int acnt = 512;' H/ S. l9 H4 `$ K  d
  79. static int bcnt = 8;  Z& U) v4 Y* z8 |( i) V7 P" b/ y
  80. static int ccnt = 8;! x: v# ?% d  D- l8 q

  81. 7 a% ?1 O0 f& c" @* s6 b: R* W0 c
  82. module_param(acnt, int, S_IRUGO);5 p( O+ W+ T6 N# ?5 D9 U' c. R' [
  83. module_param(bcnt, int, S_IRUGO);
    4 z; d8 p: h8 [, O( E8 |: k, M4 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' ~0 Z. N# p+ `1 f
) l: S' a% H5 i* G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% f+ i2 x  k/ l% [& z$ E0 L+ @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 b5 u% w9 v' t1 K+ m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- w: v) m. G/ U* ]! U9 y5 @
5 ~$ z, _5 N& P8 }9 [4 v
$ O/ y+ ?' K/ Q0 c# @/ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 21:59 , Processed in 0.038605 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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