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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% k/ |4 y+ E, ]
  1. [code]EDMA sample test application
    9 N3 ?: L4 k' ~3 @- o1 r  d; {
  2. /*
    , c4 V& H) d. A5 P* z
  3. * edma_test.c2 R" j* N  W8 S- C
  4. *
    0 g) K" j" }# z: N% q/ q6 W) }
  5. * brief  EDMA3 Test Application
    - d# N- a7 \; G5 o# c5 d# e
  6. *
    5 s# B0 t: O" |9 {, M1 F
  7. *   This file contains EDMA3 Test code.! `$ A" `* Q% x8 p! v( c
  8. *1 J! @, n9 H) {/ |9 f$ X7 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) a& p/ e6 S* y0 G: I  M; ]* Z% c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, n  M2 q1 J. V2 e
  11. *         TO CHANGE.
    , l9 Z9 r0 d2 \. z, y- l
  12. *
    8 l( ~$ f, @4 f- x5 G+ s) Y' D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 o( x  t1 _9 F( ?2 L
  14. *
    # s1 t+ I2 _3 C* v- b
  15. * This program is free software; you can redistribute it and/or
    6 s( a7 |! {" ^& u; P
  16. * modify it under the terms of the GNU General Public License as! t3 J% N! V0 I/ a0 e/ x2 g
  17. * published by the Free Software Foundation version 2.
    / E( N( x+ J2 g0 v  R; S+ D% ^
  18. *
    4 Q6 j  @1 F! }  {7 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  F0 F7 I8 x, t
  20. * kind, whether express or implied; without even the implied warranty
    : q5 E$ v0 W1 v8 M% J# X2 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 t5 j; L: ~' D, b
  22. * GNU General Public License for more details.
    4 L* s( Y0 S  i4 S" R: l& A
  23. */
    3 H" A8 k& ~" T" e7 }

  24. " J7 N% W! w1 ^, K( ^9 i
  25. #include <linux/module.h>. `9 K. y- R+ s2 B2 s: r. P8 V7 |
  26. #include <linux/init.h>. k! q. h+ {8 d8 @
  27. #include <linux/errno.h>
      \# ]; S1 T9 H2 M* v4 x% _3 k1 Y
  28. #include <linux/types.h>0 x! a: B; g8 D$ a
  29. #include <linux/interrupt.h>9 Y9 s( |( h; z3 B
  30. #include <asm/io.h>
    . ]) O# v) s) i! j2 o
  31. #include <linux/moduleparam.h>
    5 ]7 y: \: L3 K+ @' m
  32. #include <linux/sysctl.h>! N) x/ A9 R$ e5 V. m1 \% F" }
  33. #include <linux/mm.h>' Q# i1 z0 ~& b4 {2 k
  34. #include <linux/dma-mapping.h>2 l4 b9 t4 e2 t. `( m5 ]# ]+ X' T
  35. 8 I2 G! U, N7 w$ y; ?" U( I
  36. #include <mach/memory.h>
    ( p% j# E) p! k4 K  j
  37. #include <mach/hardware.h>2 r% }( z- q0 U9 {' R' H9 `" J
  38. #include <mach/irqs.h>1 ]+ T: i, h( `; {& q
  39. #include <asm/hardware/edma.h>
    & a7 T2 l3 P) Q: x" D, i3 u* l
  40. & c% \' X& ^, x' V3 k1 m# K6 \
  41. #undef EDMA3_DEBUG
    4 z8 N9 ~$ q/ o0 o
  42. /*#define EDMA3_DEBUG*/- _7 d( O/ T& _: Z5 n3 t
  43. + m8 N1 C9 T) q, x; ?5 w; \
  44. #ifdef EDMA3_DEBUG5 A: Q' l# g$ l; Z. O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! K8 i; D# D. a+ A% r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Y( q9 t* E$ f. ~& y6 I. h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), Q$ m# d4 H  f+ v" @( g! z% v
  48. #else
    & m# w$ h. E+ u' C9 ]" Y  G  ]: H
  49. #define DMA_PRINTK( x... )' N3 x. F2 h! j* n- H3 l0 S" @/ g
  50. #define DMA_FN_IN: E/ q  c/ i+ u- F1 D% p
  51. #define DMA_FN_OUT
      i3 y! `3 V( h. `2 ]. e: a( z, M
  52. #endif
    0 f# k5 @, h  u
  53. & s5 q3 T/ `3 m8 c, W- }9 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 @7 P, B# N+ V7 B  j4 C
  55. #define STATIC_SHIFT                3" w2 j) W/ j0 ~9 ?
  56. #define TCINTEN_SHIFT               20! s2 s% o9 V+ b/ R/ Y" m9 i
  57. #define ITCINTEN_SHIFT              210 U8 Y3 g* V+ e! T9 a+ s
  58. #define TCCHEN_SHIFT                22
      v) K2 c% Q+ P/ M, y
  59. #define ITCCHEN_SHIFT               23
    " d8 Z$ o) q# z$ k

  60. ! A, l4 n3 q$ I  ]* }# t( G4 \; `
  61. static volatile int irqraised1 = 0;
    8 [' N% j$ I  r" K  U4 h* P
  62. static volatile int irqraised2 = 0;
    # f2 }  _* Y9 \* A5 }( l8 Q
  63. - v2 N7 Y+ Q8 x8 f! X5 y; c  h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 w( `- e' W( F* o; f0 F) Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ c! R9 y. ]& u' u4 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G1 L, O; W  ]8 f7 O$ Q/ m

  67. , `( `! x4 ^) s3 @( o/ s/ m
  68. dma_addr_t dmaphyssrc1 = 0;
    ; o$ T$ l+ p% y; N. x
  69. dma_addr_t dmaphyssrc2 = 0;* c( w2 m4 g0 H  L
  70. dma_addr_t dmaphysdest1 = 0;9 a" s+ V2 @" a! q
  71. dma_addr_t dmaphysdest2 = 0;9 c( x# A+ R+ @7 W- k0 [
  72. - U: U  q/ P6 k
  73. char *dmabufsrc1 = NULL;
    / k+ }/ A2 D' b3 L  V) w' h
  74. char *dmabufsrc2 = NULL;1 K) e/ \% q9 v& Y- _& N, y
  75. char *dmabufdest1 = NULL;
    ) {& K& ^5 D4 C4 n/ F; Q, R9 D
  76. char *dmabufdest2 = NULL;" M+ ~7 p/ n$ X% ?' v

  77. 7 ]# U- ^3 S) V8 V
  78. static int acnt = 512;8 M- G4 c, ~" M
  79. static int bcnt = 8;
    ! D8 H. h  i6 M) s3 Y' @3 f3 |
  80. static int ccnt = 8;
    # X  u/ ]! n9 F, c+ c

  81. , C" B; i/ @$ I  ~6 V, C
  82. module_param(acnt, int, S_IRUGO);; r5 p* x8 [/ d9 U
  83. module_param(bcnt, int, S_IRUGO);
    $ r1 W2 F- Y. q+ D' n0 H$ P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) D5 J" o, B4 j

6 t6 a+ q1 B+ B$ `. n! |% B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. H( h& G$ F. j! e4 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 r* s' I# ]9 H, x. m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& @& b, V2 E! w7 n' S9 C. J  `

- o8 Q) H) F, s, P+ f
% W2 J; @1 A* ^5 f, H$ g0 b) F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 23:17 , Processed in 0.039037 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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