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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ _1 s2 C( @. P
  1. [code]EDMA sample test application2 ]; N( V, c9 j0 h
  2. /*; r, R4 {5 T3 s; V: @% H( u
  3. * edma_test.c
    " o, T6 K, u: u9 l) }0 I
  4. *
    # B, {$ V. r8 {5 D2 f
  5. * brief  EDMA3 Test Application
    & k* a& x- J9 ]# @4 t- w
  6. *
    7 C# b- m) U1 A& F+ M
  7. *   This file contains EDMA3 Test code.
    - d! R8 w% a2 O! l
  8. *$ e6 d% n9 f5 ^' u5 I" }" g$ u5 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! m: I& w; ^) l! C6 B0 E: P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: ^9 \! N5 K' Z
  11. *         TO CHANGE.6 E' D6 n: ^7 e9 D" D; P
  12. *, C/ @* M2 t) s  C' M& y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 O( f2 T& x  }/ B
  14. *
    ! O+ }, B9 P  x6 _
  15. * This program is free software; you can redistribute it and/or
      ], b& d# u+ S  r
  16. * modify it under the terms of the GNU General Public License as
    + z6 W4 B4 ~+ K) p3 ]( B$ _* T; E
  17. * published by the Free Software Foundation version 2.& Y9 O. `. A- H: ?, N' y% w; F
  18. *
    $ I/ W8 a# V1 P/ [% I% L: H" p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! o+ O( f' ?0 B/ S5 O
  20. * kind, whether express or implied; without even the implied warranty
    3 [0 D% o9 W9 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ [' [/ B0 ]7 l4 V
  22. * GNU General Public License for more details.  T4 k/ d* @* a# L! {. `! i5 f) \
  23. */, K- N: p# Q1 ~5 t' |. z

  24. . J: [' B1 E# S' |! H/ \5 X: I2 _6 i
  25. #include <linux/module.h>8 Y& }+ n3 G1 K$ b" V% _  X
  26. #include <linux/init.h>- Y9 Z( N+ _: a8 g8 |  X
  27. #include <linux/errno.h>. P, Y: n( ]! `: O6 n' B5 F8 \6 }' N
  28. #include <linux/types.h># h& @! v, d/ w& [! P0 F, _
  29. #include <linux/interrupt.h>
    9 l1 ^: x- t/ D# A. k6 \9 A& x, d, @
  30. #include <asm/io.h>
    2 I6 ^. D3 |% ]1 ]7 C* \
  31. #include <linux/moduleparam.h>% W0 h* _) }/ W8 `$ x1 `3 m
  32. #include <linux/sysctl.h>+ g1 x+ M* K" ]+ k3 s
  33. #include <linux/mm.h>
    % w4 }, S, s# C/ ^
  34. #include <linux/dma-mapping.h>
    - ~5 M* Q! ^/ E* N' n$ r
  35. * w* N7 N7 Y2 |) |8 ~5 x9 j' V
  36. #include <mach/memory.h>; l  m/ e) V) S3 s. j, ^9 y# \
  37. #include <mach/hardware.h>
    8 n4 P/ ]% N" r/ v- t# Y
  38. #include <mach/irqs.h>
    ) r3 K/ Q8 s  k, }4 C
  39. #include <asm/hardware/edma.h>: l& q3 J4 p' `7 `+ h! r

  40. 3 p& G8 Q9 |. V5 k
  41. #undef EDMA3_DEBUG
    # I7 C+ D0 o% i0 k3 e
  42. /*#define EDMA3_DEBUG*/
    ( O9 t. q, k+ K! j) a# z
  43. ) ~$ P2 D" u/ w- i
  44. #ifdef EDMA3_DEBUG
    1 s9 h" z8 X! J! X+ q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; U5 y( P6 ~3 W! G5 L- Z+ R2 j8 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 w$ _1 u. h! i& k' ?9 c3 s1 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ n' I+ c6 a% B0 X# u! Q. Q/ T
  48. #else
    3 i; L5 q% z5 S7 W
  49. #define DMA_PRINTK( x... )
    6 ?7 d% o; k& K9 e) h; A( x
  50. #define DMA_FN_IN/ B% p- S/ C9 p- x: N) `' z
  51. #define DMA_FN_OUT
    9 h2 Q/ S8 R8 p4 w9 R& j: W; ?
  52. #endif
    3 ]4 b  @7 v5 ~: W! m, Q

  53. # m: J# N1 s  I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 v4 D, O5 u  I3 P" i% K
  55. #define STATIC_SHIFT                3
    ' k( I0 d, z6 X4 o5 u
  56. #define TCINTEN_SHIFT               20# }( {; [! c6 Q
  57. #define ITCINTEN_SHIFT              21/ p% K: E) u- t9 C/ e2 l
  58. #define TCCHEN_SHIFT                22' d6 H6 e: l9 @+ j+ q
  59. #define ITCCHEN_SHIFT               23
    " G+ t' U( q# U9 N2 L( b* I! r

  60.   b, @& p: v8 ^' b7 Q/ ~
  61. static volatile int irqraised1 = 0;
    3 B4 Z9 a0 z1 I2 c
  62. static volatile int irqraised2 = 0;5 ?% V5 d4 O' ]0 k4 J8 W% _
  63. 6 p8 t8 y5 u8 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * X- q& g( j$ V- X, Q5 F" w, X# `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# x  G8 Q* h4 a, I' R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / U6 X5 c3 W3 o5 ], R- H

  67. 6 N+ G" S$ A. w
  68. dma_addr_t dmaphyssrc1 = 0;
    0 p& P- Y6 Y; R, O/ i0 e
  69. dma_addr_t dmaphyssrc2 = 0;
    / N% T: g$ l% h  F! \' w& |
  70. dma_addr_t dmaphysdest1 = 0;
    ' B/ z, p, e* C7 e% f
  71. dma_addr_t dmaphysdest2 = 0;
    ! O( n9 _# v; F* N: F0 D, T

  72. ( v9 n+ ?1 P  V
  73. char *dmabufsrc1 = NULL;
    5 G7 i! x/ I" s) _: c
  74. char *dmabufsrc2 = NULL;
    6 d. y. {0 U: ?: r- a
  75. char *dmabufdest1 = NULL;
    7 P- h3 ~4 q5 w; ]* t/ \
  76. char *dmabufdest2 = NULL;
    2 H: E& \% w2 v- B; e8 j8 U
  77. ( I! h1 u3 v4 B. }2 D
  78. static int acnt = 512;
    & p' c0 C! r/ y/ L
  79. static int bcnt = 8;
    8 j  @- j- `3 R4 }: z
  80. static int ccnt = 8;
    8 f1 t6 D2 r+ r0 P  ?
  81. ' h! R8 U8 u  x4 r
  82. module_param(acnt, int, S_IRUGO);( F% C4 z2 Q5 E7 Z
  83. module_param(bcnt, int, S_IRUGO);1 @. X; V$ o7 s# J. }3 B. w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, z' v# r( o# |7 ^* f* ^. o
2 b5 s( M, e9 A. e7 E1 w1 A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 u9 [* G- p5 f8 t& Q/ Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" j% u5 a- a! s% m& w* _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ G+ i# v% W- ]& P. B% i( g* k/ u* c4 Z4 D$ N- L5 B& i- d0 K3 ^

: s, [& L6 a- r& B8 C2 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 12:36 , Processed in 0.042481 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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