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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" }4 F- `6 C% }/ o% b* |
  1. [code]EDMA sample test application
    8 s$ I7 f& T/ Z/ j! y( p) v
  2. /*
    ' S7 x3 O9 p3 s! h* T8 l
  3. * edma_test.c
    " r; P. H  v6 m( \- ~2 P. D
  4. *
    & ]& e7 e" O$ q) t. n$ s
  5. * brief  EDMA3 Test Application, u7 o. X4 p0 i8 z" C& [( V
  6. *  ~. N* C6 @. [4 h0 y6 C+ h6 e
  7. *   This file contains EDMA3 Test code.
    8 c7 z# o& H- @, h
  8. *7 j& ~) O- d# @( I" N1 Y4 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 U. v' Z+ E' y5 Y  m8 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 y! q) Y, A; O) M8 o7 \* o
  11. *         TO CHANGE.
    0 }; j1 M) }8 A* Z3 ^* C1 [1 J5 G
  12. *
    % [# Y0 F+ |, F4 k7 @$ Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + s0 h) c: G% j6 p2 |- b  l
  14. *
    1 e; W  i3 G: |0 Y
  15. * This program is free software; you can redistribute it and/or! \4 j* Y: M, N& y  ^; \5 A
  16. * modify it under the terms of the GNU General Public License as
    * g" [, N+ ^& Z2 h$ ?5 _
  17. * published by the Free Software Foundation version 2.) l( q: h  e+ M9 C8 A/ n
  18. *4 a3 P# e) c' k" Y1 B+ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 m% {9 ^$ Z; P1 n2 Y- l+ S
  20. * kind, whether express or implied; without even the implied warranty
    1 _9 V) P% q) u7 I) }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + H- p; V2 x& d8 |" Z  H
  22. * GNU General Public License for more details.+ _/ B1 |( U" @5 n8 `
  23. */
    ' S% }8 q2 x' W' I0 X, k2 a" v$ U

  24. ) `9 Z6 s( C% R6 Y) w
  25. #include <linux/module.h>
    : c, B! g1 s8 ~5 A
  26. #include <linux/init.h>, y' P" I" _# O* L& D0 E6 I% H  A
  27. #include <linux/errno.h>
    / e; e7 Z' z$ P) `+ W
  28. #include <linux/types.h>
    4 {5 J7 ~6 ]. y+ y3 Q  _# Y) {7 `
  29. #include <linux/interrupt.h>
    + K) F4 l  B: Y4 j5 D
  30. #include <asm/io.h>
    - U. U0 @' @& y: ~& A  j
  31. #include <linux/moduleparam.h>6 Y$ o. d2 E6 h0 C6 V7 |% R
  32. #include <linux/sysctl.h>' F, J9 U, j$ Y" ]! o
  33. #include <linux/mm.h>* O; X# S& U7 e
  34. #include <linux/dma-mapping.h>
    . R8 G3 f. u% ]. b  f# z0 G

  35. + x' E8 t4 v1 F; e. X8 i
  36. #include <mach/memory.h>1 c# k' R0 {: J/ r% T5 j
  37. #include <mach/hardware.h>
    $ w* c9 h. s, I! v& b
  38. #include <mach/irqs.h>
    - P2 g/ k; R1 {" o
  39. #include <asm/hardware/edma.h>
    3 A1 ]8 t: h) u$ U) Y: H" V
  40. 8 P7 d* {( W1 N  H7 ~1 ?4 B; f
  41. #undef EDMA3_DEBUG
    & `) |' B" m7 i& x. P
  42. /*#define EDMA3_DEBUG*/
    4 `4 j7 m3 s: @4 y7 D- W
  43. - c, `+ K+ `/ q0 z5 ^2 K5 d
  44. #ifdef EDMA3_DEBUG
    * t- i9 _! h( B0 {; ]5 D+ W4 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }# p% V0 K5 @, }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      s! j0 O  Z5 q% C4 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) S& f- k5 p& y! C; G
  48. #else7 e' F% o$ J' j8 Z
  49. #define DMA_PRINTK( x... )2 U2 Q" ~+ g' _! g, C2 e
  50. #define DMA_FN_IN
    2 v. ~( g; V5 ?& P* h
  51. #define DMA_FN_OUT8 Y) l: ~! g, z( `5 i: k
  52. #endif
    6 T: V# n! h7 E1 p* m: d9 L0 \
  53. 1 K  ?( X9 d9 A) d- _3 `( q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % [" d: Z. `. J0 _+ Z2 v" S+ {8 Z* B
  55. #define STATIC_SHIFT                37 c5 X+ b4 U  Q5 R3 R" Y
  56. #define TCINTEN_SHIFT               20/ P4 E- ^+ J& g
  57. #define ITCINTEN_SHIFT              21' c9 V- n8 ^/ \0 {+ }, S7 b3 a! V
  58. #define TCCHEN_SHIFT                22
    : [* z( a& j! l$ K3 l1 L8 f
  59. #define ITCCHEN_SHIFT               238 W9 A$ x- T, e) @) c$ Y' Y

  60. 9 b/ T$ e9 k$ e( \- r8 v8 T; i+ \
  61. static volatile int irqraised1 = 0;. g2 ]! y) x  J$ E8 C2 ~9 O
  62. static volatile int irqraised2 = 0;. B  q, X2 q6 V/ I0 i, B/ D
  63. / x% e1 B. `# {8 F" O1 t( I8 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l" v" R! }8 r( r2 r, U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : h- a" \6 d; `6 x5 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ f6 T% s" d8 {7 g( `4 a! q+ C
  67. 7 H( i, K* ^# F8 U9 R: a; J( \& h* j
  68. dma_addr_t dmaphyssrc1 = 0;1 D3 }0 t4 G) f) G
  69. dma_addr_t dmaphyssrc2 = 0;
    * _! V6 e. z" t5 b# {4 n- i' U5 h8 _
  70. dma_addr_t dmaphysdest1 = 0;7 d' n7 Z( _  p6 w% G
  71. dma_addr_t dmaphysdest2 = 0;
    # P. r/ f; I& F8 r

  72.   l5 m2 i+ ^1 H0 }  K/ K4 h
  73. char *dmabufsrc1 = NULL;
    0 d: {+ A8 o% w8 ~( o0 I# F
  74. char *dmabufsrc2 = NULL;9 y4 t, u7 r' }1 [
  75. char *dmabufdest1 = NULL;
    " I' l& g/ n- t# x' u
  76. char *dmabufdest2 = NULL;
    1 n0 w3 Z5 G# _4 o5 g0 ~# q0 Y( y

  77. 8 ~% j' E( L) N; ]* |! n
  78. static int acnt = 512;- j8 g" G/ c/ Z
  79. static int bcnt = 8;
    " q/ K4 h. i1 ~% j, t: s! M% {
  80. static int ccnt = 8;
    ) r& [. ^/ c2 K# w- g& D1 v& y7 u
  81. $ R/ h2 m) c1 |2 Q9 W% ]1 |
  82. module_param(acnt, int, S_IRUGO);
    & n) A! L! N3 W; P# \- L5 w, M  \
  83. module_param(bcnt, int, S_IRUGO);
    : `6 \; o* j. a0 M3 D6 c" @5 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- @+ J1 J* p  V0 W
: ?7 `5 u! V# w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 P! h- u( X* h8 v1 u6 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. i+ }0 y' D% b# j" l$ \4 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ^; h% I& p3 @3 u4 C' _
( P4 Y  B# o- I; D8 I$ M: u% s! Z2 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 03:10 , Processed in 0.045281 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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