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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. Q' R! g; G4 \! Z
  1. [code]EDMA sample test application" E# C0 O/ l  }$ \$ F5 R) I
  2. /*
    2 S1 r4 y' W+ r- r
  3. * edma_test.c
    8 V# v% l2 }: a5 Q
  4. *
    " ~" o6 D/ c/ N, {. l! G
  5. * brief  EDMA3 Test Application
      U- W5 R5 |7 Q4 \7 k' O1 s
  6. *
    1 w0 \# f$ P/ L. v
  7. *   This file contains EDMA3 Test code.
    : {4 {' n2 P, z# i3 U4 I3 F3 }+ @' u
  8. *; y- U2 S  z' K; C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 R9 z0 z7 b) `3 S4 ~. T& M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) R0 \( d. f9 Z2 |0 g- Z* o
  11. *         TO CHANGE.
    ) v9 g' b( a. }+ }# F; n+ X
  12. *
    # }0 z' }) a9 }5 E% y1 j9 X( m& O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; o/ P6 Y. Q3 I
  14. *
    ! G3 K  s. c1 n/ B$ q& @5 P# L
  15. * This program is free software; you can redistribute it and/or
    & w# m/ t- T* V# O
  16. * modify it under the terms of the GNU General Public License as
    2 ?* T, s! N3 G1 p
  17. * published by the Free Software Foundation version 2.6 v# E6 U$ I( g" {+ C; d
  18. *
    & V6 t4 ]. z3 [) l2 \" N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) c; J! g8 Q" ^8 E9 m
  20. * kind, whether express or implied; without even the implied warranty
    2 Z, s4 b, B! m9 b7 ]5 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 _5 P2 i! m2 d  D  R
  22. * GNU General Public License for more details.' G# G: A' [! }; q- _
  23. */
    4 M# o" Z2 N1 D* T) `& z7 @5 n
  24. % y1 R# R9 {, O- l3 M& I5 X
  25. #include <linux/module.h>
    0 ?' q1 t0 Y4 y4 L: B8 f5 P
  26. #include <linux/init.h>
    0 m8 W1 c& C7 a3 ^, s
  27. #include <linux/errno.h>
    ; c  x4 E, m! G$ z/ R" O8 y+ L' t
  28. #include <linux/types.h>" g% l* @: |% ~9 Q' e* k9 ^
  29. #include <linux/interrupt.h>0 ~( g- P3 S3 d* g3 W- E" X
  30. #include <asm/io.h>8 I$ y2 J3 o( |: G# }) P$ E8 Q
  31. #include <linux/moduleparam.h>
    # j8 [3 n5 x! n( n% X  o6 y) e0 }
  32. #include <linux/sysctl.h>
    / R" d  z# \4 p$ U
  33. #include <linux/mm.h>
    % P1 T9 I6 c5 F$ ~$ d
  34. #include <linux/dma-mapping.h>
      ~, Q4 A6 k  z

  35. ! z' n8 F- X) c& x
  36. #include <mach/memory.h>
    . N* T  ?* L( U/ a& l# q! S
  37. #include <mach/hardware.h>4 N0 w# x& A; Q' o- g+ V0 A. A6 Q
  38. #include <mach/irqs.h>& Z  k6 [* m- a/ N+ c
  39. #include <asm/hardware/edma.h>
    & J1 Q! W& R" w. h4 |

  40. : o( A( _, V; W, w. b
  41. #undef EDMA3_DEBUG  T/ k( \$ E6 N; t; I- R" |: s* B
  42. /*#define EDMA3_DEBUG*/
      C5 c2 w' p- O
  43. ! t8 W+ q, U" g" c, u! L7 `$ e5 \
  44. #ifdef EDMA3_DEBUG
      U& Q1 c- S9 w. M7 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 q$ y" L( s$ m  [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 {/ j2 G7 n4 Q# Y6 G# y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! `! W+ ?% z, E# Q0 P$ d; J
  48. #else
    3 T% X% l( Q" _/ d) G+ {. X
  49. #define DMA_PRINTK( x... )
    # l1 p! C9 l' H+ B% K
  50. #define DMA_FN_IN; W. r' h* F4 M; y9 U! Y, N
  51. #define DMA_FN_OUT8 s1 Q. A; _2 @0 k+ r& U3 g
  52. #endif* ~* a; g5 u9 _4 t
  53. 4 F, @5 v3 ]- J8 o/ D! x, A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      X9 s1 [1 C5 M+ M
  55. #define STATIC_SHIFT                3
    4 @1 z0 E. @7 H, c4 m/ x, }# ^
  56. #define TCINTEN_SHIFT               20
    " {; K/ Z! f+ B% Z6 E" u
  57. #define ITCINTEN_SHIFT              21
      J, M/ D( i9 F! k% A& @1 ^
  58. #define TCCHEN_SHIFT                22/ m$ t* ^- s! k6 |2 R6 R2 |
  59. #define ITCCHEN_SHIFT               23
    4 ]3 f$ c# P0 ]! G' n: L  L

  60.   ]) y. \1 m/ M7 E9 q+ G
  61. static volatile int irqraised1 = 0;
    ' l# S9 I) W, z# Q/ U
  62. static volatile int irqraised2 = 0;$ Q2 g* y4 f7 z' \/ `% q& o1 m) r1 U

  63. 4 S5 y  z4 m( T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q4 P, Y6 @- d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' T& k. r: ?. V2 E( ?& j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. t/ B! ^, d8 @5 d6 D; M
  67. ) M" }" ]. a# H0 G, A) w' I5 E
  68. dma_addr_t dmaphyssrc1 = 0;
      m/ z3 b. `- W6 N- d- Z" Y1 \
  69. dma_addr_t dmaphyssrc2 = 0;& i: ?  y6 z/ Y2 L# o! Y
  70. dma_addr_t dmaphysdest1 = 0;( F9 @0 M: T. D
  71. dma_addr_t dmaphysdest2 = 0;+ B0 D4 p' p. N% C6 o
  72. # I" r7 k' U, P6 e
  73. char *dmabufsrc1 = NULL;& O8 T0 G2 K0 a/ z: a! O
  74. char *dmabufsrc2 = NULL;2 ]: ]0 `4 I0 v( ]! F
  75. char *dmabufdest1 = NULL;! a! u1 |: |$ U
  76. char *dmabufdest2 = NULL;, a+ G: M: J. H- k  [" `1 Q$ G
  77. * j- B. U7 q! v( ?8 s9 x+ [2 t
  78. static int acnt = 512;; E! ~+ \; y  m" h
  79. static int bcnt = 8;
    - h% V8 j; i2 H- T4 c
  80. static int ccnt = 8;
    2 h5 ]5 F2 S( b3 @6 y/ B) ^6 j& A; k

  81. 5 ]6 O2 k' x# b9 j' O7 o
  82. module_param(acnt, int, S_IRUGO);
    , ?$ {; r: q4 m8 h* |' Y% T
  83. module_param(bcnt, int, S_IRUGO);
    # u( `% X! ]) @( w+ v5 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ P0 X+ ^. ?: E3 I" D1 V. `
6 \& u; _9 w$ T. `0 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 t* D) w  J: L# A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ?7 q9 c# ~" K; N" B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% {# R* u; j0 |/ H# Y6 C! Q  k& M) `2 q2 ?

: h3 m! p5 C) I$ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-4 16:48 , Processed in 0.040801 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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