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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ n$ i% q' d2 O) C& h
  1. [code]EDMA sample test application) N. M3 \+ k* ]7 L* p" s
  2. /*
    ( f' t* z: z1 i8 H0 ]8 w+ {' y
  3. * edma_test.c
    ' r4 p6 R$ b5 M. r+ D0 w# [% l# H6 _
  4. *
    8 j; l0 O, t' F. ~& a6 }8 ^
  5. * brief  EDMA3 Test Application
    2 @& k8 X  I3 k6 R: R3 I
  6. *9 ^7 R* ?. o  b$ }
  7. *   This file contains EDMA3 Test code.1 Z: D  V, |. B
  8. *
    9 H: @1 e8 q7 {5 B3 w# W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 y% N+ U& g( V% R$ e; S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' H  a3 {, {1 ?5 R
  11. *         TO CHANGE.
    6 M, S+ Q" R: b$ O0 B
  12. *) n8 Z) L  p. Y# W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 P8 W+ N, x; p8 L. U1 r
  14. *$ R1 u7 f  ~% F2 \
  15. * This program is free software; you can redistribute it and/or
    3 c9 J! n2 J' n; |- M5 M
  16. * modify it under the terms of the GNU General Public License as) H9 k, _/ J+ u- G' T) b2 S
  17. * published by the Free Software Foundation version 2.( E) X/ p, s1 L) P9 l# m' F
  18. *9 e) M' D1 a0 A8 Z4 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      T8 B' D$ S& t3 T6 k" }
  20. * kind, whether express or implied; without even the implied warranty9 F5 S, n/ b* a' w( B( _+ O1 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) K- a9 A# _* D- o
  22. * GNU General Public License for more details.' T2 v7 d8 ~. y4 h
  23. */
    ) O1 Z# V6 J' C- N2 V3 ?& {4 l
  24. 9 r: X. F4 ^1 s# r
  25. #include <linux/module.h>& ^3 F- X  b0 O1 U! H5 C: {& p0 W
  26. #include <linux/init.h>
    5 }2 ?1 X/ W0 @. Z9 c& x* h
  27. #include <linux/errno.h>
    . c& C0 x' ?+ V  S
  28. #include <linux/types.h>
      C5 g) M. i' V7 P& K; ?  y3 n, x- ^
  29. #include <linux/interrupt.h>5 P) Q) O- ?. y: \) b
  30. #include <asm/io.h>
    , p" ?6 |( l4 \, w
  31. #include <linux/moduleparam.h>: J# N  v8 _! ]0 S# f' o
  32. #include <linux/sysctl.h>
    3 W. i3 w/ w5 G) d+ W, t2 ]7 g8 Q
  33. #include <linux/mm.h>& q1 F0 v  z- R* l% B
  34. #include <linux/dma-mapping.h>
      l4 _/ s$ j" Z. ~4 h! `

  35. ! ~, C3 N/ r* f1 L, v, i6 ~
  36. #include <mach/memory.h>
    7 ~( @) B1 P; q7 g
  37. #include <mach/hardware.h>- D; u/ a8 s5 B* A  L, J
  38. #include <mach/irqs.h>, G2 g: T$ ^% O6 v  t: Y* K
  39. #include <asm/hardware/edma.h>3 s# y; D/ [" v! X

  40. " w# n+ z2 m. I! }8 s7 Z, K7 ~$ o
  41. #undef EDMA3_DEBUG
    : w3 v, x" w& b! r
  42. /*#define EDMA3_DEBUG*/6 q9 W1 m' D5 H* \! ?# _

  43. * y$ U: b/ B3 _9 T0 K& g
  44. #ifdef EDMA3_DEBUG
    % s( y( L  \) R+ }( Q8 Q  y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + x% E4 t) x# h. r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ C; W- P3 h# h  }$ e5 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 _) o9 ~3 q; {+ ^; F, ~
  48. #else% F$ u! M0 Q$ J# u' c
  49. #define DMA_PRINTK( x... )
    9 \1 ]9 n" H& y0 h1 M/ ]: [7 Z7 [
  50. #define DMA_FN_IN4 K3 D8 V6 X- m8 [. K
  51. #define DMA_FN_OUT8 O( Y! F, q, l/ w# A
  52. #endif
    ) g9 e' x6 j/ U* [. b; f
  53. 6 K; B5 h( i  H  f2 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 F8 A7 W( j4 w2 b4 F
  55. #define STATIC_SHIFT                3$ T: p! ?2 U0 y1 j- m
  56. #define TCINTEN_SHIFT               20& z- u$ M; E- K4 {/ |, r
  57. #define ITCINTEN_SHIFT              217 D* e+ M( i( f! ]8 D5 J: Y0 F$ `" ]
  58. #define TCCHEN_SHIFT                22) o. D: d. f4 O9 y$ P
  59. #define ITCCHEN_SHIFT               23" x( L) c0 i7 r0 n- J! X1 b+ m
  60.   J- x# b( @7 E# q; p$ u1 ^3 S
  61. static volatile int irqraised1 = 0;( G) X' M* n# c6 P2 d- F
  62. static volatile int irqraised2 = 0;$ @. I3 D2 c/ c$ ?2 C6 k

  63. 8 c8 j1 c$ i, q2 K, a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ?( _9 _. d2 t* g9 A* j$ }2 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' O& ]3 G7 W# b7 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]4 y1 V1 L3 k& k) t9 e
  67. 3 u/ L- w7 r9 t5 C+ u/ c
  68. dma_addr_t dmaphyssrc1 = 0;% [- k$ C6 g- J: z
  69. dma_addr_t dmaphyssrc2 = 0;  Z( C" r& E( u9 p
  70. dma_addr_t dmaphysdest1 = 0;
    ) ~( v: l& _0 ~, O9 R6 o
  71. dma_addr_t dmaphysdest2 = 0;
    / f8 {3 {! ~, W

  72. 2 K) e# o$ A; T, w
  73. char *dmabufsrc1 = NULL;
    ) ?" L6 U1 M1 U3 ~, t: Z8 o
  74. char *dmabufsrc2 = NULL;: y! E  O2 u& a/ C* f
  75. char *dmabufdest1 = NULL;
      v! ?4 E' M' ]
  76. char *dmabufdest2 = NULL;
    - r; b% S  q9 n

  77. 7 y! f2 {0 l- A! U6 C+ h) d
  78. static int acnt = 512;
    " E& ~% _1 t$ ?8 t% j% X+ |3 \
  79. static int bcnt = 8;5 E2 U* N. t$ A* F
  80. static int ccnt = 8;
    5 G) u  M' r2 d+ S1 b- Y
  81. , H, \* R$ s' Z: t' Q1 e; [
  82. module_param(acnt, int, S_IRUGO);6 H  ^7 ?' p2 h; Z: C: S6 ]
  83. module_param(bcnt, int, S_IRUGO);
    3 Y) Q, }) H8 n! p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 x# O; d0 a5 e, R+ s! {

8 l! ^0 u: t! a& e9 O0 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. H# T9 a5 a8 v9 `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 _3 o( N7 e4 Y( y) P1 S& H8 K% `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" p! P5 R+ _9 z/ g/ R6 o
* _  C& Y3 L; B7 h' ]/ e4 E6 J
* @) u4 G3 Y7 T. g) A" d5 D8 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-24 18:17 , Processed in 0.041601 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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