OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: y1 O" O/ Y- f
  1. [code]EDMA sample test application4 X& Z4 u" h% Y7 K
  2. /*/ J1 e' t# c7 p4 }
  3. * edma_test.c
    - A8 z( _6 O# i# y2 |
  4. *
    ) I4 P2 w* X' k6 j: R% [" N
  5. * brief  EDMA3 Test Application
    7 K' J, p# L6 G4 e$ B" Q& U
  6. *0 Z: |4 {: Z/ H
  7. *   This file contains EDMA3 Test code.
    ! X/ p$ z% f6 R7 o1 `9 d: F+ A
  8. *
    7 X) B5 }% r; E: P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 M2 K. e. Y# y: s6 f( W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) h/ V( W4 v! ^
  11. *         TO CHANGE.+ a4 c! a7 a+ V5 A# M; ]1 i
  12. *
    . a! A' M$ e0 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ V$ S4 }! G) Y1 s: T: F: }9 S
  14. *$ O" b! P: j4 v  i  g5 s4 m
  15. * This program is free software; you can redistribute it and/or
    1 }7 ^) p% q% \; S$ p# O5 ^3 V5 X
  16. * modify it under the terms of the GNU General Public License as& j1 m; O0 b& e1 D* C9 p
  17. * published by the Free Software Foundation version 2.
    9 M8 ?& `( B- O# ]* \) @: ?
  18. *
    , l) |: Y4 {) }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 M" {+ L' u4 m1 X  r  a$ a2 j- C; ?
  20. * kind, whether express or implied; without even the implied warranty
    3 z8 c) N; ?" U+ a$ o9 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) n' {# ~: q* J$ n5 u; M- }" R+ e( n
  22. * GNU General Public License for more details.+ H0 |2 d( W& t/ j, z: @
  23. */8 m) Z( v. \9 H. c8 f

  24. - J! @- t" T2 ]
  25. #include <linux/module.h>* g4 U0 O" F" e+ n1 J, N& }' i  Q
  26. #include <linux/init.h>! I$ K  ]$ b4 @. L, C0 S1 R) [
  27. #include <linux/errno.h>
    / V: z3 }8 Q( g$ ~3 b2 J0 j7 v
  28. #include <linux/types.h>6 v! z* `+ ]/ n7 y: l2 \
  29. #include <linux/interrupt.h>
    ! [9 o' h, N! A4 c1 C7 k
  30. #include <asm/io.h>
    5 Q0 S! F) b0 a# O4 c! g+ u
  31. #include <linux/moduleparam.h>1 Z1 @& h' M. j  Z. ?* T
  32. #include <linux/sysctl.h># V$ j( H. a) ~: I$ @+ z
  33. #include <linux/mm.h>
    # G- o- ^7 s  a; O) _
  34. #include <linux/dma-mapping.h>
    4 q8 Y; L( ]3 W' ?

  35. 2 g9 I: T  W/ _' _; O+ t
  36. #include <mach/memory.h>
      {/ w2 n8 n: x$ ^% d. M
  37. #include <mach/hardware.h>' U4 M* x. H) G9 o
  38. #include <mach/irqs.h>8 d" y- R0 B* `# X8 V/ ]
  39. #include <asm/hardware/edma.h>) g) ]$ T, u% X5 W% C6 n8 z
  40. - _% p% r, n" y/ ^0 N* B+ K5 X
  41. #undef EDMA3_DEBUG
    9 ^2 v+ e, {* a
  42. /*#define EDMA3_DEBUG*/
    ! ^; P5 R* u, {+ E# |( @: }

  43. & T3 k3 o; V  }% s- ?
  44. #ifdef EDMA3_DEBUG
    1 g0 t( @) I1 V) l2 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 w4 A& R3 e7 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : R* t7 W8 z, g4 ?. g6 ]9 O5 x) W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Y: @* a  J+ d$ x
  48. #else
    ) H5 G4 J$ o: P4 a7 r
  49. #define DMA_PRINTK( x... )
    - m% m7 z% ?. |0 e
  50. #define DMA_FN_IN2 j, l$ N! ]% ]
  51. #define DMA_FN_OUT- |# j* Y/ B7 P4 _% ?8 O
  52. #endif
    & i1 j# y2 i! X& f/ f  ]
  53. 4 x# [3 ]; X5 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # {$ i) q; H$ _1 J( p
  55. #define STATIC_SHIFT                37 J5 W# p9 p. i4 u2 R
  56. #define TCINTEN_SHIFT               205 a$ M; W: N1 C* S
  57. #define ITCINTEN_SHIFT              21, ^' [0 R9 P) g  c: P5 e7 p
  58. #define TCCHEN_SHIFT                22
    , \* r/ c4 v% D1 h$ ~# ]  V
  59. #define ITCCHEN_SHIFT               237 R! W4 [* E2 z  ?" d
  60. & [6 g; F" C) t% y
  61. static volatile int irqraised1 = 0;
    0 k0 }, I! }7 f" O3 A
  62. static volatile int irqraised2 = 0;7 P3 k4 W7 h' D

  63. 9 m- _, B' Z5 g$ K8 G" P/ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 K' ^7 M8 A0 H/ t& ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % X, C* o& P" N, \0 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . H8 X+ j! u4 D0 }, s( f

  67. . q( L& h4 I4 w  v4 U
  68. dma_addr_t dmaphyssrc1 = 0;% x5 l# R2 [& @7 _  q, D. t" D2 y
  69. dma_addr_t dmaphyssrc2 = 0;
    $ f/ i6 X0 @% b; J& @# I" R: b
  70. dma_addr_t dmaphysdest1 = 0;  [# F- ?" `4 @1 m3 t
  71. dma_addr_t dmaphysdest2 = 0;% ]# D1 ?% P& \# u) t& {) a
  72. 1 i0 a& r4 R4 c+ |
  73. char *dmabufsrc1 = NULL;% j! l4 [- F& d* L! D
  74. char *dmabufsrc2 = NULL;
      I. t" v, [( _1 }( Z4 R
  75. char *dmabufdest1 = NULL;
    0 I! b. m1 T6 R3 U" H
  76. char *dmabufdest2 = NULL;
    / |4 n/ ]7 v0 W5 [4 L- S  i

  77. 9 m( `5 c2 H, L
  78. static int acnt = 512;* o; s0 w3 [- }) ]/ x
  79. static int bcnt = 8;; I9 U, ?0 R$ o# L6 I. o! @9 x% x
  80. static int ccnt = 8;# v: |1 Z! O# l* ]( B
  81. - B5 J; \) ]$ ?5 L  M
  82. module_param(acnt, int, S_IRUGO);3 `  I% q4 m$ W* e8 T
  83. module_param(bcnt, int, S_IRUGO);3 Q% y5 Q& @4 t! f% n2 q. [0 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 S  U; G: N4 h! X' z. ^
- F) f3 K. i9 u) j. b. l9 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# |# i. I# t( S% R# W" {( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ]( q7 ^5 N9 o7 S" e. W1 v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 F8 w( M4 u1 \, h# X7 z8 t: \  _2 x$ v& G+ I1 ^
) z' Z9 K  f: q( [' N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 13:08 , Processed in 0.037686 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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