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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  l* C6 o# [* i5 W
  1. [code]EDMA sample test application' g" S9 x& O. a; B/ j
  2. /*. g6 Q: j) p' e9 e% e
  3. * edma_test.c( U3 |( Z; t7 {4 D. F1 g4 @
  4. *; ^) |" p4 f# s! V7 e2 d/ ?
  5. * brief  EDMA3 Test Application
    8 _9 [, m8 P. s8 s# M& j
  6. *7 K. t( A4 C1 J1 ?  H7 h
  7. *   This file contains EDMA3 Test code./ \% U% Z6 D3 Z2 a6 C0 p; r; Y6 q
  8. *9 ]  g5 F  ?) O2 V% g% i! b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! j) v  q7 I4 L1 V* C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 S, L& N/ V, e4 G
  11. *         TO CHANGE.
    + M' y4 I2 m3 B2 y* ^
  12. *
    . p5 `5 a! F" f4 r6 k& H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 F' J: S* C1 ^% K
  14. *; ?0 K# C7 Q" g7 D! H
  15. * This program is free software; you can redistribute it and/or
    ( y! D2 z$ G  l$ O) n) N
  16. * modify it under the terms of the GNU General Public License as$ }% V* Z5 j+ ?* Y7 o# P
  17. * published by the Free Software Foundation version 2.
    2 q' d, m3 s5 g0 P: t, o
  18. *
    3 a3 d1 `" L5 I; g; L, }2 Q* [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ `% I+ Y; I0 U1 b; S/ D8 \/ k
  20. * kind, whether express or implied; without even the implied warranty
    / d: G0 L$ z& @- K5 m: i8 T! M) _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 |, h& f, V% ~! U
  22. * GNU General Public License for more details., F) f1 q$ h! K/ g
  23. */
    1 `1 u. _+ W& @7 ?

  24. " q: ~4 w+ E, ]  {: c2 Y
  25. #include <linux/module.h>
    + a+ \) f% o& K7 {
  26. #include <linux/init.h>0 ^" q2 F! t- Y0 ]
  27. #include <linux/errno.h>! s# I! b) p1 W! }
  28. #include <linux/types.h>* s+ R" E6 F+ l5 H
  29. #include <linux/interrupt.h>
    0 b) K& G- l# A$ C8 R9 w
  30. #include <asm/io.h>
    * I0 X+ C) ~* o2 A& s/ c
  31. #include <linux/moduleparam.h>3 O) t+ C$ Y; G0 n* a& |! ?  t. e
  32. #include <linux/sysctl.h>
    * j6 z& d. I, K
  33. #include <linux/mm.h>" D, n$ s# s+ e3 g3 v4 X4 E+ C' Q
  34. #include <linux/dma-mapping.h>) x; \; s8 C0 Q8 h+ {6 c+ A
  35. 5 D* ~- r* f' R  z0 `$ m
  36. #include <mach/memory.h>/ L  ]  k7 w: l5 i
  37. #include <mach/hardware.h>
    9 r: k" o3 [4 S3 @: t! y- x
  38. #include <mach/irqs.h>4 C- r: X9 o8 H. c" l6 t0 H' {
  39. #include <asm/hardware/edma.h>
    4 @) O4 F2 o1 x( {3 j/ {, X
  40. 7 e' C3 h( L- y+ i/ b
  41. #undef EDMA3_DEBUG, i* I! @, |" z& @4 ~
  42. /*#define EDMA3_DEBUG*/$ K! J7 d; e1 M8 I$ p: b

  43. ) S5 N' Z3 p1 s
  44. #ifdef EDMA3_DEBUG
    7 O& v' @3 L" p' C" b6 K2 v* O3 S. n* B- Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 ]- S6 K8 L5 i! [0 i7 A; X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & O# j; n* e/ u: U) |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 q) U; z4 M+ n/ ]2 I
  48. #else3 _- P1 w4 G& l; N. [' i, N- x
  49. #define DMA_PRINTK( x... )
    8 W& r9 D: [& Z; s$ ^* Q: j
  50. #define DMA_FN_IN
    - Y! [; \/ l# C& u" F
  51. #define DMA_FN_OUT4 s) U( f1 J/ Z! P
  52. #endif& g" G) s* z! Y, v" \5 X

  53. 6 j! m2 P% L/ [! f" }" x. Z0 g1 B7 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 ~6 ~0 G; z# I. J$ y2 t
  55. #define STATIC_SHIFT                3
    ( z* `1 j1 b& C& W/ s/ u
  56. #define TCINTEN_SHIFT               20
    ) t( _3 B. j# E2 N% q
  57. #define ITCINTEN_SHIFT              21
    2 |+ c& m( [# _
  58. #define TCCHEN_SHIFT                22
    # a! N# Q; g7 y3 v4 }0 T
  59. #define ITCCHEN_SHIFT               23
    ; @* {  r; s5 k( {. t; K) @" w
  60. * r' ?2 Y7 l9 s0 f) r8 P% R% _9 f
  61. static volatile int irqraised1 = 0;) C5 Z- ^. Q; `6 K* B9 L  Y* q
  62. static volatile int irqraised2 = 0;- s$ Y2 K1 m4 t3 q- E9 M+ p* Y. x

  63. " A/ x: }4 ^1 L1 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 A7 M  m3 X; T' O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R7 \6 D* y1 x" p% L0 M, d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / W# d! G) T+ T- r) g

  67. ' r7 `( h% L$ K
  68. dma_addr_t dmaphyssrc1 = 0;
    8 m& `& Z. o- q# ?8 ?% C% o
  69. dma_addr_t dmaphyssrc2 = 0;
    8 G% t, I- A  {7 }8 t) }
  70. dma_addr_t dmaphysdest1 = 0;
    ( {9 u( ~5 X  n& D8 e. S  [
  71. dma_addr_t dmaphysdest2 = 0;, k: V  [) ^* X3 B7 S1 k0 u
  72. # \3 p2 M' H  o* U3 ]5 _/ _
  73. char *dmabufsrc1 = NULL;
    + J* e: a1 [! I! }' b; q1 V  `
  74. char *dmabufsrc2 = NULL;9 e5 e2 J' L" v. f3 N8 ~$ h) V
  75. char *dmabufdest1 = NULL;
    & A: [; b" W; T2 {
  76. char *dmabufdest2 = NULL;0 n& f! }2 O% w  y7 O5 F/ P

  77. 4 Z" v% L  @* k% y4 }
  78. static int acnt = 512;
    ! p) d5 N3 n* r0 F$ g0 d
  79. static int bcnt = 8;
    + I; t% t0 O5 \
  80. static int ccnt = 8;" u) W5 e( R( _% ]$ z7 N. \

  81. # @4 [2 W8 p2 ~3 }/ Y% R1 W7 _
  82. module_param(acnt, int, S_IRUGO);
    4 h6 b. x& j. j7 {
  83. module_param(bcnt, int, S_IRUGO);& k' B3 i9 C$ T7 y5 L- i# t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) f' ?( b# b) b$ q* v
9 G. [( ~0 f* c& I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 m2 A- ]! n4 R0 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 l. y7 Y9 E, `9 J8 ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) @( N- J- M& G) h: V5 R" J2 c7 a2 w3 ?4 G* b2 A$ r2 n& t

" e' i) B3 P4 B% }7 `/ e8 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 22:51 , Processed in 0.039614 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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