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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ^, l7 U: D  X4 p  I: \
  1. [code]EDMA sample test application
    : N6 `! B& `/ g- q+ G
  2. /*7 D( k$ q2 D7 t/ h5 X$ z
  3. * edma_test.c
    - d  v9 f4 m; {. o$ v5 Y
  4. *
    + ]: v! c3 v+ G* Y
  5. * brief  EDMA3 Test Application/ `6 Q$ ]& L! y: x8 v9 V7 j* f
  6. *- V( ^3 B4 r  m% h
  7. *   This file contains EDMA3 Test code.7 u; m6 }4 H* j# l
  8. *8 ?0 [7 E  {3 `# k1 m" A7 B0 S. h6 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + h( S5 G" e6 ^# a0 M% \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & @: e, X2 D) e3 @" B
  11. *         TO CHANGE.
    # a$ J1 X2 O8 i
  12. *
    0 B9 j' X* `& d( w: W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % |8 r% n- d$ \' B! D& f+ Z
  14. *
    - S2 ]: V/ r5 N( \6 n" {
  15. * This program is free software; you can redistribute it and/or1 m' B! P9 s; H( U$ j
  16. * modify it under the terms of the GNU General Public License as5 [. V: N* u; J$ f) E7 H  k: b/ o; r
  17. * published by the Free Software Foundation version 2.1 t0 Z4 d8 G1 M4 x* s9 w2 \
  18. *0 O/ l6 G, I. s+ O" f3 x8 q$ B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- v/ ]  _1 m. o
  20. * kind, whether express or implied; without even the implied warranty- \+ h- p) m+ p& H) ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - w8 s& A9 M% U  g# k$ e
  22. * GNU General Public License for more details.
    4 `) f8 z0 K& |" M, H/ P
  23. */
    * J: @1 k* O& d6 X( G. i
  24. ' J1 @( @# E( A9 E
  25. #include <linux/module.h>
    . T' b3 i: c7 v
  26. #include <linux/init.h>+ l. A4 O) S& G  z9 j& C, I
  27. #include <linux/errno.h>
    . k! F7 V8 r3 g! O4 S- d$ o
  28. #include <linux/types.h>
    5 A+ R; r+ ~, {8 d
  29. #include <linux/interrupt.h>- Z8 F4 ~* i- d
  30. #include <asm/io.h>/ J) A3 t' z! Q5 c7 N) o. a
  31. #include <linux/moduleparam.h>
    9 [( K3 [1 B4 \- x7 q
  32. #include <linux/sysctl.h>* U6 _& B/ W; K/ s! x8 k
  33. #include <linux/mm.h>
    0 F; y3 j5 j( Z1 M5 b2 C7 N
  34. #include <linux/dma-mapping.h>. }  U- z- p4 _" I! H

  35. 5 `+ u0 w; W+ ^0 G0 \
  36. #include <mach/memory.h>" I# d! D0 b' q& @
  37. #include <mach/hardware.h>1 d$ o+ T8 u; S6 s  i0 D
  38. #include <mach/irqs.h>" e1 r7 b  {' Z' y3 t
  39. #include <asm/hardware/edma.h>
    ( r. W) I% c0 y2 l- c& C

  40. . B+ {# \5 i+ H+ p* [  B$ C
  41. #undef EDMA3_DEBUG
    ) |; {7 Y9 B# [' ~9 q
  42. /*#define EDMA3_DEBUG*/
    0 S- e% p$ M6 d- }4 K* j8 W

  43. 1 t: E+ [3 e- Z) a4 g' \5 o
  44. #ifdef EDMA3_DEBUG
    ; F0 j- e. F* @( Y* O0 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Z9 ?/ R1 f( q7 X+ p  C; X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 u6 K$ p' t+ z7 @1 a) n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) c/ p/ m/ T6 [  p8 o5 D! y
  48. #else" [4 J4 L% A% j( j1 f2 `
  49. #define DMA_PRINTK( x... )
    4 [' J: I5 e0 v, N0 F* c, n
  50. #define DMA_FN_IN
    / N# K* I$ T0 S- i( X
  51. #define DMA_FN_OUT' p. n2 x2 S# s3 [6 U3 }
  52. #endif1 W' r$ F1 K$ b

  53.   I$ U" ]7 K/ u+ S+ w2 ?- ~- I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : H  h+ ]& C" S4 P, [5 m& r" P' M* Z
  55. #define STATIC_SHIFT                3* `9 h$ f3 C7 Y% l
  56. #define TCINTEN_SHIFT               20
    & U+ S; F6 @% c. U  ?
  57. #define ITCINTEN_SHIFT              21
    8 C+ q3 T) ?. T- f% @
  58. #define TCCHEN_SHIFT                22
    * o$ J+ n9 M+ ~; w. e7 m$ K% U
  59. #define ITCCHEN_SHIFT               23
    9 X, D+ n4 i9 k! r- A7 A- Z
  60. 7 b$ q2 d* s# ]. `' W1 j7 ?
  61. static volatile int irqraised1 = 0;
    5 V6 b  W$ p9 ^$ e! m. g8 U
  62. static volatile int irqraised2 = 0;' N, C9 F2 N# w0 D- r7 z- z9 L

  63. & u1 D+ D: P' R2 F% t% N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ]$ z; Z* I" W' O$ w: H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J" s5 n. i. O6 q* L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. r2 x) C4 x9 t/ I2 T( ~

  67. & X0 C. N2 [9 c2 k. c* D5 b
  68. dma_addr_t dmaphyssrc1 = 0;4 |% u9 x, d$ B% J! ~0 u9 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    4 [7 W3 e; Z3 F! `  _& l9 b
  70. dma_addr_t dmaphysdest1 = 0;
    / x7 r* \- s* k0 u) l* |7 ?0 A6 |
  71. dma_addr_t dmaphysdest2 = 0;
    $ @# G+ J7 d0 P, @; h# h3 T0 Z, [' b2 U
  72. % r( X5 l' @0 ^
  73. char *dmabufsrc1 = NULL;" e; s$ F- T% g* D# f
  74. char *dmabufsrc2 = NULL;
    , ~! ~* F+ v" r3 `( G2 I$ J3 x; i
  75. char *dmabufdest1 = NULL;6 j7 v9 s/ A% e- [0 X
  76. char *dmabufdest2 = NULL;
    2 V2 N1 p$ i8 E) w0 C
  77. ( O7 T' i" _9 a, B
  78. static int acnt = 512;3 D0 ~3 u% x6 j* k' P
  79. static int bcnt = 8;+ R" I% U0 t% [' N
  80. static int ccnt = 8;) u( g+ h9 B% t$ B
  81. ; a) d2 h) g' C/ r+ }) p
  82. module_param(acnt, int, S_IRUGO);- a7 q9 ^3 `1 j0 n
  83. module_param(bcnt, int, S_IRUGO);
    6 |, O% q" z  s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: O) b+ H2 \" e2 F# H* L5 |1 b2 \9 e. M4 i! [8 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! {4 S0 i" H" w/ \9 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' k0 k$ X) ?9 H3 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 r+ v$ M# \% ^3 |: v6 Z

# r9 J' @. L' {% Z2 v# U# {4 a" J6 V+ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 08:04 , Processed in 0.041652 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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