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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ^) y. N. W, U- G6 v- ^% h
  1. [code]EDMA sample test application
    5 O" d' a4 r' B3 ~
  2. /*
    2 [' v! {* g: b* X# y
  3. * edma_test.c
    3 B; ?. Z$ l* E. R+ F
  4. *
    6 f* o5 Q' c5 o# {; o! l" _; D( W
  5. * brief  EDMA3 Test Application8 ], c' N) L6 m2 R0 X9 P
  6. *1 o1 u9 h  k$ E, `/ ], l! y
  7. *   This file contains EDMA3 Test code.; D- p9 a! c( I5 Y
  8. *
    ' v( B4 {7 }( M+ Y9 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 J  y1 l  E4 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- ?% W6 e5 X4 k/ e( p+ D
  11. *         TO CHANGE." N# v) O3 S; E4 s. @1 K, |4 b8 m3 Y
  12. *
    2 Z2 \  j/ X* _; a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; A" r" E) `5 ]4 j% b
  14. *
    , j! t$ ?5 I- c  b/ l  K
  15. * This program is free software; you can redistribute it and/or
    . n3 M7 L+ w6 @4 c- \: W7 V
  16. * modify it under the terms of the GNU General Public License as
    8 u/ N8 I) w# `1 N1 }  U$ m
  17. * published by the Free Software Foundation version 2.
    9 M2 H' }8 y. h% C- ^% ]/ e& l
  18. *
      |1 ~% u7 v5 `4 U' M3 J7 Z% F# o- k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. \6 a9 `. @5 }* x( Y
  20. * kind, whether express or implied; without even the implied warranty1 n% D8 d& S7 e3 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! z; r: r1 H1 V. G) r# ?
  22. * GNU General Public License for more details.
    . w! l4 R/ x9 G; ]7 o0 i
  23. */% B1 ^% \0 r$ C4 a. j! A7 a
  24. " E8 L" v3 C& z! Y+ B
  25. #include <linux/module.h>2 X7 b) u  h% \7 n7 e/ G
  26. #include <linux/init.h>
    " p- g2 u" V. g, O
  27. #include <linux/errno.h>; |( a/ O  k& E% z& v
  28. #include <linux/types.h>
    3 p! u( @6 b( Q5 o# X- _
  29. #include <linux/interrupt.h>
    . k) \& V& K( w
  30. #include <asm/io.h>
    ; v5 H' V8 }; ~
  31. #include <linux/moduleparam.h>
    " T; H" w! G( _: k1 W; H# f
  32. #include <linux/sysctl.h>" [  ]. J5 Q+ s; c2 s
  33. #include <linux/mm.h>+ ]* z4 O  ?5 {" l5 t# ?/ e
  34. #include <linux/dma-mapping.h>8 p' h  t- K0 t# Z1 N0 C2 g

  35.   G0 q) Q0 N" V7 a8 M1 N4 Q0 R
  36. #include <mach/memory.h>
    ! o6 j* ?: E7 d. j% g$ @' e* Z
  37. #include <mach/hardware.h>
    . h9 d+ @# j( V
  38. #include <mach/irqs.h>
    8 u5 r0 @: K$ v' M' N
  39. #include <asm/hardware/edma.h>) D! ?7 ]0 B- c( S* i6 S% q8 z# a

  40. & ]4 U1 U# s7 x: @% Q
  41. #undef EDMA3_DEBUG
    # }4 U1 t6 \- P0 D
  42. /*#define EDMA3_DEBUG*/; N. T0 O3 g6 t- r
  43. ' @3 d4 f. Q$ C7 T% a1 E& _! z! f
  44. #ifdef EDMA3_DEBUG3 Z5 l! c. e( i6 m& a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , G2 E! t, J: |* G; [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 M* E4 s; V3 q! D8 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " n7 ]) g- X' U) p* _
  48. #else: l5 R+ o' U, Y3 g% b1 N! G# g
  49. #define DMA_PRINTK( x... )
    & m7 t8 d$ [( D
  50. #define DMA_FN_IN
    & q, [* W7 g9 t7 n+ [
  51. #define DMA_FN_OUT, R: W; g% J. L; E8 b* w1 O$ s  h3 n
  52. #endif
    1 g  S- g4 a& [2 h: n- _8 k
  53.   L6 P+ C9 b2 b/ H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 `' M# L% ?3 b0 L
  55. #define STATIC_SHIFT                3# v. N7 B+ d7 F, q1 a7 q" P5 ]# S3 p" s
  56. #define TCINTEN_SHIFT               20
    4 ^. I; g0 ]( ?" l7 r+ N
  57. #define ITCINTEN_SHIFT              21) R- G  W3 S, y) w3 F
  58. #define TCCHEN_SHIFT                22
    ( D" _% E8 s+ V. B% \8 \4 U$ c6 o7 \
  59. #define ITCCHEN_SHIFT               23
    # M7 j- {1 k! ^/ @" Z- C; E

  60. , b+ g7 i* J& C6 O/ U
  61. static volatile int irqraised1 = 0;
    ! t: I( c! `$ S! z( o
  62. static volatile int irqraised2 = 0;
    , D& Y+ y. \6 }- d8 d7 U  C5 i

  63. 3 }$ E0 _6 [% J( M4 \  M4 I1 s  |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Q/ ~8 A7 t3 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. c7 k% N1 U/ P' Y* v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ N5 j9 }: v: d; c/ E' l

  67. & o) [: Z* ~0 X$ ^
  68. dma_addr_t dmaphyssrc1 = 0;
    & i! R' c; a, E4 T4 I$ N
  69. dma_addr_t dmaphyssrc2 = 0;
    0 B. L0 |2 o5 \. J7 h' |
  70. dma_addr_t dmaphysdest1 = 0;
    ! Q8 g0 J3 r6 z5 S
  71. dma_addr_t dmaphysdest2 = 0;
    ; v: Q+ d( T) T5 ]" m2 d
  72. $ M* Y1 t8 r  t5 S- m+ j( B% c, @
  73. char *dmabufsrc1 = NULL;
    & ?0 a8 t0 C. B
  74. char *dmabufsrc2 = NULL;
    2 z' A# Z! q0 y& N9 T5 g* s
  75. char *dmabufdest1 = NULL;4 ]5 n& p: y  ~
  76. char *dmabufdest2 = NULL;" g. H) u* c) K+ y
  77. ) ?5 E8 ?( v: G* {" _( i+ U
  78. static int acnt = 512;
    ) s9 h1 W4 j' j. }% b1 N1 t+ Q' p
  79. static int bcnt = 8;
    6 b  R# @, U  C! L
  80. static int ccnt = 8;9 h  q2 `, W# o) Q' n+ o. @8 D
  81. : S) @$ ?' z0 J! Y" H3 u
  82. module_param(acnt, int, S_IRUGO);
    ! W. t* U0 A4 `6 a
  83. module_param(bcnt, int, S_IRUGO);
    6 {; Q- [0 j; _. n6 e6 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 n! E6 I/ R: |, B

+ d1 Y+ ]8 l3 E" |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 M8 X5 _) R) h9 L0 i* u1 b# Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! F1 r, A" x* X$ }+ k- t2 R& G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' U7 v3 ~7 |: E7 ^. J- a0 A- c2 G( ]: q/ i2 K. z! [$ X

: ~/ u3 m) ~4 Z0 ^' s; N  C8 E1 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 20:46 , Processed in 0.039761 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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