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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 L( M0 p$ k( c5 ?- E% h/ c7 l
  1. [code]EDMA sample test application3 L; l  J, P( o# x: x
  2. /*1 Q: E9 P9 F' U+ ^0 ?
  3. * edma_test.c' w9 h# s$ ?: ]$ u& r+ j
  4. *: K" U* p: z" ?- t
  5. * brief  EDMA3 Test Application5 [6 K) ^% x# X2 W
  6. *, I: q& P1 Y+ }$ N6 y
  7. *   This file contains EDMA3 Test code.
    / E' _- e6 i8 Y' c: Y
  8. *
    . m; p* l' j( P6 f3 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - [) k7 T; ^% i* L. h6 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 ~# f* I1 Z  y; P2 `8 v+ v5 |
  11. *         TO CHANGE.- M  F; C% U( M3 B$ p7 |) j! ^
  12. *
    " N% w$ R3 u) ]3 o) M4 s% @# i+ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * a2 i( P, [. \( D) E, C
  14. *
    8 g9 o& X0 Z5 ~' W! ]. }/ b
  15. * This program is free software; you can redistribute it and/or
    ( m) `* N; z: D7 V, m3 j
  16. * modify it under the terms of the GNU General Public License as
    $ u" Q7 E0 {, G/ U
  17. * published by the Free Software Foundation version 2.) k3 ^3 q# Y* O
  18. *8 L4 y4 y: U! s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; k( X/ c- C0 l  x
  20. * kind, whether express or implied; without even the implied warranty
    9 ^* h# M4 ^: _7 J: X) n; [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " ~0 u. g: U$ ?9 o+ i+ Z
  22. * GNU General Public License for more details.
    % z: I3 `- M# h/ e* t
  23. */% J, }& Z' [3 j
  24. 6 l# {* {0 V9 k; s
  25. #include <linux/module.h>
    1 u" x- W5 q! Q2 k6 ~) `: ~
  26. #include <linux/init.h>  l! t7 y1 t" A4 r2 L
  27. #include <linux/errno.h>
    ' {2 T9 }) g, H) @+ m
  28. #include <linux/types.h>4 c/ W5 p9 n% A/ w3 ^7 t# ~
  29. #include <linux/interrupt.h>" ]& h/ m7 s. z; k. x7 N0 g( i
  30. #include <asm/io.h>6 Q8 b3 {0 S& d* ~/ B3 O
  31. #include <linux/moduleparam.h>
    $ j0 N; ~/ o  P
  32. #include <linux/sysctl.h>
    1 l% L! V5 `2 J0 r( v
  33. #include <linux/mm.h>
    0 ~) ?/ }/ I4 l8 L- E
  34. #include <linux/dma-mapping.h>
    1 I8 U5 `' Y% s& l+ J

  35. " y3 L5 @  q- R- K' d& j/ u$ n) Q: P
  36. #include <mach/memory.h>
      ^' _# H/ v2 U
  37. #include <mach/hardware.h>. ~3 d6 L2 ?4 x* p9 g& P: ?, R
  38. #include <mach/irqs.h>
    : ?, V1 ]" Q) Q0 m4 F1 h0 S' P
  39. #include <asm/hardware/edma.h>
    8 ]& @3 d- T& D+ J

  40. - r4 O* ~: A) w6 E
  41. #undef EDMA3_DEBUG
    6 A7 Q& \; l: E( W' \
  42. /*#define EDMA3_DEBUG*/9 I) R$ _- E! @, L& @/ t: I4 S  D
  43. % ]; d6 u# k$ D
  44. #ifdef EDMA3_DEBUG5 P6 D0 Q# E& w* T% G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 r- t5 n: d( Q, z5 C; ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , z6 B: H  n( f$ L. o5 h2 M( a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 v' F8 h( i, `* N6 T4 I3 Y
  48. #else
    6 m# Z6 O8 m# P# ^0 a  v; Q' i
  49. #define DMA_PRINTK( x... )
    0 D5 u* ?8 R6 |" u8 c
  50. #define DMA_FN_IN
    : M$ B$ l/ M, E# H4 g" ]
  51. #define DMA_FN_OUT
    8 }3 i% {4 @& r  [% ^) y8 ~" y
  52. #endif
    8 Z* O( [. M  ]0 A
  53. : K9 }* _/ |9 F. M3 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), M7 N. `) C8 p- C( V& N$ F6 }2 r
  55. #define STATIC_SHIFT                3
    $ N5 t/ c( e6 \" x5 @1 c
  56. #define TCINTEN_SHIFT               20
    # s$ z1 ~$ M& g! A1 C
  57. #define ITCINTEN_SHIFT              218 f' G- p8 g( W4 O2 T3 t; N
  58. #define TCCHEN_SHIFT                22
    ) Y1 t; g: k& F9 `& G8 u; b( E7 v) M
  59. #define ITCCHEN_SHIFT               23
    5 y9 |# p: x$ m4 B4 O* _

  60. 7 k* {& M) p! X$ E; x2 c: j4 E  p
  61. static volatile int irqraised1 = 0;$ ?: W' k$ ]; g& m$ K! m8 q0 c
  62. static volatile int irqraised2 = 0;
    8 u, m% a# r: t2 Y$ U

  63. & h7 t5 }- x' J& \4 i: s. g/ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' O* {- O- b! J# M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r  W1 N0 ~. k# \9 X  t- k3 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) q. X8 j8 ?% Y9 O2 Q. v
  67. 0 A3 S' V* z3 G, |) m3 N& a" |9 @
  68. dma_addr_t dmaphyssrc1 = 0;4 \, F! x* r' S( |  r1 O# i
  69. dma_addr_t dmaphyssrc2 = 0;) ~; Y6 c1 A( j8 j( k3 q; a
  70. dma_addr_t dmaphysdest1 = 0;2 u5 \1 `% l& h8 S' Y7 j4 ^
  71. dma_addr_t dmaphysdest2 = 0;; D+ \) ?. P* X% w
  72. 1 k" s- @: @2 M2 i% ~
  73. char *dmabufsrc1 = NULL;. u* f3 i5 K# _) e
  74. char *dmabufsrc2 = NULL;6 b# q: n) Z( Z  a) [
  75. char *dmabufdest1 = NULL;
    3 U6 C0 K2 a% M2 C" k
  76. char *dmabufdest2 = NULL;
    # W$ B# ]( m' ?. E, u. t
  77. 5 ^) h. U4 I  D5 c* ]2 y5 X* I
  78. static int acnt = 512;/ d2 j/ n- G' w1 b
  79. static int bcnt = 8;
    ! H/ o1 y$ H, l: t" f
  80. static int ccnt = 8;
    # k+ O9 k4 U. J" F

  81. 8 F7 T# Y( G! k( }* L+ N( j
  82. module_param(acnt, int, S_IRUGO);! r- ?( {2 E' L1 |$ R
  83. module_param(bcnt, int, S_IRUGO);" V& l, G  b1 U  `8 b$ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 t7 |: X; l: Q( D
6 t- j$ \0 L% w; P1 ]0 W% Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: c) n& x8 n9 j6 q2 j/ Q6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; e! _1 y, J' i6 B% `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: |* E/ Z! Y6 B$ e0 w+ n5 S0 }
9 H7 Q1 v; g8 B$ |9 |$ x& j+ O$ c2 B4 B2 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 08:40 , Processed in 0.037322 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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