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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ `  t+ a8 @* x% |
  1. [code]EDMA sample test application1 U' D' y3 r, j
  2. /*8 T) w! B4 Z3 h5 B0 \0 \- }5 S. {
  3. * edma_test.c
    7 [0 [% H) [. T' `* r0 ~
  4. *
    $ m; t* ^3 s4 c
  5. * brief  EDMA3 Test Application
    & K% M, O) O5 w2 ^( P
  6. *% T* k! d: o% s  ^( R; v
  7. *   This file contains EDMA3 Test code.
    ( c) l- M3 G7 W* T& k& T- N
  8. *% l# |/ M. l' `, t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 i. }% y$ v) V; v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - ?$ O2 F) `8 a. I( y  }
  11. *         TO CHANGE.2 o6 ~1 e6 R8 ?3 g# P
  12. */ B' F9 x* _! C: V8 Q& j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) u# X, p7 O2 S( Y$ V3 _
  14. *
    9 g, S/ m- A1 Y& U$ t+ P" t/ g
  15. * This program is free software; you can redistribute it and/or
    * {/ |* p& B% ~
  16. * modify it under the terms of the GNU General Public License as
    ; ?* L1 q# p& P1 N: u. ]* W# R3 U
  17. * published by the Free Software Foundation version 2.
    . R% B* M; D" e3 w  Q5 O
  18. *
    ) S5 k4 e' s8 a, Q+ k/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& V1 N" D3 J5 ~4 q% Q: J
  20. * kind, whether express or implied; without even the implied warranty
    , _6 r/ n' ]/ t0 z) p$ `6 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  N; J7 e8 E* N* N- I* X! @5 d
  22. * GNU General Public License for more details./ p3 x' F* n- ]. J# Y
  23. */0 K1 z- U# r# V+ R  Y. }( F

  24. . t( j8 s1 v$ F( n+ C  L+ V
  25. #include <linux/module.h>
    + W) y) e4 X+ w. R% m; Z
  26. #include <linux/init.h>
    7 _6 U( @/ T6 V2 @/ u5 o
  27. #include <linux/errno.h>
    ( D/ k" g- l! i) p- S
  28. #include <linux/types.h>
    3 B* Q( r* Y, l+ f; n
  29. #include <linux/interrupt.h>
    . \% G5 F& U1 L2 x  k6 K7 N
  30. #include <asm/io.h>2 _4 t# `7 Z9 ^/ e7 Z
  31. #include <linux/moduleparam.h>
    . ]7 U0 C9 G; T
  32. #include <linux/sysctl.h>% e% h; D3 t7 }8 c) ]0 r9 F8 |
  33. #include <linux/mm.h>
    $ z  }* Y" T: j/ F6 s1 T
  34. #include <linux/dma-mapping.h>
    4 f4 U7 w$ R# m# k1 `6 j: M
  35. 1 ?0 C" \  z  R* b8 B
  36. #include <mach/memory.h>
    5 ?' c6 V& w8 {! W
  37. #include <mach/hardware.h>2 J8 L, s2 P9 {6 V6 |
  38. #include <mach/irqs.h>
    ) Y% w. a+ u" o; A( E$ m
  39. #include <asm/hardware/edma.h>
    7 f8 `0 _7 X' a& _" C
  40. , w, ^, n9 W, m/ d( n1 f
  41. #undef EDMA3_DEBUG& t8 K' h# B/ ?) g: V
  42. /*#define EDMA3_DEBUG*/2 @2 s$ \) Y4 `& l; l

  43. 6 H2 C+ W0 \4 A  q2 i
  44. #ifdef EDMA3_DEBUG& Z: n' Y8 K: l& t5 U8 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 J: E( f: A+ u4 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Z0 x. s" F  e; B; Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 o, f  g/ \7 P) u# {
  48. #else
    2 C; R6 \  A4 `" `
  49. #define DMA_PRINTK( x... )
    " [& J1 D, W$ v3 @
  50. #define DMA_FN_IN
    ! Z) b$ }6 u5 T# m  t/ }
  51. #define DMA_FN_OUT$ L3 C/ D: P6 K
  52. #endif& j6 E$ k5 I/ [; z6 w" o( [( h# N

  53. 2 n0 U  n: A! y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  S0 C$ s# y3 i1 `: s5 {- J3 R
  55. #define STATIC_SHIFT                3# x' ]' f$ @% {  }6 A
  56. #define TCINTEN_SHIFT               20
    / |2 h* R( _' ]! Q* C' _
  57. #define ITCINTEN_SHIFT              21
    6 K" B$ y7 f' E  f
  58. #define TCCHEN_SHIFT                22
    . f( N" ~; N% J) V: V7 a5 a
  59. #define ITCCHEN_SHIFT               23
    7 N9 p0 a% v1 i, Z7 i

  60. 8 ~: e0 `8 L! K, m
  61. static volatile int irqraised1 = 0;$ v" a7 @  K* G# D  u
  62. static volatile int irqraised2 = 0;
    3 X  _4 F4 t% Y0 W1 a
  63. ! h% b: l+ {; i  Y5 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 V  l7 L3 K! D' ^! K; E9 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 x7 [- E. Q; a  N$ m1 T& N2 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i  @+ M0 g6 p+ C
  67. / v7 d% w+ `# s/ t- q) j
  68. dma_addr_t dmaphyssrc1 = 0;
    3 P$ j- t9 v& r$ a
  69. dma_addr_t dmaphyssrc2 = 0;
    $ Y9 x: [; X2 e8 H( d! m- V
  70. dma_addr_t dmaphysdest1 = 0;* G! t5 L0 t& F7 H
  71. dma_addr_t dmaphysdest2 = 0;  _" p2 _# A. x7 K; M* W4 L6 c7 p
  72. / v; {$ P' X- N- ~$ L
  73. char *dmabufsrc1 = NULL;
    " j- k# {+ ^- d; W7 n( `" p, L
  74. char *dmabufsrc2 = NULL;
    & P% S/ h2 H1 ^- L7 y* C
  75. char *dmabufdest1 = NULL;: {3 E  C% R. Q. _; l
  76. char *dmabufdest2 = NULL;
    ) e( J* D7 x- k
  77. ! F$ `% @. o& M; X/ S) R
  78. static int acnt = 512;
    & x3 a7 o! z# w8 l
  79. static int bcnt = 8;0 D$ V  p3 c& ?
  80. static int ccnt = 8;, f) y" E, @8 T; [2 t, N; q

  81.   E+ |2 i5 Q1 a. u
  82. module_param(acnt, int, S_IRUGO);
    - V3 Y8 G$ B  E
  83. module_param(bcnt, int, S_IRUGO);
    0 @! G' N! i0 @  M: i9 z5 l, p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ q3 m4 K' m+ Z" D

4 }" g, k6 W' S5 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 I. L! B; ^0 X8 M; {# i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( ]- D. s# f2 P! G1 Y, z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! Y* ]2 h/ V6 q1 I  E: D

' Q" d5 Q4 Y) Z0 |9 T0 a& S
! \2 g: K/ g) Y6 l: G' b- o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 00:22 , Processed in 0.040345 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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