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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . e6 V& N5 M9 O; W- v. {
  1. [code]EDMA sample test application" [: h: G6 Q' u) x
  2. /*& c% X6 |8 i1 b  n0 r
  3. * edma_test.c7 s4 U+ w" [. G3 g3 ^) A
  4. *9 u. z9 |' G% Q1 Q3 h$ u
  5. * brief  EDMA3 Test Application
    7 r& l+ C6 L6 r- ^/ @3 n
  6. *
    / }' p0 K, |2 I- J
  7. *   This file contains EDMA3 Test code.  f: g2 s) c6 P' u# I
  8. *9 z; l5 R7 f) L& w) t4 b) A6 I4 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& Z' r2 t5 k7 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% F/ V% d- d9 w5 a' c4 G" j, u
  11. *         TO CHANGE.
    * @9 [5 l; v9 R
  12. *& z8 c) h$ F0 R7 ?7 ^1 n- c6 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' B5 ~8 a4 h( f1 m, D( P) S
  14. *
    ( ]) |. S4 ^" d1 S8 H
  15. * This program is free software; you can redistribute it and/or  i/ Y8 ^1 N! ^& X
  16. * modify it under the terms of the GNU General Public License as
    : e2 q' H( ]5 C% W9 N, f; ^
  17. * published by the Free Software Foundation version 2.
    ( x5 P5 l) x* X
  18. *
    # Z6 h) n  n& T* H0 P2 Z0 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* t3 h9 `% m( D: J0 J/ C$ I. P
  20. * kind, whether express or implied; without even the implied warranty2 L4 L8 W9 u! G. ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & C+ u+ W( f) k# G
  22. * GNU General Public License for more details.
      n2 X" f0 J6 y- i2 Q4 V  {0 n
  23. */$ r# f- `9 \2 \7 R5 C% s3 |& K+ ?

  24. ( ?  D5 k, D$ ?% U3 Y
  25. #include <linux/module.h>- p; z& ]" E" g' A
  26. #include <linux/init.h>4 H$ Z# o# y" k  D" M8 J
  27. #include <linux/errno.h>6 B* t" t5 G6 j' I
  28. #include <linux/types.h>: O6 o. a7 j3 S" O5 j
  29. #include <linux/interrupt.h>
    1 G8 s& m6 C& e
  30. #include <asm/io.h>! j) c3 o" o+ F7 B' @3 d0 Z
  31. #include <linux/moduleparam.h>( R1 U) j7 G+ u6 S" e. S
  32. #include <linux/sysctl.h>
    7 {9 x/ ~* l  J: j1 L$ G; s7 s
  33. #include <linux/mm.h>
    , e5 |' ~( H5 ~6 l8 g, h
  34. #include <linux/dma-mapping.h>
    ' _; s) t3 j5 k* m
  35. + W4 ^4 D9 ~  A9 h) {  _$ f1 k
  36. #include <mach/memory.h>! \# C; [: k7 w/ |  o
  37. #include <mach/hardware.h>
    3 y: w% ^* S# H  ^9 i! r. b
  38. #include <mach/irqs.h>
    . j# k. N; H4 f0 k
  39. #include <asm/hardware/edma.h>
    0 e' P9 x3 W* ]9 C
  40. ; v9 `3 g6 u  l* }* M3 ]- z( c/ W8 E
  41. #undef EDMA3_DEBUG5 Y& P4 w8 A9 K
  42. /*#define EDMA3_DEBUG*/1 @' T- a4 Q8 ^4 L" I6 a( t
  43. 4 O! L3 u+ w; X' P) ~+ Z
  44. #ifdef EDMA3_DEBUG& S- U! t9 J- ?+ t% Y! ]+ {) x9 h8 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Q  X7 f4 b+ M- P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 [" L9 u- f% t4 i" A* k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 e- {$ p- b* W2 J$ `" S
  48. #else
      I6 L$ A( D! g( b2 g6 W- I
  49. #define DMA_PRINTK( x... )- [' I" B9 m, F$ k' P0 }
  50. #define DMA_FN_IN
    ( L( y' a  Y6 y& d1 t- `
  51. #define DMA_FN_OUT
    - k" `* k$ P  d' k, |% G6 q
  52. #endif- U, F0 E3 m  g0 N3 e+ e2 |+ E3 a
  53. ; z/ z! l# `5 t" G& {" n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 S8 Q3 ~3 }3 ^% q8 |: R/ B/ O
  55. #define STATIC_SHIFT                3  o, w  F6 O* H# _
  56. #define TCINTEN_SHIFT               209 Y1 w* L& l/ c! ^& t
  57. #define ITCINTEN_SHIFT              21
    8 [. o, O' B# |. ?5 w& I1 b" T
  58. #define TCCHEN_SHIFT                22% H) u2 S) I5 t9 h6 M: d5 S" k
  59. #define ITCCHEN_SHIFT               23
    1 U( j& {" I5 ~7 d4 L  o9 H

  60. ! V2 t! A# e# Y! o
  61. static volatile int irqraised1 = 0;
    ! R( c6 F& u8 Z) [* I5 S! o
  62. static volatile int irqraised2 = 0;( x' \5 H" a& F9 N8 a2 A

  63. % ~4 j" E, J5 @" R8 Z% u9 G. i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; i( o  o6 k$ S  x4 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N+ g+ t2 u1 S8 D4 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q' Q% ]9 ?) \7 e" B

  67. * U! T7 t& K& m" [7 ^7 L
  68. dma_addr_t dmaphyssrc1 = 0;
    2 u/ t& A! x% V) y9 G
  69. dma_addr_t dmaphyssrc2 = 0;) W+ Q+ `0 K; p
  70. dma_addr_t dmaphysdest1 = 0;
    8 |, f% w0 M5 `, r. E) g
  71. dma_addr_t dmaphysdest2 = 0;6 B8 f! z2 ]( Q  |* [' s  x
  72. 2 z7 C1 X+ U* T( D( T/ I5 U9 u
  73. char *dmabufsrc1 = NULL;, P6 l* F( N3 ^" q- ~+ D
  74. char *dmabufsrc2 = NULL;+ E4 G% M4 O, E' k4 n
  75. char *dmabufdest1 = NULL;* @2 s9 c8 Y- ~: _) u
  76. char *dmabufdest2 = NULL;
    4 B- D6 N5 v& d. @' k7 e2 i

  77. 8 M, e' q9 S, \) k+ l; I
  78. static int acnt = 512;% r# t/ \8 y+ ?
  79. static int bcnt = 8;' }& q9 L0 E# g! V
  80. static int ccnt = 8;1 n+ l9 L' {) @; r( S
  81. 5 `5 |  ~: F7 j5 @( }, h
  82. module_param(acnt, int, S_IRUGO);3 e) ~8 h+ [2 {6 X* `4 K
  83. module_param(bcnt, int, S_IRUGO);
    ) b' R  W3 m& Z! c2 b4 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 G3 v0 L! K! z  Z  Y* T( f" [2 x8 @! a: _9 M- a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# r& d: }9 B. U3 Q* g  garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- D" Y6 t, R; l. E4 l* E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! X; S. ~$ H; T& f# O

/ B/ }/ A8 e) j' \, q/ m4 H
( B8 x% w2 {( h9 s; z1 s, M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 06:42 , Processed in 0.036667 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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