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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 U& V) Y9 F. b% [) L! G
  1. [code]EDMA sample test application
    7 f) f1 f1 V' L0 A0 F
  2. /*
    9 @; j  R) ?4 r6 b! M, B' Y& S
  3. * edma_test.c
    2 I% I0 S( T/ W8 }
  4. *
    6 Y) j0 K, k5 o( h6 v: X
  5. * brief  EDMA3 Test Application0 g2 A% v  n0 F1 \. K
  6. *
    # G1 [: I$ B# n% S! l
  7. *   This file contains EDMA3 Test code.9 H" N" X' D7 n  ~$ T
  8. *
    ( q* }0 r4 P9 o, b% ]# [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 a2 ]; l/ I/ h6 h, ^* j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A0 B4 v& k& U; e5 u# e, x4 {) F
  11. *         TO CHANGE.* l0 q" \. l1 U" ^6 o& a- Q
  12. *
    . c; k, O4 k1 {$ i% E% y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ d6 P% ~1 P! h$ j  C4 M
  14. *' D, V# c5 J! {! v% ~) d
  15. * This program is free software; you can redistribute it and/or9 O& c7 N- f$ Z. q) k6 w: o" O) {7 _4 b7 p
  16. * modify it under the terms of the GNU General Public License as
    % ~$ j% E! ]3 R2 V/ Q3 E4 p6 Y; A
  17. * published by the Free Software Foundation version 2.
    $ m# Q5 T8 n3 J2 a( Z" o
  18. *8 G% w7 _# A6 V% \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) P. |2 P) \; @4 f! K/ x
  20. * kind, whether express or implied; without even the implied warranty8 Z; g- z3 p: f1 N# A: W) k+ [, {% J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 g2 }5 Y- {* x8 H
  22. * GNU General Public License for more details.
    1 Y& ^/ E# D% Z9 z' o$ Z5 G
  23. */
    & ]2 L, _4 ]5 |! a) f+ R# t, p

  24. 8 {# Q: U, U( p; X2 O
  25. #include <linux/module.h>
    4 }* w" x5 v6 z' u4 R# F# ~5 K
  26. #include <linux/init.h>; `  P* z9 Y0 @2 t- S
  27. #include <linux/errno.h>
    5 L4 m: W! b; ]' {: X7 O  O
  28. #include <linux/types.h>
    ) R5 B" q( g# e" B6 h$ k4 L' Y
  29. #include <linux/interrupt.h>, Z4 y0 t; U$ S) Q' U( K5 d# {# X
  30. #include <asm/io.h>3 s' n7 r  V- o' h5 h
  31. #include <linux/moduleparam.h># @# w: Y- H( g6 |; F9 E
  32. #include <linux/sysctl.h>  a# M8 x! f: }# A5 e" w
  33. #include <linux/mm.h>
    . B1 b! K& y4 T# z
  34. #include <linux/dma-mapping.h>9 O1 J5 e2 s7 M
  35. & ^# c, Z7 e# ?8 O! T
  36. #include <mach/memory.h>4 Z) i3 \* p7 \$ k( c  v
  37. #include <mach/hardware.h>
    ! O) ~" _+ Q1 C$ F' N
  38. #include <mach/irqs.h>
    ' w+ B5 D7 o; J8 R. m  v, f) b6 V
  39. #include <asm/hardware/edma.h>
    " F6 i) A% R( F$ F5 q% J9 ?# T
  40. 2 x, v! c) p* c
  41. #undef EDMA3_DEBUG/ x8 {) f) F+ ?: N6 l/ _( j
  42. /*#define EDMA3_DEBUG*/
    # M0 f: @' ]6 o' `4 F  f

  43. 0 i( m/ @" W0 l! O$ F
  44. #ifdef EDMA3_DEBUG
    ) S( o( a! S7 \4 K- H- g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " E$ C: @  Y5 ]4 t/ \4 [( A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 J. c$ r: Z5 K/ F( a) c: m/ i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 @+ x, g1 ]5 B- M( u, @
  48. #else- W( T3 m% v0 ]" O9 ~. a2 A% G8 ?  n
  49. #define DMA_PRINTK( x... )" i: t! G  x% ]3 d# g2 q7 J; I: U
  50. #define DMA_FN_IN
    , {8 R3 ]/ P  ?
  51. #define DMA_FN_OUT! N1 M5 f% o2 i1 b8 \
  52. #endif3 g7 |9 Q! o" _' C

  53. : {2 M4 e: l% ?1 B; E, J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* A, C) C) p# j/ o  X+ @  x
  55. #define STATIC_SHIFT                3
    ! h% X$ r4 C& ~# w  k) @# F% ~" }
  56. #define TCINTEN_SHIFT               20, [" _5 Y% W. E& ]. G( M8 P$ o
  57. #define ITCINTEN_SHIFT              21
    & X: I6 a7 f8 d3 x) r6 o
  58. #define TCCHEN_SHIFT                22: m/ A$ T) V) h% {3 ?
  59. #define ITCCHEN_SHIFT               232 S& w+ G2 n3 y6 D' J' b
  60. 3 W( o. v' \  Z# L: K
  61. static volatile int irqraised1 = 0;
    + A$ M" ^" `4 y5 u
  62. static volatile int irqraised2 = 0;
    2 s/ n: C# g( {& y& \
  63. , i+ t$ G1 D* B& J( M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C1 g$ U2 Z( `" b+ N; z9 m1 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! x7 {9 b7 D* {" h/ G4 d- I4 B/ _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D# b8 s+ F9 H$ F4 |: t0 u
  67. 8 h/ y5 l7 Z( X+ k. W* ]
  68. dma_addr_t dmaphyssrc1 = 0;6 q2 B# J% l/ c3 }) i( \
  69. dma_addr_t dmaphyssrc2 = 0;
    * D" e5 I, S1 }: p% u
  70. dma_addr_t dmaphysdest1 = 0;
    6 i! b" I5 l1 |5 D  j/ o" k
  71. dma_addr_t dmaphysdest2 = 0;- o8 Q# `9 u( W1 k' M

  72. + S/ I9 @( F: `
  73. char *dmabufsrc1 = NULL;& M1 O8 x3 O& A( p
  74. char *dmabufsrc2 = NULL;3 P( H( h& \( S$ S: [/ ]2 ?5 [
  75. char *dmabufdest1 = NULL;
    9 t; K  w: b" i. V. Q" ^
  76. char *dmabufdest2 = NULL;, @, Y1 W! j7 L; e5 i* n

  77. 8 v0 d4 v0 h/ y: f
  78. static int acnt = 512;6 E/ j/ t$ z: M# f: r0 w3 _
  79. static int bcnt = 8;) U7 ~" J, z7 T# v7 ?( N: W
  80. static int ccnt = 8;
    0 a- J4 d) [& L' l# ?
  81. ! Q( c1 Z" n( i' M
  82. module_param(acnt, int, S_IRUGO);
    9 e; h! T  T6 b1 r( |2 o
  83. module_param(bcnt, int, S_IRUGO);
    6 Q1 V- L+ ?2 g' S) \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" L, L1 A* d: y2 l4 T. a
& _  i& Z# r+ B* p/ m0 C) n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  T; j" c; p/ r- p& n  B, Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 y7 Q, y! y9 u  x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" N  @$ F5 P& O; t: J- e3 t  |
; ]+ w7 a0 R+ J2 a2 l  Q/ K
) M2 E1 o% L: b/ e) W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 10:16 , Processed in 0.040886 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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