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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* U# g# f' q0 J8 D) }9 K% B8 G
  1. [code]EDMA sample test application+ D0 W* \( z/ l0 x; |. a( J1 s" ^
  2. /*6 [- j' g& J$ R. j' m0 B; E
  3. * edma_test.c. n0 e5 Q  |' Q! U; \: v5 J/ c) q
  4. *; I1 I# x( P# `( j" m
  5. * brief  EDMA3 Test Application
    & p' X3 T* z. U5 F$ Q. t
  6. *
    ' A$ v9 J7 D' U6 }
  7. *   This file contains EDMA3 Test code." j1 y) G3 a& i2 G. Y6 s1 F% P
  8. *' j4 Z& l) {' g& }3 R' k5 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & P8 q& J0 |4 q* [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; B% u3 X7 l4 m8 r" K3 V
  11. *         TO CHANGE.
    * ^' P9 q) t9 D1 R: N. V5 X
  12. *" F( S) Q- Z# P9 q8 l2 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ^0 z6 R4 L5 `! g/ {3 x
  14. *
    $ o! z" y3 R6 X* r0 @/ _0 q
  15. * This program is free software; you can redistribute it and/or
    6 u8 C2 U2 g4 p5 y- O
  16. * modify it under the terms of the GNU General Public License as
    " O4 {: ]0 [' {! G8 _# a
  17. * published by the Free Software Foundation version 2.
    4 [" @& A& ~! t2 O
  18. *4 T/ }0 M2 r( @6 f: ^6 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. X9 }4 g5 @* J" h, v, Z, F, T! `
  20. * kind, whether express or implied; without even the implied warranty9 a" V) a) X1 U& C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! @2 x( U+ q  {9 T( G; e
  22. * GNU General Public License for more details.2 \0 c  Y1 L4 e/ T7 n7 W5 H
  23. */. @2 V' X, r8 A* A8 I

  24. 1 t6 I+ T$ P( c1 I
  25. #include <linux/module.h>* R; W2 ]; L" p, z4 S! b2 G) W* H
  26. #include <linux/init.h>
    0 V! ^& j2 S/ c4 c! F
  27. #include <linux/errno.h>7 E( i0 l6 @4 L" |/ X
  28. #include <linux/types.h>
    : d! t3 S% g2 k. Y/ |
  29. #include <linux/interrupt.h>
    3 y- ?1 @0 _5 }$ `0 d3 k
  30. #include <asm/io.h>9 P. |+ A. {3 V- d% i& B8 K; a! {8 R
  31. #include <linux/moduleparam.h>8 U( f) y" q' L4 s) n) X
  32. #include <linux/sysctl.h>3 l$ d6 C4 o2 ?9 s6 |2 F! h$ Q
  33. #include <linux/mm.h>
    + W- [5 B8 i/ K+ I
  34. #include <linux/dma-mapping.h>
    1 O* N  M& z! Q& x
  35. : a  W1 U! h; w' G' w0 I, \" S; h
  36. #include <mach/memory.h>
    1 I2 m: W& P! g: [# x
  37. #include <mach/hardware.h>% p5 V/ n4 _. P- ?% v  Q
  38. #include <mach/irqs.h>3 e0 U( c! S- v6 h# x2 ~' c
  39. #include <asm/hardware/edma.h>
    * A& ^( Y5 B5 T4 l, d
  40. ' k& i: S" _4 c
  41. #undef EDMA3_DEBUG
    9 u; P) [$ D+ i9 x
  42. /*#define EDMA3_DEBUG*/. z- D) t: Y" _' c2 i1 s  s

  43. 1 I- |6 Z% y0 Q; e" \. y3 R
  44. #ifdef EDMA3_DEBUG
    # S+ r9 q" H2 i2 v0 N& z0 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# D. y8 P# g) E3 ^1 B8 O3 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      F* K+ V* J, X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]7 d# \! \4 {. v( r2 q" I* {
  48. #else
    2 R' {1 E- _3 E9 Q
  49. #define DMA_PRINTK( x... )
    ; H; W, ?1 {4 G0 v' \
  50. #define DMA_FN_IN/ E  R6 U8 M8 D! Q% N# H. [
  51. #define DMA_FN_OUT
    * X) n# X  Y# R( y- [
  52. #endif+ T5 O* ^, S" u8 U7 H- G0 K. _
  53. 3 x( S3 B& v: e5 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; N, X. L1 Z9 t0 n% T
  55. #define STATIC_SHIFT                3
    # i( v' T8 n' g- p
  56. #define TCINTEN_SHIFT               20  q/ Z; j" b3 N: J3 f* L$ r
  57. #define ITCINTEN_SHIFT              21
    9 x( N9 _' ^: s, B+ h4 u
  58. #define TCCHEN_SHIFT                221 H; E+ a' g% V
  59. #define ITCCHEN_SHIFT               23$ X- W- B7 O$ c8 I7 s

  60. 1 z- H* [9 S4 F2 y! p; ~
  61. static volatile int irqraised1 = 0;  v; ^- ^' _9 s" M, l
  62. static volatile int irqraised2 = 0;0 Y) n3 r- }& R7 `9 m# Z
  63. 6 _& S% g5 B# d  N  i2 u2 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 B. N$ g8 P: A; S. m( S' O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 z9 n+ c) Q+ ?" i8 R+ B& T3 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " N' u$ f" p1 v4 A7 G, m) v2 _

  67. 6 I8 O0 M, _1 K, C
  68. dma_addr_t dmaphyssrc1 = 0;4 R0 l, I1 g& `
  69. dma_addr_t dmaphyssrc2 = 0;
    5 q7 r8 `+ O- Q
  70. dma_addr_t dmaphysdest1 = 0;
    / v0 u' H) B, T3 z
  71. dma_addr_t dmaphysdest2 = 0;
    $ i! o, L+ Z" A) P% Y9 G
  72. 7 u/ u6 i5 U. {$ D& P' T$ ?
  73. char *dmabufsrc1 = NULL;6 B- D: J% m# v2 {
  74. char *dmabufsrc2 = NULL;
    6 S$ D: K; G, y  r9 g8 ?) E5 `: v
  75. char *dmabufdest1 = NULL;
    4 w- T2 n6 y8 i  a  G: I6 v- v
  76. char *dmabufdest2 = NULL;
    ' y2 ]2 B4 r4 ~# d2 k6 N; ?

  77. , {1 q- e* {' a2 ^( I0 N$ Q4 B
  78. static int acnt = 512;3 M2 j: T! K: n/ q: C. U2 p- x
  79. static int bcnt = 8;
    9 q4 T  o) v3 i# Y0 i; S
  80. static int ccnt = 8;# j, m: ?$ Y2 K% O! X* W$ W! B

  81. 6 l0 @, i) Z$ j8 w$ D( |
  82. module_param(acnt, int, S_IRUGO);1 V, ~; w+ |$ T$ \4 R7 O2 G
  83. module_param(bcnt, int, S_IRUGO);
    6 e1 \% v1 e$ ~8 ^8 P% F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 [2 a3 Q1 k$ B# p' R; V! F& q9 X' `5 P+ @& g) t) _4 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& [# A" @. K9 }. H. z- L1 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 k7 @! s" D' O2 a: A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; e! P8 e3 s# h2 J' d, r9 ?8 F* L

/ t% {& |2 G- ~5 Y0 Z% c( d. u% g4 P- F1 l# v3 C1 |" e: D& h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 09:44 , Processed in 0.039387 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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