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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) D0 F6 c+ x0 Q/ _
  1. [code]EDMA sample test application
    / q0 G0 C' I& o' ~
  2. /** ~& e; \7 ^6 D! |
  3. * edma_test.c
      O) ~# ~. w& q; e, f0 \
  4. *
    ! e- S: {; B( v& u% q) r2 Q- U
  5. * brief  EDMA3 Test Application/ j; ]  Q) _+ w* F% R. z6 H6 `) A3 {, P
  6. *
    . {  o  ^8 R- _! L) W
  7. *   This file contains EDMA3 Test code.9 V9 k# c: i; `9 ^
  8. *
    0 o. ~: e. j+ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 @- Q! ?) [. I+ @& O" g! q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% W1 s0 V/ a: C4 |$ w
  11. *         TO CHANGE.: q; \; W1 Y' T! O
  12. *: P! b5 b% I4 t  ]; x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & u& H% w4 \1 P$ k
  14. *
    / T# S4 q6 m' T' F
  15. * This program is free software; you can redistribute it and/or5 ^) R3 f& E' p  f8 f3 M# Q
  16. * modify it under the terms of the GNU General Public License as
    # i. q: u# G1 |! }2 p, ?! l, l; h
  17. * published by the Free Software Foundation version 2." i1 G- f, j( E9 D$ W" t! X7 m
  18. *6 j! F# ]" M9 t. j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Y6 Y- L$ M) W
  20. * kind, whether express or implied; without even the implied warranty
    ( ]9 G) J2 k; |/ t& ?* Q/ ^6 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; x. E* x! X2 Z; S9 l% A! z2 u/ w
  22. * GNU General Public License for more details.
    . i- l  T' s$ T1 D- J- I
  23. */
    " |* _' t9 X8 d) A  [
  24. , v3 B% e( Y1 ]1 o+ ?. w
  25. #include <linux/module.h>+ p" a4 \3 G+ O& h& u  {$ ]
  26. #include <linux/init.h>: m. [' ^) R! ^6 @6 c, }# v
  27. #include <linux/errno.h>
    + x3 E6 f/ [+ t7 }0 B! H
  28. #include <linux/types.h>) L. G  |, {0 I$ v7 L2 v+ u
  29. #include <linux/interrupt.h># g4 E3 O! J4 q
  30. #include <asm/io.h>( }2 f/ _1 F$ K. C6 J% s& E
  31. #include <linux/moduleparam.h>' [3 {( D2 Q5 Y# c( j# d8 ~
  32. #include <linux/sysctl.h>
    $ X! b4 @$ f' E1 `: H+ ?7 u9 t! [( B
  33. #include <linux/mm.h>- |( |6 a$ G: ]8 k1 X/ n
  34. #include <linux/dma-mapping.h>
    ! Z. O* w& Y$ n6 L' i# J) `

  35. 7 @  m* M5 ?& T& C  ?. Q2 f
  36. #include <mach/memory.h>" K8 r  Q5 _& Y7 ?! g1 V+ _! m$ n2 P
  37. #include <mach/hardware.h>( ]9 n( U7 [% a/ z8 D; p+ s+ a
  38. #include <mach/irqs.h>3 C1 Y1 ~6 e8 @: v7 I' |* a
  39. #include <asm/hardware/edma.h>
    % S/ J# j4 @6 d. ~
  40. ( ?: T8 T2 B+ {2 c) k
  41. #undef EDMA3_DEBUG0 }5 O8 B8 f8 T, q; E+ H. u" V. Y
  42. /*#define EDMA3_DEBUG*/
    ) d7 S( Q* g' \0 @* p% U1 a
  43. 2 l4 J- d+ b7 n+ W% C
  44. #ifdef EDMA3_DEBUG1 H0 r0 ]! A! C6 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): ^! q6 S7 I# L; q  z) Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ f7 G0 m; X1 ^, s1 a# [, {( w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      g' j1 J. `. k* F7 H
  48. #else
    2 T! n0 z0 s" |) }6 w/ o
  49. #define DMA_PRINTK( x... )" [' I! n' z' A; H! S
  50. #define DMA_FN_IN
    4 i+ d1 |* _; I
  51. #define DMA_FN_OUT1 b4 ?: _0 h7 z" j" _5 ^! P
  52. #endif( H2 ?" c, z$ {2 @4 v+ }

  53. 7 F1 s$ [# L7 @* m4 C3 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 ^" P  B. L4 I2 @
  55. #define STATIC_SHIFT                3
    + P* }5 z2 t7 L* [) c9 R# ?
  56. #define TCINTEN_SHIFT               20
    9 G% ~% Z1 ?9 L1 Q* j
  57. #define ITCINTEN_SHIFT              21; C, z, _6 \9 Y  ?$ e- _
  58. #define TCCHEN_SHIFT                22. B# G; t9 F9 j/ S/ I
  59. #define ITCCHEN_SHIFT               23+ `( d2 F/ f2 c  X
  60. # E4 P7 L/ ~  J+ U! M" U
  61. static volatile int irqraised1 = 0;
    + w) T' _, I1 ~+ _& I1 T) Z
  62. static volatile int irqraised2 = 0;) ^8 w* H% h6 j7 t3 L7 n, P
  63. $ e8 @# Z) [* ^8 f7 _. K; D: ^) d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 |0 i/ k, g) q/ k. A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 X) `5 X; j% H4 Z5 d" k' H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% R; o& p- U7 x. e! s( o( c, {' \
  67. 4 r' T; R) U* Z0 ^2 [
  68. dma_addr_t dmaphyssrc1 = 0;
    ) e3 R% u4 ^. d- O8 s, Q, b6 K
  69. dma_addr_t dmaphyssrc2 = 0;
    ! h$ Z# P# ~3 }& S6 d
  70. dma_addr_t dmaphysdest1 = 0;$ h$ z% @% h2 G' G1 e
  71. dma_addr_t dmaphysdest2 = 0;
    4 ]! }- e% Y8 z

  72. + K9 L0 \+ ^$ P8 I& ?9 v1 j, q: k4 ^
  73. char *dmabufsrc1 = NULL;2 v: T. e, M* Y
  74. char *dmabufsrc2 = NULL;* @' X% x7 v+ w( I, Q
  75. char *dmabufdest1 = NULL;5 v# ^" s: j% @
  76. char *dmabufdest2 = NULL;
    4 y. E2 P8 i5 o2 [, F

  77. * n" x  {  K" I1 t% }  k. e
  78. static int acnt = 512;% F5 P5 S* j* h8 \" x0 R& Z* w
  79. static int bcnt = 8;
    2 M& O* W) ~, W3 P9 g3 f$ P
  80. static int ccnt = 8;' {6 L4 p: z5 a6 l. h

  81. & t! u& y8 I; e8 ?5 }
  82. module_param(acnt, int, S_IRUGO);) w7 C% h) G. ~# k
  83. module_param(bcnt, int, S_IRUGO);
    ! S, s/ e. ?; U) k( O3 a- `& M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# ~7 U1 b& t% _8 ^. p
' O! Q- V3 G; I, |* S8 d, `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& G1 F5 {; N3 q1 H7 K6 z6 q, t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" W. Q) r5 n7 I. [* i3 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) R0 S- j- t  K* ^6 D* j

& V% c2 l1 K7 }+ I
! E: }5 C0 f( _' d3 z$ N- J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 21:17 , Processed in 0.038834 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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