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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, g( G: t) o# a6 Q
  1. [code]EDMA sample test application
    7 |3 J1 X+ x$ ~+ q- Q% J# s
  2. /*- Z/ P2 q3 q) I& }7 V
  3. * edma_test.c
    ' _# H+ |* Q8 E7 o% c* ^' n
  4. *
    ( `3 T" h: L8 Z+ B
  5. * brief  EDMA3 Test Application/ `' S* q6 `- _5 t$ Y2 J7 t$ n
  6. *
    & v# g/ [2 g$ E. ]
  7. *   This file contains EDMA3 Test code., [' L1 K0 n% l2 q0 ?
  8. *
    ' h9 A$ r, M* T0 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - V4 J3 k0 k- M% d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 `& E. R& l9 g* G" l' ]* _7 H  X
  11. *         TO CHANGE.4 S( D* S6 T0 n, s! {! r+ T
  12. *6 u& j' K8 Y) m- G+ _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , Y8 u2 i. a% }& t  p& A& S( x7 E% \
  14. *& Q/ w: z$ R/ m4 ^6 g/ J3 p; U' t9 M6 q
  15. * This program is free software; you can redistribute it and/or) s+ g! a1 T/ n
  16. * modify it under the terms of the GNU General Public License as
    6 J& D7 k2 }* H" q( K1 D: S
  17. * published by the Free Software Foundation version 2.
      i. ]% b4 U* X8 \% P
  18. *
    8 X0 _% \3 y* W( _7 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ P7 `, H2 P3 K7 ]- y- B1 E
  20. * kind, whether express or implied; without even the implied warranty
    : U) P$ C1 h1 g' x$ |; D  z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; J3 y1 V; o3 {* g
  22. * GNU General Public License for more details.* H8 I* e9 y3 J, ^7 ?( C
  23. */* i: U1 N6 [) ^) A9 T+ t2 g

  24. $ t5 }9 X! l8 C+ f$ k, u+ T
  25. #include <linux/module.h>
    6 a" g, L- M3 k
  26. #include <linux/init.h>
    ( f1 G, N3 C' `6 k  ~& V4 M
  27. #include <linux/errno.h>
    " B" `0 F0 D# G
  28. #include <linux/types.h>
    # [) s* R1 Q3 H/ q, [
  29. #include <linux/interrupt.h>
    ) f9 @2 n. J, e: i. p! X
  30. #include <asm/io.h>
    0 J# v6 i2 |8 Q6 I
  31. #include <linux/moduleparam.h>
    , `: M! w1 g$ w9 D7 A
  32. #include <linux/sysctl.h>, c( ]4 E2 S1 E: W' Y
  33. #include <linux/mm.h>
    * e1 z7 n: [3 d+ `
  34. #include <linux/dma-mapping.h>* x8 Z4 X# S7 a! T
  35. 3 d: K, ]+ }! ?1 R; S9 h& m
  36. #include <mach/memory.h>
    6 t% K' ^7 `) z* I: u7 L0 W
  37. #include <mach/hardware.h>: a4 g9 R  Q* V2 U( B6 `/ h: q
  38. #include <mach/irqs.h>
    / ?" D$ D1 z" g3 `& J
  39. #include <asm/hardware/edma.h>- x" ]* S( {4 q9 Y1 H. c

  40. 3 g* e3 S! t) n9 T4 A5 V# ]2 w6 H
  41. #undef EDMA3_DEBUG+ S& a6 I. n% h* L
  42. /*#define EDMA3_DEBUG*/
    0 C; J5 q* r" P  U. p/ B& i

  43. 5 {- D/ o; G" T0 ?( b
  44. #ifdef EDMA3_DEBUG
    $ {& U* ]; n, s& [9 X0 }: I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). s- Y4 R% l: H2 j4 I% r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! V- X( ^, v+ c' g. V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 N+ c0 b1 r: ]
  48. #else9 J9 i) o- b% ^( X2 ]
  49. #define DMA_PRINTK( x... )" W2 z( [& Z1 q& F; l
  50. #define DMA_FN_IN
    / x( b, `/ r& X( K4 y
  51. #define DMA_FN_OUT
    * D; f# ?5 E" G& j7 B! p3 h$ M( W
  52. #endif
    4 M8 Y' x6 J9 h  P
  53. - w+ D$ n6 E' a9 t5 [$ u  M0 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 J4 I; [7 \) Y
  55. #define STATIC_SHIFT                3
    5 A/ Y7 E2 e( x8 |. `
  56. #define TCINTEN_SHIFT               20
    ( m; x( B" F4 g; A1 b
  57. #define ITCINTEN_SHIFT              21! d. \  L6 a& Y4 i  l  Y2 C
  58. #define TCCHEN_SHIFT                22
    1 W; q" \6 {0 E  r
  59. #define ITCCHEN_SHIFT               23
    9 p" Q6 I) E+ ^( @  s2 I' s

  60.   d! j+ ?; t2 H8 G# Q. a4 b( i1 @
  61. static volatile int irqraised1 = 0;9 y2 {; I: U4 U
  62. static volatile int irqraised2 = 0;
    6 X8 C' h" e; A% U! {0 F
  63. " ~- u9 J: F3 Q3 F9 V) u2 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^. v) r6 n! h7 I& x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( L( x  U0 t) @1 p) `! w- w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c6 o- g& D. s* O
  67. 7 X: `1 J# J: H) g, Q
  68. dma_addr_t dmaphyssrc1 = 0;
    ) v5 d2 A* V# j/ e+ w+ N% y% H
  69. dma_addr_t dmaphyssrc2 = 0;7 }1 X* S/ c6 N# v
  70. dma_addr_t dmaphysdest1 = 0;2 _2 r: \, _$ y2 n: F  m2 I. ]
  71. dma_addr_t dmaphysdest2 = 0;
    $ u2 G. w* q- o6 x

  72. 0 ^' E" u, J( k+ _
  73. char *dmabufsrc1 = NULL;  p  \7 S6 ?" `; r+ ^4 @* u
  74. char *dmabufsrc2 = NULL;
    & X9 n1 h9 H8 ]
  75. char *dmabufdest1 = NULL;
    & q* ^/ `3 }, f$ r9 y2 e+ d* @
  76. char *dmabufdest2 = NULL;
    8 t* H& ?& V; g7 s8 B) _# B8 Q

  77. $ o; ]( X- o2 {" D3 h  A- T# ~  Q
  78. static int acnt = 512;
    / s/ ^7 J; D! `5 k. J7 t& z, O
  79. static int bcnt = 8;0 U. s2 Z" J* X. C. X
  80. static int ccnt = 8;5 i6 W9 M0 N2 f; |& _: |9 Y

  81.   n+ _+ E6 [* }* ]
  82. module_param(acnt, int, S_IRUGO);) ~1 \; W, N: H  z
  83. module_param(bcnt, int, S_IRUGO);2 \& h4 S- T/ Z# _+ m) ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' Q- R2 T  Z" h% h* c, l& V4 U) D) j: G- i  c  S5 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 l# ~5 N1 d+ ]# tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 {$ c& r. c6 a; ^9 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. R4 X+ w; `' h+ K  o& y2 M1 ~! \" G1 S4 ^5 [+ Y9 N: o
! o, S, d7 R8 i. L) e: ~; I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 12:32 , Processed in 0.040747 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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