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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 d& W+ s* F: u9 \
  1. [code]EDMA sample test application
    ( C# l6 }* [; t; |* W
  2. /** N5 X/ `1 ]4 M" m' c' w
  3. * edma_test.c
    : X% C7 ^2 b' G0 P6 D0 ~8 o
  4. *
    9 z! Y$ g0 ~( l; V( a+ Y4 O
  5. * brief  EDMA3 Test Application- j- ?! k1 ^' Z. B: W
  6. *
    / T' w0 g( h. i! O& C% r- k
  7. *   This file contains EDMA3 Test code.
    + ^" [% z" C4 q0 I8 s, r3 M1 _
  8. *
    7 ]3 t; I) n6 E$ I4 U8 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! ^, i0 d! T9 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% M/ `& L& V1 n* \( d
  11. *         TO CHANGE.
    , R6 \' A! o+ Z) Q% b. ~
  12. *& n/ k" L  l) U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % U# {8 C" N' l  u
  14. *: z, y" B/ t! u
  15. * This program is free software; you can redistribute it and/or
    : L  J- G5 r4 i1 T+ K
  16. * modify it under the terms of the GNU General Public License as) r0 F. J; M5 D  L
  17. * published by the Free Software Foundation version 2.
    & i" @) m/ F8 ^( x
  18. *
    ' F& h! s/ H5 Q' @1 e: ?$ c0 _5 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. h% Z) ~9 P* R
  20. * kind, whether express or implied; without even the implied warranty
    + ]8 s- ~4 g6 X. Z4 ]' w) c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: j5 v- u# S% t1 F; J# x
  22. * GNU General Public License for more details.
    6 w; F, ]6 B4 c3 L3 o
  23. */! J" J5 P8 V; I3 y& u% ~
  24. , _) L. R7 a4 M& A1 R5 g
  25. #include <linux/module.h>
    3 k- Q# R! B0 I% g( e8 D  V- u, d
  26. #include <linux/init.h>
    ( d" n( K- f1 T: ~
  27. #include <linux/errno.h>4 U8 E* ~2 L! i: K. I8 u/ T
  28. #include <linux/types.h>
    3 }6 ~. ]. m  B& B, b$ T( ~: Q
  29. #include <linux/interrupt.h>
    / }6 j0 F& _4 |! ?4 B7 S0 a
  30. #include <asm/io.h>) @5 m# N; j% k2 m; m
  31. #include <linux/moduleparam.h>* j4 ]* P1 h( _% x! W
  32. #include <linux/sysctl.h>
    & W- ?  P5 D( ]1 C- {* W
  33. #include <linux/mm.h>
    $ W/ p6 V4 A3 v; z: G
  34. #include <linux/dma-mapping.h>
    # r0 ^* f0 }- p+ b9 }

  35. * [" y: x$ a! m$ S! N, f% N2 u
  36. #include <mach/memory.h>
    % Q( M! ]! u( g
  37. #include <mach/hardware.h>+ F2 |8 B  h. g1 V" f0 g
  38. #include <mach/irqs.h>
    # h+ ^; h3 ]7 G
  39. #include <asm/hardware/edma.h>8 V" F: z# t6 F; S# a/ J
  40. 5 I6 g" J9 y  Z
  41. #undef EDMA3_DEBUG  h2 z% t  j' Z1 _8 [% \
  42. /*#define EDMA3_DEBUG*/+ ?% A- y; E$ T$ p5 h/ M
  43. 6 f6 W0 d# l" n1 T
  44. #ifdef EDMA3_DEBUG) G" W7 H+ |4 _$ L" _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 p, X7 L( X/ T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& u# g/ u8 N; S. J; W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * |+ |2 y$ v& g1 q# S: n
  48. #else7 p; A; t3 o: f$ L
  49. #define DMA_PRINTK( x... )
    . e, o* y, E) m3 Y8 O8 y
  50. #define DMA_FN_IN
    , E$ N8 x0 `9 Z
  51. #define DMA_FN_OUT
    : c) U& i; {/ o8 U% k7 g% e
  52. #endif/ E4 \/ D- d% G9 ]

  53. " h9 y" E4 _* a) F. ~- Z7 ]2 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 ^  Q( P) g& f3 \3 K
  55. #define STATIC_SHIFT                3& R9 U1 Z( i5 W* r- Y6 V, C) c' T
  56. #define TCINTEN_SHIFT               20
    , M0 O6 p& @3 U7 a, B7 `
  57. #define ITCINTEN_SHIFT              21
    ! m$ {& H+ o) g4 l8 w" h  X+ ]
  58. #define TCCHEN_SHIFT                22
    9 z6 A/ [0 c: q6 K
  59. #define ITCCHEN_SHIFT               23
    7 F+ N8 w' |# L; m: d
  60. # y0 c6 l1 c  l% I" {" p9 j$ O3 h
  61. static volatile int irqraised1 = 0;
    8 O1 y4 ]/ V; ]7 r
  62. static volatile int irqraised2 = 0;' h4 y& I! s$ D: Y

  63. + ]. ]0 K7 R9 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * t3 v( I1 p/ k' Q% X7 ^$ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& @* R7 e( C1 U/ {1 q, _. m+ q% O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K* |; k$ F2 @% A9 s3 D

  67. 7 h% V, ~% _% `
  68. dma_addr_t dmaphyssrc1 = 0;
    " U. `8 H% s- k
  69. dma_addr_t dmaphyssrc2 = 0;1 @/ p. @& r$ b4 [$ o
  70. dma_addr_t dmaphysdest1 = 0;7 ^$ @. E; O+ u/ W, ?
  71. dma_addr_t dmaphysdest2 = 0;
    ) K  t; h0 h: W4 W' @; R

  72. 2 A& H) Y( v+ H
  73. char *dmabufsrc1 = NULL;
    ) M3 A$ r& S( A
  74. char *dmabufsrc2 = NULL;
    2 B2 l* O. Z3 _" F- B
  75. char *dmabufdest1 = NULL;
    ) h, p8 e% {' h( ~/ c& B5 t
  76. char *dmabufdest2 = NULL;
      \) q; _' R0 G  A

  77. 6 q4 d, F  p" a3 r# ]7 m% Z/ ~
  78. static int acnt = 512;
    0 E6 f: z4 S. h
  79. static int bcnt = 8;
    ! H" v, h  ?9 u9 E
  80. static int ccnt = 8;
    1 p& T* `; M+ l( u4 {

  81. ! s) m) }) [& y6 q0 g1 L7 M+ Y$ H, h
  82. module_param(acnt, int, S_IRUGO);
    / W# J& ~7 B# A2 _/ C
  83. module_param(bcnt, int, S_IRUGO);
    & x6 j: b9 s* [: T  e) B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 q% E- ?" _+ J1 E
& p) [2 B1 S2 w; I4 D) _  v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 N. a# b% m) o4 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& Z, W/ F4 u7 c% J1 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' A0 ^' S: T% k/ K
1 `. e4 X% s( o0 f

4 H% y  C3 M& ^1 \1 g( w  D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 04:41 , Processed in 0.043897 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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