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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 }2 J8 i. ~: q* s- ]% O
  1. [code]EDMA sample test application
    / S( x0 c7 v$ H8 I/ N
  2. /*
      R/ ^7 o# x5 H4 ^
  3. * edma_test.c
    2 u; i( s" f& A4 b
  4. *; L$ M, G! ~8 W/ N5 T
  5. * brief  EDMA3 Test Application% l' h9 H/ p9 |$ C3 }
  6. *
    ' N$ n' T& J( r. @6 f5 C& \% d
  7. *   This file contains EDMA3 Test code., L5 ]- f7 B" z9 M% `, j4 B
  8. *! Y9 Q$ D0 r. u( R3 w: o6 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' F$ \* \; z8 i" m4 O& i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! U; Z& P9 u! c. b' L$ P" I+ `8 Q+ f8 ^
  11. *         TO CHANGE.$ e& u  ^. D- C
  12. *
    + e# ?& Q9 ?+ t! Q, P1 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p9 N. B% p: _, m
  14. *
    2 b% d( m, B1 l0 m$ I2 U7 N
  15. * This program is free software; you can redistribute it and/or
    ! P0 f3 I. J  w( X
  16. * modify it under the terms of the GNU General Public License as( K* K# P: W% D& t. n
  17. * published by the Free Software Foundation version 2.6 c! Q% t8 U) c+ D+ r. l
  18. *3 m/ i5 f/ g+ j0 K8 k6 D6 R' ^0 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 z1 O4 z- J* X( h, |% d+ \
  20. * kind, whether express or implied; without even the implied warranty
    & @/ u; v' I( n: l0 F7 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 h2 q) X( ?, E) P+ \8 h$ _
  22. * GNU General Public License for more details.7 {+ Z/ c/ T7 `# u+ c
  23. */
    2 |" M4 {! s- J' e% M  _1 `
  24. - w" K; [8 O. u/ g( b3 p
  25. #include <linux/module.h>! T2 a# Z- I# W1 z4 O- _
  26. #include <linux/init.h>+ i+ m1 v+ \  i- A1 r
  27. #include <linux/errno.h>$ P; \; t0 d: j; d, Q$ b& n+ d
  28. #include <linux/types.h>
    - j* x) e6 J% V
  29. #include <linux/interrupt.h>
    . m. A$ Y1 b& W, g) _: k" p
  30. #include <asm/io.h>
    # h8 j! V  _2 e( `0 [0 F" {+ {/ Q
  31. #include <linux/moduleparam.h>( L; {- G3 a  ^
  32. #include <linux/sysctl.h>+ S* \! D( a9 }
  33. #include <linux/mm.h>
    % D: L* \% _5 n# n
  34. #include <linux/dma-mapping.h>
    2 r) N# D( \, ?0 d; Z9 ~' F& X/ w  R

  35. , ^- n( j5 U- V- d+ U8 \1 w# ~
  36. #include <mach/memory.h>2 W. K0 k# x% R5 D/ d
  37. #include <mach/hardware.h>
    : e9 Q" q$ |7 v
  38. #include <mach/irqs.h>
    ! m; L5 z. X* X! s6 t2 r
  39. #include <asm/hardware/edma.h>. ?- z6 ^+ N! X: j% g" D

  40. 9 o! v% D0 m8 }3 L# d+ m. }
  41. #undef EDMA3_DEBUG* A0 P2 @* L7 v3 V9 z
  42. /*#define EDMA3_DEBUG*/4 b0 Q! U9 F9 J1 k3 }

  43. ! C3 O) ?% B& Y  z: R  d
  44. #ifdef EDMA3_DEBUG# x1 G: ]& f& ^3 z. z4 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " t" n9 r$ c5 [) H$ c  R0 X& B  \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 ]: l7 e, \5 j9 [8 G; t/ _# U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      h9 c1 P# J, k# q- E5 t* p4 J
  48. #else  C: E' a6 ^$ |6 g: T
  49. #define DMA_PRINTK( x... )% v( a( M. y4 c2 \+ M
  50. #define DMA_FN_IN9 k/ `& |4 M  s' S# G5 r) {+ Z
  51. #define DMA_FN_OUT0 h& l6 Z" k# D: T4 `, M
  52. #endif
    5 s# B" {6 V; a) k0 e8 f
  53. : P2 M9 m" s7 |1 W8 X  {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 P7 q) X! A2 M! r9 Q
  55. #define STATIC_SHIFT                33 N0 }9 Y4 Q8 V0 A
  56. #define TCINTEN_SHIFT               20
    3 o& d9 p, ]4 t+ w% m- U) `& y
  57. #define ITCINTEN_SHIFT              21$ P4 |5 i  L2 C( C' a
  58. #define TCCHEN_SHIFT                225 O5 u; U- q9 e+ S5 f
  59. #define ITCCHEN_SHIFT               23% a, c; f: v' G5 S0 X: x5 j" _

  60. ; `* x) r4 ^  k- ]: S" r6 z
  61. static volatile int irqraised1 = 0;0 U( W% b9 d# T: [" C
  62. static volatile int irqraised2 = 0;
    7 }$ q. D: @8 k" |) O
  63. ( R' {% _3 @# G. q& R- l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( x) }! N) y  i3 e2 ^2 Q$ T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _  {9 U+ _+ n+ T- r' J) S9 x* q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^, @  L+ t- \3 O1 A% R& k  m  A
  67. 0 S  g* ]* @5 o- ~
  68. dma_addr_t dmaphyssrc1 = 0;
    9 d0 h9 e' _! e- g- W$ l2 U8 N& [
  69. dma_addr_t dmaphyssrc2 = 0;1 H. c! W' [  d3 I& m) B0 h
  70. dma_addr_t dmaphysdest1 = 0;
    9 Q) c7 s  M6 i( Q5 Q3 H
  71. dma_addr_t dmaphysdest2 = 0;6 s; u# q3 Z: [" B! _

  72. 1 T# J& o1 N/ X8 u
  73. char *dmabufsrc1 = NULL;
    : e4 R% w* A; |
  74. char *dmabufsrc2 = NULL;
    " G- U8 ^4 c) J) }
  75. char *dmabufdest1 = NULL;# \( _3 V/ J- R3 j
  76. char *dmabufdest2 = NULL;
    6 T! |8 \) ?3 s2 ^- v

  77. 3 G+ I1 `' J% L
  78. static int acnt = 512;; n  q5 [, |$ K0 M
  79. static int bcnt = 8;
      }! x1 P* X! y. b' X
  80. static int ccnt = 8;
    7 q2 T# E3 ~! M; S
  81.   }9 \/ b' m1 J; Y
  82. module_param(acnt, int, S_IRUGO);2 r4 w' l. ]" x  z7 Z5 ]
  83. module_param(bcnt, int, S_IRUGO);
    3 o" E) e( y# w+ k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 V9 @  r  F2 F0 E4 _( M8 l
5 ~0 b! ]7 z& ]9 \: p$ H/ n0 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- m7 z) G1 |6 v/ S: `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' u* J1 w: ~2 U5 r9 Y# ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' E9 V  ~$ q3 \0 a( ?; r0 P+ ~+ V% B7 }7 [
# N+ k+ x1 |; F3 Z+ r8 |3 [# q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 05:00 , Processed in 0.039761 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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