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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / V4 k6 o: ~3 U* f( j
  1. [code]EDMA sample test application( f! B% P& u* q
  2. /*: l0 {+ C  d/ a, B6 s' e
  3. * edma_test.c  Q4 J2 A" `8 C: e& B- f
  4. *
    7 V8 w! e. I/ l% y- w4 ?, {$ X
  5. * brief  EDMA3 Test Application) w" k2 ]8 O3 C; F
  6. *0 W5 H2 \; U. r; c  A0 ]
  7. *   This file contains EDMA3 Test code.7 m) l: p( M! x  N# l. {" F8 u
  8. *
    7 h& b$ n3 s" j$ V$ }* I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. a$ {& y! s  [: {. A) L3 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 t( B( x: i* c+ b' F
  11. *         TO CHANGE.
      D8 e( T# N; |! k" y! ^, k
  12. *( A1 t+ R8 l9 X0 A$ [) h5 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 J0 o% {* }; \4 f+ M; v
  14. *: ]% {# g# D* W7 |" y
  15. * This program is free software; you can redistribute it and/or
    0 u3 U1 C$ i0 a* f0 \
  16. * modify it under the terms of the GNU General Public License as$ A9 q& |' t2 k, N( m: I: G
  17. * published by the Free Software Foundation version 2.
    ! X# A! z, c8 p! R3 t' f+ P
  18. *3 A( ]3 p  h; ~$ u) F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Z2 q5 o) w' M5 K8 J9 _. C
  20. * kind, whether express or implied; without even the implied warranty* Y2 H* v, W2 |4 N: q* Y. N9 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - O/ W0 @5 p/ \$ }; Q' C$ Z
  22. * GNU General Public License for more details.$ y% A! D& t  I5 e0 u1 ?
  23. */
    % u; H; ^2 r: u) V6 H9 F1 |

  24. - M0 t0 x! x$ V' D/ a+ f3 X
  25. #include <linux/module.h>7 o: H5 o9 x2 ]# Z) H6 J& b
  26. #include <linux/init.h>
    , h% t* A1 b! g# ?
  27. #include <linux/errno.h>
    4 H3 D, ~( [; N8 [
  28. #include <linux/types.h>
    7 d" P$ [1 k+ h0 u
  29. #include <linux/interrupt.h>7 e7 d- ~. J* \; ~( V. @( ?: v9 l+ E. w
  30. #include <asm/io.h>
    5 }( O3 N( u! j# E& S$ t! N* L
  31. #include <linux/moduleparam.h>% A2 n7 I: h# Z" m' Q9 W1 o! f
  32. #include <linux/sysctl.h>
    1 R. U+ A* L  H$ @' ~( B, r. c
  33. #include <linux/mm.h>0 u8 J% |4 ~, @. b
  34. #include <linux/dma-mapping.h>
    % F; B& q& r8 b# `# r; P5 N$ v4 m6 G; B* c
  35. 0 F4 i4 D+ b+ ]
  36. #include <mach/memory.h>
    2 u0 u- C4 ]7 C2 a
  37. #include <mach/hardware.h>
    3 C0 I2 z  i1 k* d: O4 b+ r
  38. #include <mach/irqs.h># D: \0 q' N5 S. _
  39. #include <asm/hardware/edma.h>
    0 U3 l  p0 D, B

  40. ' s) e! v( I" ~9 [; U+ H
  41. #undef EDMA3_DEBUG
    9 |7 [5 ^' K/ T
  42. /*#define EDMA3_DEBUG*/
    # v. j* a- h9 u. c3 y
  43. , o- M) S2 z% [+ j) D5 [. V
  44. #ifdef EDMA3_DEBUG! S/ m* x: E8 u6 e1 D. `" o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): z9 G* b3 x7 p+ H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 E/ l. q) A6 J# [+ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 z- K, @3 r; J" h+ u' T1 @: ~
  48. #else& I- o/ {/ d; ~  O
  49. #define DMA_PRINTK( x... )( n! o. y: S8 C" n+ W
  50. #define DMA_FN_IN
    % R! D5 m, M$ F& q9 S8 s1 X( ?
  51. #define DMA_FN_OUT- e2 E4 @; t9 s/ U* ~
  52. #endif
    # z! Z5 M3 p- |

  53. / L, s9 A, L6 o# P9 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - `6 Q. C. |& p1 n" g
  55. #define STATIC_SHIFT                3
    5 l  n* Z$ d8 D0 }5 F
  56. #define TCINTEN_SHIFT               20
    % n$ [# a- I5 k6 ^# T9 F+ b. U3 u
  57. #define ITCINTEN_SHIFT              21! G" |% L8 R# f4 O& F) _9 n
  58. #define TCCHEN_SHIFT                22
    , E; @% M% r9 ^2 K
  59. #define ITCCHEN_SHIFT               23. j+ X+ ]$ Q" V; O+ G  Z1 T/ m
  60. 8 j; L  H+ r* w: u6 T
  61. static volatile int irqraised1 = 0;
    " ]$ r" ]9 y1 @9 a7 H7 J/ w
  62. static volatile int irqraised2 = 0;5 s7 ]9 Z4 M$ {6 ?

  63. ; [6 e& z  C, a6 N1 A$ K7 l: [' p  C4 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 B% [: p; E& B, x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / D9 U7 R) A$ V, C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u9 ^; t; e0 F( o
  67. 0 [) n8 O2 p* L$ M( t
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ^  e$ a; z4 H8 t; q$ \1 Y9 C
  69. dma_addr_t dmaphyssrc2 = 0;
    ) h9 C) z6 q* V8 N
  70. dma_addr_t dmaphysdest1 = 0;
    7 S2 u7 ~) d. }- T) a, C
  71. dma_addr_t dmaphysdest2 = 0;% t. D/ f! K1 t; O( O  Z

  72. 5 e8 j" Y/ F# h
  73. char *dmabufsrc1 = NULL;0 a( G2 ?& R: E% c
  74. char *dmabufsrc2 = NULL;
    7 y3 f5 i7 q0 `, s7 \8 N7 P: v
  75. char *dmabufdest1 = NULL;1 Z0 `* |* {* V2 W$ Y
  76. char *dmabufdest2 = NULL;: J0 A- ?+ b( V2 q& O+ q

  77. ' E$ {! v, @* h  L$ T/ J; p5 C
  78. static int acnt = 512;
    ! u1 j! }: L; f7 \/ Q; t4 E
  79. static int bcnt = 8;
    ! |. H3 ?% L; a# P# C5 \
  80. static int ccnt = 8;( ]% i5 m4 r2 u" H

  81. ' g$ r8 U) X5 f9 ~& }3 X# m6 l
  82. module_param(acnt, int, S_IRUGO);7 P5 o8 i" Z( `$ T0 O
  83. module_param(bcnt, int, S_IRUGO);
    : y5 f9 f% ^$ n2 d/ R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- T2 I) l7 _) t
4 l0 K) x6 E, Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 L' G+ z( {+ k5 I/ y) g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X# S& |2 n6 h) g) e" Z" o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N  [  g! w! K. _

# y+ [% o$ c: b6 k3 I
3 k4 t( k) _6 ^( h9 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 20:36 , Processed in 0.043349 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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