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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 T& s) w: C, J
  1. [code]EDMA sample test application( X" u' O  f" q8 j- {$ k& K; j
  2. /*
    # d/ o8 h, Q& T5 n% e; E$ C$ d/ O
  3. * edma_test.c% I2 Z. d; {/ [5 N) O* f$ [& K
  4. *
    & V1 ]' ?% J7 k+ A+ `7 e
  5. * brief  EDMA3 Test Application
    & B% n- g4 g" I6 {
  6. */ k8 Y" n7 Q" K! O% f
  7. *   This file contains EDMA3 Test code.
    , f: I1 i& [) l* V3 Z; t# H0 _+ n! h
  8. *5 f% B# J" Q' \  N# z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 h- n% z/ h& c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) D+ I/ N6 n! ]* }
  11. *         TO CHANGE.8 b/ q; z+ w* L8 P* U
  12. *' h- ~. u6 ]/ g9 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & T! @. g! t5 o7 W$ X: S. G' s9 w$ [
  14. *
    3 y8 N0 F2 q8 g/ a( V1 [
  15. * This program is free software; you can redistribute it and/or
    , K* @" l4 |: ]7 ]; c; P: {9 p
  16. * modify it under the terms of the GNU General Public License as
    2 v+ h8 ]2 m. s( M
  17. * published by the Free Software Foundation version 2., ^/ p, i6 Z6 A2 q
  18. *
    ; g% J  M$ N' g7 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; y# v2 N0 _& t4 y9 a
  20. * kind, whether express or implied; without even the implied warranty- C. E8 Y* L8 I  T( ^0 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' S9 ~4 p% L& Q) p: h) X
  22. * GNU General Public License for more details., A. Y2 ~& \# K6 k
  23. */3 g8 m& H( K9 a
  24. 3 f; {) g& \! R/ `
  25. #include <linux/module.h>
    ( T( ~) k" ^( N, j5 B
  26. #include <linux/init.h>
    ! i( Z& I$ s& }! v2 m0 M
  27. #include <linux/errno.h>5 F; _: G) }# T
  28. #include <linux/types.h>
    8 L# @3 X  `- s7 b& ^
  29. #include <linux/interrupt.h>9 ]  t% W6 i8 q* ~; t$ \8 d
  30. #include <asm/io.h>% f& z- v+ p! P, x9 S2 o
  31. #include <linux/moduleparam.h>
    ) m( q) ?0 K" t7 t" P5 o# {$ d
  32. #include <linux/sysctl.h>
    # O  B; Q, {1 E' t; P  R
  33. #include <linux/mm.h>
    + A3 S0 J8 B) {$ _+ j
  34. #include <linux/dma-mapping.h>0 l% R. H9 n+ s7 L* l  S
  35. 7 l' i* A+ O5 q7 o
  36. #include <mach/memory.h>- E5 I1 R* n0 A& y* l( P
  37. #include <mach/hardware.h>
    9 J$ ~; ?6 T; v
  38. #include <mach/irqs.h>
    : ?  p1 Q0 j& C: [! T6 n
  39. #include <asm/hardware/edma.h>; }/ [4 u) W' g" g9 M4 X( o

  40. 7 ^7 Y. P( M+ j
  41. #undef EDMA3_DEBUG
    ( P. ^8 Z) p" T
  42. /*#define EDMA3_DEBUG*/
    ; E7 Y  _+ b* [# Z! C
  43. : o6 p% m/ N( Q, g" z3 P; l
  44. #ifdef EDMA3_DEBUG9 @$ P1 d6 B1 D7 Y* A+ Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ C! P) U5 x8 j6 }: Y; B' T* i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 e9 M4 `. z, a, B0 B1 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 @8 T& @3 R* i  ?" u: Y7 T
  48. #else, T6 m! D7 X  Y
  49. #define DMA_PRINTK( x... ), s' u0 H, t% U2 d& m' e
  50. #define DMA_FN_IN
    * V- H& i- `; f; J
  51. #define DMA_FN_OUT. k) m' @) a* q' ^% E# x
  52. #endif
    9 ?, t9 A- `9 _* f" y  w
  53. ! R" \, T  {; I+ T: K  K$ R& x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) D- i9 I1 W' b' Y7 k! ]6 Q! o: j# Q
  55. #define STATIC_SHIFT                3
    2 E% ]- ^/ u! Q" Q
  56. #define TCINTEN_SHIFT               20
    , x5 Y7 H/ Q/ [/ m; T
  57. #define ITCINTEN_SHIFT              21
    4 s& B) t9 f7 b  P
  58. #define TCCHEN_SHIFT                22
    " q# z' |8 j% |* j2 e
  59. #define ITCCHEN_SHIFT               23
    # V0 {. c6 `( H

  60. 9 A) ]% j8 Q* C8 }' Q+ m
  61. static volatile int irqraised1 = 0;
    ; B7 [" P9 I& s1 }: w
  62. static volatile int irqraised2 = 0;; d* X+ D- b% k' Y9 H- D
  63. 9 |( S2 x; U2 Z5 V+ N, x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 e& I! }3 w% O7 G2 E) s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 P0 n/ p) @  T7 W: M! D3 A) {7 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , I* o( _5 F' D2 k, ?

  67. , J; N; Z6 W( h
  68. dma_addr_t dmaphyssrc1 = 0;: i2 G( D" U2 H. F0 b1 D
  69. dma_addr_t dmaphyssrc2 = 0;3 d; R' J: M! h, W
  70. dma_addr_t dmaphysdest1 = 0;
      @+ w5 B" Q. a2 j4 E6 D( }
  71. dma_addr_t dmaphysdest2 = 0;- _1 w( l( [" F
  72. 2 ^3 I% Z2 G; c3 X8 p
  73. char *dmabufsrc1 = NULL;
    9 N# C5 N! u" L; x
  74. char *dmabufsrc2 = NULL;
    ' Z# G! E5 J' A) i
  75. char *dmabufdest1 = NULL;9 x4 v) \% M7 @
  76. char *dmabufdest2 = NULL;  Q; G. h' v$ q& G3 ]1 d* E- x
  77. ) L5 b7 m; V" F: s1 i! K& J* i
  78. static int acnt = 512;+ E6 O' {9 q3 K! G: _' B+ P
  79. static int bcnt = 8;0 e4 Z# p; H7 [+ e% ?) o1 X4 k
  80. static int ccnt = 8;0 \* @) C% m" [4 q5 `, g& u

  81.   F# Q. o* C8 Q1 A9 C* d, V2 C8 _
  82. module_param(acnt, int, S_IRUGO);8 }# v; Q( L% ~+ H7 G! \# f* @
  83. module_param(bcnt, int, S_IRUGO);
    $ o$ r8 w+ r/ O- a- A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" V% e7 e  R6 H4 d' Q8 t
) ?9 [. c% u- V4 A2 s" b% h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( o' j7 j5 o! }2 `& u( g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' n7 r$ w4 A  s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! P0 P+ J" C$ D5 |9 ]. Q, V( v

# I. \4 N7 P  m6 n& j0 w
; @/ @2 Q  F# c. @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-17 23:08 , Processed in 0.040452 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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