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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 d9 c# r: t* |5 m
  1. [code]EDMA sample test application
      J9 k2 m' b: X5 P% A
  2. /*
    . C' m* o0 {  h4 `, y
  3. * edma_test.c' E& S1 @: ]; x5 W# A5 L6 A& v
  4. *' Q1 w. R! [$ l  Z& g; ^" s
  5. * brief  EDMA3 Test Application6 t8 `, z' P; B' C9 v. x
  6. *$ W% w* u, w7 u9 D6 a! U
  7. *   This file contains EDMA3 Test code.
    + E8 J0 |, B/ G" g5 `! o
  8. *
    * W0 _/ |" X0 t; r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 G1 n: m* R: ]# n/ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ s  P( S: E8 A5 R
  11. *         TO CHANGE.
    " ]3 X* N5 b9 K" n
  12. *
    . u$ g6 W5 r9 ?9 \5 v8 x6 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 O$ V, B6 R2 w8 D
  14. *
    1 R* J& N9 W/ _/ B
  15. * This program is free software; you can redistribute it and/or
    . c7 X2 d0 `9 d3 ?3 N
  16. * modify it under the terms of the GNU General Public License as
    $ R8 I7 J5 F5 L0 }, y  U4 w  W4 r
  17. * published by the Free Software Foundation version 2.! {6 H1 C+ ]7 a
  18. *- R2 S, e9 ^, a; I; z; X/ b9 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : e3 k$ Z% b( @, h
  20. * kind, whether express or implied; without even the implied warranty
    " X- a3 `; N- k: [% f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ P; [2 l: [! K7 W0 X8 q0 J
  22. * GNU General Public License for more details.3 U/ {  F- p1 U/ R* U# w
  23. *// e) w/ A0 q2 l3 _# g% W2 }& N: s
  24. : D. Q8 v  O3 b9 ?! b- S
  25. #include <linux/module.h>
    $ Y8 O+ n" b/ V! f9 B0 V
  26. #include <linux/init.h>
    & p+ j0 Y$ I. }' q& h
  27. #include <linux/errno.h>2 t  R0 B, D. p* J3 \1 b+ O: Q
  28. #include <linux/types.h>
    , R9 V3 w1 S9 ~2 i* M3 K
  29. #include <linux/interrupt.h>" D3 C! k) R9 ~+ w
  30. #include <asm/io.h>
    7 y/ x4 t& [0 z- Y( Q
  31. #include <linux/moduleparam.h>
    7 B: z. o+ R& ]& _/ Q
  32. #include <linux/sysctl.h>
    : U( x2 ~5 t' r( C$ l0 z3 k
  33. #include <linux/mm.h>
      P; D7 o2 J' ?4 |3 @
  34. #include <linux/dma-mapping.h>
    6 P$ t1 P. o8 i) \& n# [

  35. & z1 Q7 T; s7 [
  36. #include <mach/memory.h>% H3 P9 H9 G8 x. ~2 [; B
  37. #include <mach/hardware.h>
    2 v6 u4 I8 H1 x& _+ q
  38. #include <mach/irqs.h>
    / ^1 ]$ U7 T2 T" h, E- P
  39. #include <asm/hardware/edma.h>
    2 d! i) X3 [. C

  40. ; G- |0 A: t# i3 l1 _
  41. #undef EDMA3_DEBUG
    + R  H+ i/ @( [! M0 q
  42. /*#define EDMA3_DEBUG*/- n5 K: @/ a7 O4 g! G7 K" L5 m+ p

  43. 8 v5 Z5 l; \6 W. o  S. k% k& h
  44. #ifdef EDMA3_DEBUG+ {! ]; F/ Z" `( B4 T  P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : \2 p3 S' }. t! T% R8 `+ L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 k0 O. C1 f* E0 @: L7 c* Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 t( Z3 @* M" M; W: d8 E
  48. #else
    ; C9 F: p; W5 f7 Q. F. K
  49. #define DMA_PRINTK( x... )
    : G; i3 G" C- G, @5 ]" o
  50. #define DMA_FN_IN
    , [% w/ \4 ^/ o3 F! P8 M
  51. #define DMA_FN_OUT9 s) ?( x! ^" g# g
  52. #endif
    ; }/ ~  r/ L1 O4 i  n$ t2 n
  53. 5 J! V% {8 |7 k4 [: |) ?) U7 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 ~. J& i; ]4 Q) A
  55. #define STATIC_SHIFT                3
    % M) \# ^; ?0 d. t( a* O
  56. #define TCINTEN_SHIFT               20
    7 l7 ?# p9 [9 e( p" }( o
  57. #define ITCINTEN_SHIFT              21
    % _. E6 W( R% B% x( u8 ~
  58. #define TCCHEN_SHIFT                22
    1 T3 E# J# c$ H) I" ~
  59. #define ITCCHEN_SHIFT               23
    , m: z0 m2 V* o- _8 {
  60. 9 l5 g, J) x' o) _% c2 m1 g$ z
  61. static volatile int irqraised1 = 0;! Q( _- H* X2 s" P5 q
  62. static volatile int irqraised2 = 0;
    * x% v# P5 l  S: @

  63. 7 ]5 U1 @5 `# A. G  ~* ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T) b# U# m- t. f' I3 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 k5 c, o2 [& U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! N7 M$ M  e* U

  67. 1 Q# `( U) P: m' K8 J$ l
  68. dma_addr_t dmaphyssrc1 = 0;. C/ A( }7 y) l( w3 a: m
  69. dma_addr_t dmaphyssrc2 = 0;
    ' z$ T4 m  R" c4 l- Z, j* [4 `/ @/ V, y
  70. dma_addr_t dmaphysdest1 = 0;
    ( \1 I; T" R1 ]; t* C
  71. dma_addr_t dmaphysdest2 = 0;
    0 M* Y# Y# }% t" W% _7 u
  72. 1 n% S: c6 C! i! ?
  73. char *dmabufsrc1 = NULL;
    ! q2 Q3 n  @- K* d
  74. char *dmabufsrc2 = NULL;4 u. q% @5 q( }+ d, n+ m
  75. char *dmabufdest1 = NULL;
    1 \# t' H8 o$ U3 L8 S. I, z
  76. char *dmabufdest2 = NULL;
    - b+ h8 m$ A6 H; d( X# B3 X( A

  77. ( k  P; r9 U+ h
  78. static int acnt = 512;5 K' y% r/ s8 T  K
  79. static int bcnt = 8;$ ^( v" J% o# x
  80. static int ccnt = 8;5 D! q8 I( L5 A  L4 R, }; H

  81. - J3 D; F) {+ M
  82. module_param(acnt, int, S_IRUGO);
    ! a' R/ C5 b: u* }7 g5 g' Y
  83. module_param(bcnt, int, S_IRUGO);' B+ g. D* c5 m" m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( Y) h' t4 S  l+ k" Y6 a% e$ {3 f4 z, \8 r  v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ t% [' n7 o4 ~( darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; K1 ?; |3 |; g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' Q4 T4 N$ T! P4 M* o! x- I4 a; r9 j* K" G- D2 w% [% X$ k. P% Q

% V5 t5 e$ T0 H. M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-20 11:54 , Processed in 0.047263 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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