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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' v* B' z1 w9 [# l
  1. [code]EDMA sample test application, e6 T/ u, q9 q9 _( _- }  @
  2. /*0 i! N9 P- I2 K. f9 s
  3. * edma_test.c
      _" y$ c) ^3 [2 x
  4. *
    4 b5 v- u+ A  u' L+ e) k
  5. * brief  EDMA3 Test Application
    9 s- [6 R* K3 x5 i: f
  6. *
    2 H8 }  F4 {' y$ E2 [( w4 g
  7. *   This file contains EDMA3 Test code.
    9 l; N8 ~4 O' o
  8. *! X; s5 t! \" ?- B6 f+ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l+ g" b7 ~; W* }9 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 F+ F: r/ D! B# m* Y* q1 c
  11. *         TO CHANGE.
    ! X* }* K" M! N4 K8 o9 b) Z
  12. *& H7 X' |) S1 I3 C* z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P9 ]" n3 I/ C: d5 }, n
  14. *. G( g; u' j# W6 J. P% U5 \
  15. * This program is free software; you can redistribute it and/or
    + B  f( ^. e! y( w- Z
  16. * modify it under the terms of the GNU General Public License as
    - }+ @! p& N; b2 p1 U' J: R4 c
  17. * published by the Free Software Foundation version 2.4 J) Q5 C9 O% p& {
  18. *
    2 _( n, Q' G/ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ?( w4 _& {7 h) Q
  20. * kind, whether express or implied; without even the implied warranty
    1 i9 v9 t5 O0 _/ I; H% v; e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: e) _* J. {* S! |( S9 k
  22. * GNU General Public License for more details.4 o+ }+ z* A  V
  23. */
    $ ^! I' S) ^- |7 z6 t

  24. ; M  D  V3 b4 @8 v/ B5 V
  25. #include <linux/module.h>
    7 N9 _) P, G+ _2 M1 r6 N  D
  26. #include <linux/init.h># F/ d  F. t% S- b( x% F8 i. _/ ~# a
  27. #include <linux/errno.h>
    % D/ j& k: y0 M& `8 S( x8 ]1 e
  28. #include <linux/types.h>
    4 H  T- c0 D) R8 f0 H( U
  29. #include <linux/interrupt.h>5 i! ^) I) f$ _; I- {% t. _
  30. #include <asm/io.h>
    0 t# y- a8 Z7 R$ P* S
  31. #include <linux/moduleparam.h>
    4 @4 ]8 R; W8 B0 |! T1 Y  r
  32. #include <linux/sysctl.h>
    & _+ R& _% Q+ W* d) h
  33. #include <linux/mm.h>
    % \2 V" R1 E3 ]5 e
  34. #include <linux/dma-mapping.h>
    4 ?9 g2 @8 \+ ^, C
  35. 9 y+ v$ Q# F6 O4 H8 L$ g  W& G8 g
  36. #include <mach/memory.h>/ B$ y0 j0 B, a5 b1 ^7 W
  37. #include <mach/hardware.h>
    % ~4 W( r, k' [$ d
  38. #include <mach/irqs.h>2 q! B/ F9 x& v7 q' p1 _
  39. #include <asm/hardware/edma.h>
    0 @1 A4 W$ U! Z- z8 n

  40. 8 t9 D" _9 ^2 Z0 b, E  x
  41. #undef EDMA3_DEBUG, [+ B0 Z7 |2 t8 ]1 E7 z
  42. /*#define EDMA3_DEBUG*/# Q# V4 k) F4 c2 q& s. {9 M7 d1 g
  43. & N- ^" {' R$ ^. r
  44. #ifdef EDMA3_DEBUG" l1 J9 @; W6 I1 ]- O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 m9 Y% \: i, B; e' s; q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- q+ ~: F  Z3 ]6 C1 H. h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 F  F1 F1 s! C, C
  48. #else( Z0 ]" ?* w" U4 `
  49. #define DMA_PRINTK( x... )% `- D& d$ k5 D8 R. x2 W. ?$ R
  50. #define DMA_FN_IN
    : z* Q( n2 A7 @& k6 N
  51. #define DMA_FN_OUT# q- G0 r/ W/ [8 K
  52. #endif$ Q) i# }4 e" h% I

  53. / r& s& s' G+ G  J( h+ @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  H) Y% x+ l+ C( m& o' h; J
  55. #define STATIC_SHIFT                3# m8 v, i* [: O0 q3 m
  56. #define TCINTEN_SHIFT               208 f( R6 y( y4 r' l2 K
  57. #define ITCINTEN_SHIFT              21
    6 j$ ?* v8 ]2 B+ T8 ~; D
  58. #define TCCHEN_SHIFT                22) V7 Y2 v1 D& a6 f; _$ z
  59. #define ITCCHEN_SHIFT               23
    ( l0 h, z7 X6 t# I

  60. 4 N* y: F2 B* ]* l0 ~" Q
  61. static volatile int irqraised1 = 0;+ |: c5 s6 p! O
  62. static volatile int irqraised2 = 0;
    0 s1 r, i6 L: _9 X$ E
  63. $ t  v! @# ^! x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 s' I( e  s7 r0 J! i& K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {  F5 M: O$ Q7 D& J4 z" l' i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 C2 K+ c% [" L0 F) L* y) Q3 ~
  67. 0 j1 M- ^/ V" z0 q- F7 Q, Z
  68. dma_addr_t dmaphyssrc1 = 0;9 ~( Z9 Y6 v9 o0 {- e# H0 m
  69. dma_addr_t dmaphyssrc2 = 0;
    ( y( [3 T; @4 A. q8 d
  70. dma_addr_t dmaphysdest1 = 0;/ F" P& n- e0 ?* u
  71. dma_addr_t dmaphysdest2 = 0;  d( ^$ f/ u! o7 R$ n
  72. & Y# w7 T# Z8 c
  73. char *dmabufsrc1 = NULL;
    / ?: U1 m) w' S( p! `
  74. char *dmabufsrc2 = NULL;
    ' k$ U0 `& R0 P0 y* v; }! b' @
  75. char *dmabufdest1 = NULL;
    3 B  M4 o3 t3 @3 N
  76. char *dmabufdest2 = NULL;
    # D1 w: n! e; a' W

  77. 1 X2 I; Q  e+ @, l; O, x
  78. static int acnt = 512;
    # e# T2 H9 R2 e
  79. static int bcnt = 8;5 E  U/ t4 M" p% v7 r
  80. static int ccnt = 8;
    ! X: D: S# D1 e3 A& b* K

  81. ' X0 f  Q/ N- H. r; e
  82. module_param(acnt, int, S_IRUGO);3 b0 V9 e: }# i; S  W  r/ p
  83. module_param(bcnt, int, S_IRUGO);
      Z6 ~9 n' H' D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 V0 k7 ]( J' ]$ u" d% u8 D* w5 `( p: E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c* A; B  K+ I$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" f9 P& [! @6 H$ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 f: ?$ ~4 R6 f* K2 u: ?! @  G$ Y$ j
2 i3 i5 O+ p* T& d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 04:15 , Processed in 0.038382 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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