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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . W6 K( v  |. C! I" A8 G4 p* q
  1. [code]EDMA sample test application8 b  I) g2 q+ C4 `6 Z
  2. /*# {7 [( A, o# A. }
  3. * edma_test.c1 [" c- J5 V; \3 x
  4. *
    8 r9 s5 F% X/ q( z$ e4 f1 S! j: t
  5. * brief  EDMA3 Test Application5 G1 d1 j+ _4 ]$ j, X1 o% ^' p4 R. \* @- u
  6. *
    / H( b! a1 Z0 Y
  7. *   This file contains EDMA3 Test code.4 r; ]: C: d7 \2 `8 E
  8. *7 f, p5 s3 H/ [# Q2 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; V2 [- \; j8 A% R( G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, X7 w1 X! r! S8 e. Y
  11. *         TO CHANGE.
    1 r# g: R. e  D' Y
  12. *! x! t$ e& A; l# q1 u: }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 r: `3 {  Z+ s, @; I4 M; i+ s7 I6 s! K* Q
  14. *4 W! O' j0 Z. W6 b1 E( t
  15. * This program is free software; you can redistribute it and/or
    1 j6 S% j1 R5 c, y
  16. * modify it under the terms of the GNU General Public License as) {: @" r% O* i. Y
  17. * published by the Free Software Foundation version 2.
    5 P0 C. M3 T2 t5 ^
  18. *, i5 V, N; x, F% r5 d" X% V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' r3 v9 p' z' c  ^: V2 J
  20. * kind, whether express or implied; without even the implied warranty$ B2 z" B& v" s2 f( j  }. g# @, F, ]9 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , S: }5 p4 x) m! J
  22. * GNU General Public License for more details.2 D; k  B( a. n0 a
  23. */
    3 t3 A  h- X! j

  24. 7 T  D5 I3 {! ?: Z6 Y. I
  25. #include <linux/module.h>
    " n' b2 N( Z( R$ Q, ^
  26. #include <linux/init.h>% R- q% O, i7 W6 \: u
  27. #include <linux/errno.h>8 t& f: G7 [8 _; }4 f, N" r5 ^
  28. #include <linux/types.h>0 S/ J" q" t; w- A  i/ ]
  29. #include <linux/interrupt.h>
    ; |- h, [& |! V& f% Z* b! E' ?
  30. #include <asm/io.h>9 y- v+ V( Y; _; I
  31. #include <linux/moduleparam.h>3 v" @& y5 \0 N5 \" d; N
  32. #include <linux/sysctl.h>
      z9 i, l! K, a6 F% u. {
  33. #include <linux/mm.h>
    5 u: o/ m7 y" l9 t) E" y
  34. #include <linux/dma-mapping.h>/ {; j1 |* g- G) g' t
  35. % m' j- D* [5 m( D0 ~! g& |
  36. #include <mach/memory.h>$ d9 V( n) ]! m- P
  37. #include <mach/hardware.h>% v+ _5 s0 q" z$ }
  38. #include <mach/irqs.h>
    6 {6 o! d' j6 N: ^. ~: v8 x1 _
  39. #include <asm/hardware/edma.h>% _+ r" O* o# u

  40. ) G& b: l/ p6 U) W- A4 @
  41. #undef EDMA3_DEBUG
    + G  B- s  b# d
  42. /*#define EDMA3_DEBUG*// t7 K. q( |" A$ A

  43. * F4 k  |3 f, b1 S7 d: W: k: ?
  44. #ifdef EDMA3_DEBUG$ F) v- V7 f. D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F. Y6 M. V$ d: m) M7 B' O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 U. e3 N2 B  }0 A7 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 X/ O, O+ r- ]* F6 Y4 ?' n
  48. #else3 f) `2 O2 L: o1 j7 h
  49. #define DMA_PRINTK( x... )  j! p; g8 _1 I& `5 b7 v; f4 f
  50. #define DMA_FN_IN. m3 D+ F9 N) U
  51. #define DMA_FN_OUT4 ]* r: h& l3 s2 p( |
  52. #endif: V- l# j$ B( ^5 f  a1 l; w3 D5 H( X* b
  53. $ }8 w5 O  K+ Y; [) m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# O' G5 b* m* n6 y# N" s8 v! M, ?# B
  55. #define STATIC_SHIFT                3
    8 W( W2 b* o8 q7 d% Y& g/ Y9 o
  56. #define TCINTEN_SHIFT               208 w! d7 w/ D; ]" I- S
  57. #define ITCINTEN_SHIFT              21- P+ Z+ X# |- S
  58. #define TCCHEN_SHIFT                22
      T& y; K7 _& D7 r
  59. #define ITCCHEN_SHIFT               234 e! \0 }; A2 R" W4 z) p) L
  60. 9 ]: G5 I2 A& r( I, e) }% H5 i, Z6 e
  61. static volatile int irqraised1 = 0;
    : ?- j4 l+ }" u& x6 J- r6 x! }. D
  62. static volatile int irqraised2 = 0;& q- B; ]9 e" e% K7 R1 z3 ^* T' p

  63. ) }" D+ a8 X0 O6 M0 @% |: ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I  E1 i/ p; g4 K) z$ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 t* a. X0 N( v+ M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ?( `* K- {6 M. I/ ?

  67. 0 z, i; H: ~3 L1 S
  68. dma_addr_t dmaphyssrc1 = 0;
    2 `# n' l* t3 j# _9 j
  69. dma_addr_t dmaphyssrc2 = 0;
    - O* C) r1 @/ {, y! w0 y9 z, {
  70. dma_addr_t dmaphysdest1 = 0;
    ! Q, Y4 W) S8 ]0 |- \
  71. dma_addr_t dmaphysdest2 = 0;$ x% B  U% Z" Y0 J9 j; X; ?- y, x

  72.   G9 e0 g0 `2 H# @
  73. char *dmabufsrc1 = NULL;
    + e. \! j+ d2 @8 t
  74. char *dmabufsrc2 = NULL;
    7 E( s5 V; z5 X
  75. char *dmabufdest1 = NULL;4 v9 W5 H) M1 d  {
  76. char *dmabufdest2 = NULL;0 F9 h' X8 Z( R0 w
  77. 0 M1 U  d8 z2 M! U* @. J
  78. static int acnt = 512;' I% N- o3 u5 ^* m: R# g
  79. static int bcnt = 8;8 G' R4 L1 }, K& Z# V! x
  80. static int ccnt = 8;
    ! x# w/ U2 t" S, |0 a/ y3 U8 n

  81. ' G, Y0 }, Q4 |6 D4 x1 ]$ V
  82. module_param(acnt, int, S_IRUGO);
    ! d8 T' d' J0 o7 g, _7 q# O2 f
  83. module_param(bcnt, int, S_IRUGO);
      p  O6 F& G# @! U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( n6 k$ _. k3 h3 P: W- |
, R* J! A4 j' t' x  X; y1 O8 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D. Y1 ]* ~/ h, _' B% g) Z; }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 z6 t4 e* l; U) O( q4 {# L# j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 I, @( I% G" {. k  ~& |9 Q  x

# G9 b6 l# |9 L. Z
' l* q5 _) ]! G& X- d3 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 11:18 , Processed in 0.041138 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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