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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" _$ l6 m  R+ P( W0 B8 \
  1. [code]EDMA sample test application  ?) R; j) a, P4 e$ a  R( f
  2. /*
    ; q6 n+ E3 v+ e6 H
  3. * edma_test.c
    9 K& G3 u5 j) x; k
  4. *
    # o- ?7 l. b) V. W; h
  5. * brief  EDMA3 Test Application
    & ~, i+ ^& _: I) q  \9 V0 O
  6. *
    7 N0 s9 [7 h! }- T" @( D5 r
  7. *   This file contains EDMA3 Test code.
    ' d6 a6 y1 b) ~, {; v7 B2 A: k& u
  8. *7 r9 l. Q" V& o  s. N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 ?. ^! ], o! Y) U7 z  \$ F% _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' L7 k" y9 `' f- \7 ?" V
  11. *         TO CHANGE., @! _; s6 B* m6 K6 Z
  12. *
    ; j% O/ _/ G9 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- N7 S+ U; [, r; y+ }
  14. *4 P: Z) N8 P0 D6 M( }: ^
  15. * This program is free software; you can redistribute it and/or8 s2 k: n2 f, c; p" ~
  16. * modify it under the terms of the GNU General Public License as
    5 `8 V4 f. e! a4 M# H8 T6 G
  17. * published by the Free Software Foundation version 2.
    " l: J4 v0 B$ F: Y8 K# D* ]
  18. *
    : Q7 w. A: o2 u! a8 x9 y( M5 h1 U7 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # A, g7 d7 x& P' _: {5 ^7 ?! A- A( K8 g
  20. * kind, whether express or implied; without even the implied warranty$ E7 _2 z: _8 m7 r, `! I8 A( J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& i$ q4 Z  G" I  r+ U& c0 l+ }
  22. * GNU General Public License for more details.
      S& D+ Y: G8 x) W/ ]: u7 c
  23. */3 \7 N* x+ v$ P2 e

  24. 7 L: A- B0 ]. D5 D
  25. #include <linux/module.h>( }' s+ m, k% @+ l4 n. C
  26. #include <linux/init.h>( d) L2 y$ n1 N7 e1 }! ]2 K7 ^0 J
  27. #include <linux/errno.h>
    2 k# \2 M$ t% b* G0 E
  28. #include <linux/types.h>5 ?) u+ K2 b! n& ~1 m5 _
  29. #include <linux/interrupt.h>
    + r3 D# S, r+ A3 q* m
  30. #include <asm/io.h>
    4 R( x0 L3 Y) r3 F
  31. #include <linux/moduleparam.h>2 w* e$ b; J2 c: A5 J- Z
  32. #include <linux/sysctl.h>
    - s4 o) K4 B7 S3 J
  33. #include <linux/mm.h>
    ! t  C9 g, t  m4 H2 c* O
  34. #include <linux/dma-mapping.h>
    ; L4 C; |  u8 Z3 I: h
  35. 8 k4 }, L' N$ N( V- J
  36. #include <mach/memory.h>; {/ h9 o' C$ ~
  37. #include <mach/hardware.h>1 {7 M, m/ Z' E& h$ S
  38. #include <mach/irqs.h>
    - i1 S) i3 f7 P
  39. #include <asm/hardware/edma.h>
    5 h* t" o4 N# m8 }$ k

  40. : |+ G; ?8 W1 B1 Y' n( X& J
  41. #undef EDMA3_DEBUG
    : R& C7 Q: c/ e, J2 w0 f1 ^
  42. /*#define EDMA3_DEBUG*/9 b; F- v2 w' l

  43. # V: _% }6 a, \" \
  44. #ifdef EDMA3_DEBUG
    8 S8 [, I  q( V8 C! U/ Y9 M1 R0 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , m9 M# X4 N( ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . H: f! ~( ?0 x& r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , D! E5 t0 v1 Y
  48. #else. J, I6 d3 V4 T4 [
  49. #define DMA_PRINTK( x... )+ C. D' F4 e; q/ X
  50. #define DMA_FN_IN
    ) y  J  U2 p, k. B6 c
  51. #define DMA_FN_OUT. p9 A' Z9 W% E( T5 }
  52. #endif
    ' |5 k) c1 A$ [

  53. 1 y3 o7 I( j! H1 X0 T' g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 K. x5 G  C  j4 \. F
  55. #define STATIC_SHIFT                35 S9 m( i1 z* u% j1 {5 b
  56. #define TCINTEN_SHIFT               20
    2 m" b- a! l" b& Z; u9 `& ^7 _) i" _
  57. #define ITCINTEN_SHIFT              21
    % Y7 l. n% k" X" e- ]* L3 B
  58. #define TCCHEN_SHIFT                22
    . }$ |" w# M1 i8 u$ e: N- i
  59. #define ITCCHEN_SHIFT               23
    % o* S/ g- v1 ?% u
  60. & M. ]+ u( A8 E4 v
  61. static volatile int irqraised1 = 0;
    ' ^9 Q) z' I5 _9 o$ q( }+ _
  62. static volatile int irqraised2 = 0;' q8 i0 [$ J8 m0 L4 d7 l/ X6 q: {

  63. % H7 C4 L7 H1 |: r, r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 D  j1 z" x3 c: c) b/ _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T# W: k; J. y: O5 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + r0 Z  [% s. s9 ~) `3 K& j
  67. ' X9 W9 l9 n4 P: F
  68. dma_addr_t dmaphyssrc1 = 0;
    6 t. ^" @4 v1 u* `% A& @6 Q! z# Y
  69. dma_addr_t dmaphyssrc2 = 0;; G/ j: h% V5 X# C; @
  70. dma_addr_t dmaphysdest1 = 0;6 |) T* @8 d# C+ m6 ~7 Y
  71. dma_addr_t dmaphysdest2 = 0;3 u+ J) {8 p2 n& J' o
  72. $ f" p4 Q, @" `
  73. char *dmabufsrc1 = NULL;
    + S# a! X( G, d1 }. W* e
  74. char *dmabufsrc2 = NULL;
    % g4 M, \& @) p5 }: R& E
  75. char *dmabufdest1 = NULL;8 Z# ~2 d3 z1 |9 G# r6 a" P  Y+ `. g
  76. char *dmabufdest2 = NULL;
    1 h3 M# o- B  b% S1 ?3 u  y) {
  77. ' r* v. ?- B7 g" s
  78. static int acnt = 512;
    & F& u) }! T! }6 h* ?+ \
  79. static int bcnt = 8;
    - K' i8 E' m* \! V# x: e* m
  80. static int ccnt = 8;
    4 k; G8 N( H- o8 A4 S- b

  81. 8 G' U; I. w1 q4 {; B
  82. module_param(acnt, int, S_IRUGO);' p+ z5 ]& i) l1 N1 X
  83. module_param(bcnt, int, S_IRUGO);
    , z) j. f- ~9 F& T6 ^9 U% E: G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ^4 y. l2 i/ ~7 i- z) W8 ~  E( N% l; r- y# c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. l. Z$ K1 M! Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, \& D6 j1 w; D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, R1 s4 m- f# c9 p& u6 ?
+ }/ q. U9 ]' f0 [' i* e0 o' D! p! g- n, `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 17:57 , Processed in 0.041242 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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