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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 u8 h6 }) B9 y& S0 V9 T. G
  1. [code]EDMA sample test application
    4 I  f" Z7 w5 {% Q4 }& n6 x& z! Y
  2. /*/ t  s2 M, J" s6 i6 _
  3. * edma_test.c( W/ r4 g% J/ I4 k+ z% j
  4. *- Z0 N+ o# Q, _5 A5 z# @9 d
  5. * brief  EDMA3 Test Application4 @2 s3 f$ p' O& q: I8 y3 q
  6. ** J: u$ K7 P0 T% l& V/ g: q+ b
  7. *   This file contains EDMA3 Test code.
    . L+ d5 z* r" W0 v* J
  8. *0 P9 ]* b* @' Z- m6 B- X; |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 Q- c, m2 X; x( X; ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 L- u1 ~5 q( E: L
  11. *         TO CHANGE.
    : D3 E9 @3 q4 e+ b
  12. *
    + M" i9 |' T9 |4 |2 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, k/ s) q; }6 y1 a9 K' g
  14. ** B) F% e6 ?$ P1 a: h
  15. * This program is free software; you can redistribute it and/or: g0 Q, d+ @) F
  16. * modify it under the terms of the GNU General Public License as
    ) E- F" p5 H( V2 E6 |6 _6 h
  17. * published by the Free Software Foundation version 2.. v/ }  O4 T! ~4 m
  18. *
    + ^' m+ q  R1 P# {/ t5 K" _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" t7 |$ Y) }# V  S0 c) R+ a- ~( i3 J
  20. * kind, whether express or implied; without even the implied warranty
    ) i+ ~) f' L9 x5 D! {6 S6 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 }' E' c0 u- Q( g
  22. * GNU General Public License for more details./ x+ e0 f) b4 G, h$ V
  23. */; W2 y# c3 a2 ?+ {
  24. 2 n6 b) d/ q. _" r/ V
  25. #include <linux/module.h>
    2 z, Z0 j+ N( F4 {; Y6 c
  26. #include <linux/init.h>& }; s' l  \8 p( i- I8 u3 g0 M
  27. #include <linux/errno.h>: N2 Y* h3 c5 h
  28. #include <linux/types.h>
    : H6 S  L0 x  V  K0 L1 _* W
  29. #include <linux/interrupt.h>7 _5 n2 _+ w3 n- ]' e. L
  30. #include <asm/io.h>
    8 r8 s8 }. [& L; |
  31. #include <linux/moduleparam.h>
      F( R' q: Q# G/ B' D: G
  32. #include <linux/sysctl.h>
    8 K! x8 x1 j1 `
  33. #include <linux/mm.h>4 o3 P) f6 g' t/ B4 S$ s! j; {( L
  34. #include <linux/dma-mapping.h>
    8 b  _$ p% d4 E5 E5 Z- t

  35. 7 _) p# _8 H  @. z
  36. #include <mach/memory.h>; v3 y5 `4 x7 X$ n6 d9 N
  37. #include <mach/hardware.h>
    ! E3 y0 B0 k& A/ V7 x
  38. #include <mach/irqs.h>' O. [! H" V, a$ [$ Q+ N* P
  39. #include <asm/hardware/edma.h>2 v6 C( Y2 s" Z) z

  40. ( K# ~  e- U5 ]. D$ J; Q
  41. #undef EDMA3_DEBUG
    : `. k! v; H0 @6 b0 O  V* _
  42. /*#define EDMA3_DEBUG*/
    ( _% p. v2 t( b( k# B  X

  43.   `! l/ y$ k% d, V/ I7 W9 _: Y
  44. #ifdef EDMA3_DEBUG4 ?7 P, |) L3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * ^# W7 C# i. j- ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) l9 N% A* L. f# {- W" v9 w4 p9 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 h& {, Q# a; F
  48. #else
    ) I+ B! u! Q$ q7 G6 I1 C8 e
  49. #define DMA_PRINTK( x... )
    $ M: U# B0 e. {
  50. #define DMA_FN_IN
    8 C" q- `8 Y8 D1 W! \* ~' m2 j
  51. #define DMA_FN_OUT
    * _6 q" a/ l2 {
  52. #endif
    $ T# c3 q% X5 H' S" C2 z) n9 |$ P4 D

  53. + g( o7 ~1 ^/ l. |$ |- y3 \; e$ }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 ~: ^1 }% A9 \( \
  55. #define STATIC_SHIFT                3
    8 z9 g5 O8 b3 W% M! l+ G
  56. #define TCINTEN_SHIFT               20
    3 p9 D3 p5 D: h* m8 `
  57. #define ITCINTEN_SHIFT              218 F" V% g7 z% R. X# z6 [
  58. #define TCCHEN_SHIFT                22
    % g3 v1 `" q& e' x+ \+ _! g
  59. #define ITCCHEN_SHIFT               23& x% H3 ?# P% A+ X
  60. 4 H0 r( @2 P% \& H
  61. static volatile int irqraised1 = 0;7 F# M1 K' O( A5 f  k5 Y
  62. static volatile int irqraised2 = 0;+ y1 a. Q& ?& @& I  A* o
  63. * [, |. w. i* N  s% r( y! [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( E# C, t$ }/ }, d) U1 S" @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      H2 }! d- s3 M* W' V/ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [, C. B6 |& z4 l5 z4 X
  67. ( F8 D; B& b6 n  \" ~: y" u% E
  68. dma_addr_t dmaphyssrc1 = 0;
    7 T% Q0 e/ K: N
  69. dma_addr_t dmaphyssrc2 = 0;
    : X. A# N8 Y; J  V3 {- {
  70. dma_addr_t dmaphysdest1 = 0;9 x% l  d' ~1 k3 ]- |
  71. dma_addr_t dmaphysdest2 = 0;
    0 _% w& \/ U$ O. a' z/ l- g7 ]1 v
  72.   f4 R3 f. [9 u7 C
  73. char *dmabufsrc1 = NULL;
    6 [5 T1 _6 t7 q( q" T6 E
  74. char *dmabufsrc2 = NULL;
    / e9 \! W1 q" l4 [
  75. char *dmabufdest1 = NULL;* ^6 m- J% V4 A: s9 m! \( E
  76. char *dmabufdest2 = NULL;. @: b3 v7 G7 Z8 C5 d! h! q# l/ y
  77. : h# t( L$ C* O
  78. static int acnt = 512;1 y3 d9 I) o7 v; v- B( `& l
  79. static int bcnt = 8;
    $ @8 G  c; |! u) @3 G) ]
  80. static int ccnt = 8;
    - _7 I8 [0 L4 |% @

  81. $ S- |/ m$ i) Y3 H) \% |, ?, o
  82. module_param(acnt, int, S_IRUGO);9 K* f4 R+ X" T
  83. module_param(bcnt, int, S_IRUGO);; l. X0 q. ^( f, x& O& e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 ^- x5 P3 s; Y( r; n" G+ b$ c

- R$ Y2 Y9 y) _0 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 o9 z) ]- E' D# w" [# Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: l$ W/ N: i( s5 P" e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- p* V5 V) W/ b* N

, x' b! q+ C% T" P5 }- n7 \4 C& E& y3 i) V4 k+ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 18:51 , Processed in 0.039535 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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