OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 s) z5 d! G6 l, D5 [2 Q3 B
  1. [code]EDMA sample test application
    2 ?3 B$ b1 n4 f1 J3 D9 d
  2. /*7 U, W" Z8 `; U8 n
  3. * edma_test.c
    3 e/ \2 w0 s7 N" y! {. y
  4. *( S2 |& f$ d: [& u" ]  {7 Y! Z) V
  5. * brief  EDMA3 Test Application8 p5 T, U7 k% g: `, ]
  6. *0 G. x: @& r, q8 _) y8 ^1 ?+ M3 C
  7. *   This file contains EDMA3 Test code.: j& A) H( S6 y, o5 ^, P9 P
  8. *
    8 J- V& U! Y6 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' T; _& C  T- U. ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % j1 {1 m- J) U  h8 r: a
  11. *         TO CHANGE.7 q) f7 i% o- y
  12. *. U. c3 Z/ @0 U0 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- i8 N7 y7 O1 \: S( H% F
  14. *8 x+ I" T  c$ N- @4 i: [
  15. * This program is free software; you can redistribute it and/or
    4 y, x# t; _9 }# J; d! A
  16. * modify it under the terms of the GNU General Public License as' J2 |* g/ E6 q; u5 j8 R
  17. * published by the Free Software Foundation version 2.- b: j  o; Q$ B( u
  18. *& O  ]3 P9 ^& Y/ Z) F( N& U1 {5 R: d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f) X- b& c) l
  20. * kind, whether express or implied; without even the implied warranty- l1 o  U* b8 v+ j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 i) k( W( V, q$ k6 _  w
  22. * GNU General Public License for more details.
    ) ?$ N2 P3 n7 H  o* O% @
  23. */% ^# o) U. N- `8 r: K' O3 _; z5 E

  24. / y+ s* I3 s, O% m: [: p
  25. #include <linux/module.h>  n' c' `0 f2 _% |& R
  26. #include <linux/init.h>4 I, m: f+ b8 T; M( m6 E2 b
  27. #include <linux/errno.h>
      B6 r" q  D# |, J( D
  28. #include <linux/types.h>
    8 Y8 O5 D6 j" T
  29. #include <linux/interrupt.h>/ ~. V" @, n9 e- {7 p' J- K
  30. #include <asm/io.h>  q+ z7 ]+ }8 q2 M; {
  31. #include <linux/moduleparam.h>; _0 d1 _/ ~& e0 _3 I4 F
  32. #include <linux/sysctl.h>
    ( q# x/ [- K# P  \
  33. #include <linux/mm.h>' V2 i  Q) S8 Y; @
  34. #include <linux/dma-mapping.h>
    / v" k1 y3 V2 M0 \  @" K

  35. 3 |  n! T  }" D8 ?6 X2 |
  36. #include <mach/memory.h>
    4 q1 S+ v; W# k7 B( r
  37. #include <mach/hardware.h>( B9 t* o0 y3 n/ ?& X
  38. #include <mach/irqs.h>
    2 c- V$ Z( _9 z; z7 z7 l6 [% @  h2 ]5 f- K
  39. #include <asm/hardware/edma.h>
    6 y7 c0 |; t" D/ u/ G& X/ W

  40. 3 Z/ b6 Z. U# t" L! ~7 y
  41. #undef EDMA3_DEBUG
    ) }) q0 ?5 ~4 c
  42. /*#define EDMA3_DEBUG*/. |0 Z* g$ U$ o$ ^; Z+ i0 t
  43. ' z# }7 B- _8 t! _+ Y. X# ?
  44. #ifdef EDMA3_DEBUG! x# M7 }" L- v* }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * s# \7 n/ G5 w% L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : F" q5 p# `! V0 {' [; y5 x3 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 B/ H% ^3 r6 N  }( P; ^% J
  48. #else: K, D5 N- X3 |8 K, E
  49. #define DMA_PRINTK( x... )
    2 m! p! r3 p  }! m" `, h
  50. #define DMA_FN_IN7 ~/ C8 T% m+ D8 g) V- }7 D2 V( x
  51. #define DMA_FN_OUT  {+ m  x+ X( o8 y1 c2 B3 _
  52. #endif- o4 M9 Z1 P  F& B9 }! \# Y

  53. 6 B! j. n! Y1 G2 P3 v4 E/ \7 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 f  B% t5 q0 _) A% ~9 n/ \
  55. #define STATIC_SHIFT                3
    1 `3 a. L. M3 k( ^  `: u8 [. |
  56. #define TCINTEN_SHIFT               20
    . K6 W5 n# y* X6 K& F5 i
  57. #define ITCINTEN_SHIFT              21
    ( T6 d. c, i) Q; `5 T
  58. #define TCCHEN_SHIFT                22
    7 B2 Q. g" G3 O4 W
  59. #define ITCCHEN_SHIFT               23
    6 S$ C0 r# p, O0 g( Z1 u
  60. 7 |; w" d1 w) ?/ @- a
  61. static volatile int irqraised1 = 0;' J9 w) b; q" k2 F0 T( b# h
  62. static volatile int irqraised2 = 0;) W9 \% v9 Q  P! Y( M: r& v
  63. $ H' \' A2 u  z4 Q2 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ E/ M% l9 N& P6 J9 Q' g5 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! m9 v) o* J) ]6 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c0 o0 |) }$ Y% x. J. w
  67. ' j. _; q) [* y; v- q
  68. dma_addr_t dmaphyssrc1 = 0;0 |+ i/ f: M& |9 N: a
  69. dma_addr_t dmaphyssrc2 = 0;" e1 n$ s" z4 y1 J
  70. dma_addr_t dmaphysdest1 = 0;
    & D" ~4 h( \, {6 e+ [1 R& j, b
  71. dma_addr_t dmaphysdest2 = 0;. w4 j0 b2 ]$ P- P: ]1 [5 o
  72. . H- m+ ?: w0 J. @
  73. char *dmabufsrc1 = NULL;% B# T+ ~/ K) e- ~
  74. char *dmabufsrc2 = NULL;
    % l1 A" i) y0 c( W
  75. char *dmabufdest1 = NULL;
    2 V8 \0 Z( i& L: U+ H; i1 V
  76. char *dmabufdest2 = NULL;$ ?; A. w# m$ G. l' z% J

  77. 1 u+ f1 x" }' @+ X% ]* K% Y0 B
  78. static int acnt = 512;
    0 v1 E+ g! a! K( Z4 }4 f" b
  79. static int bcnt = 8;" y: ]0 S6 D. |9 m" t
  80. static int ccnt = 8;
    ) D. c' `- E5 w6 q, X6 Z( U

  81. 3 N4 R! i$ B# Z! @2 g, c( S% f2 k
  82. module_param(acnt, int, S_IRUGO);& ^  d  h2 S; f
  83. module_param(bcnt, int, S_IRUGO);
    ( o6 t1 l. i7 w2 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 P) i" \9 z+ v! f( U
% m/ v" b0 C" [" s/ S8 t  L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [( |0 {2 D) g/ n8 O- T; V' N0 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 A; X1 \' |" n4 c% |0 Z1 @8 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 L0 T, g$ Z2 Q+ m( H% ~5 q, W
7 T( J" \( g6 s6 B& q! J* P8 a5 r( Q; K' {; Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 15:23 , Processed in 0.039289 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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