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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / ~3 M8 i7 i8 R* J( u6 |; d# Q
  1. [code]EDMA sample test application, u# [* M2 E8 p' o$ d" y7 p( E
  2. /*: Z- k' d& n6 t$ d1 c' B, ~6 n
  3. * edma_test.c0 Y) x7 s; ~; a/ c/ z! a
  4. *6 D0 ]4 _. s# v  q- U
  5. * brief  EDMA3 Test Application3 D' k6 r  q$ H: x; x. L
  6. *
    4 i& D2 x" c" o$ G" D
  7. *   This file contains EDMA3 Test code.) W3 k% U  O6 I1 c+ i3 q' }: r, ^
  8. *" S( a8 k5 O1 o: W) v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 c/ j  f( r+ @9 l6 r; `) Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      l( U8 T; ^8 N* ?
  11. *         TO CHANGE.
    ) f6 E: t& {2 W1 y8 E
  12. *
    4 Q1 O( {5 q, H* J9 s/ @: i+ D; z6 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 Z. a; a' m, d; z) h6 F( Y& I7 C
  14. *$ b. ?$ u6 t* K: r; h$ I% t% U
  15. * This program is free software; you can redistribute it and/or
    . p* m/ S2 r7 d) `9 N
  16. * modify it under the terms of the GNU General Public License as
    ) \' u8 O9 M5 a  R& W' ~  M
  17. * published by the Free Software Foundation version 2.' M/ s7 h1 @- ?" n
  18. *2 t, ]/ s0 F  @1 f4 `9 y# H  @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) W, d  ]% n; B' \7 f: i5 ?. Q. @6 @
  20. * kind, whether express or implied; without even the implied warranty4 _7 N0 Z* G& Q/ H  D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 t- C- j5 K; {1 o
  22. * GNU General Public License for more details.
    & a; B6 M7 L# [& ]# _# g! k
  23. */: m+ p- `+ r8 M: U# C# ~6 I2 P
  24. " l, f& ~# q+ M1 g5 W& v9 u
  25. #include <linux/module.h>0 O7 H6 C) n) b) B
  26. #include <linux/init.h>4 ]% N1 [7 T4 t+ b
  27. #include <linux/errno.h>7 G$ Z5 `  Q1 a2 S
  28. #include <linux/types.h>
    ; U8 [. j6 G3 v& x9 N4 w7 l
  29. #include <linux/interrupt.h>
    5 a' A' `1 ^3 e$ l# D7 c
  30. #include <asm/io.h>+ V8 e* e+ g. `) W3 O, q/ M0 K3 E6 a
  31. #include <linux/moduleparam.h>5 Q/ P2 Y& G% R  m
  32. #include <linux/sysctl.h>
    ' @5 F  T* X8 J
  33. #include <linux/mm.h>
    / r, n: |: B' d& T; u6 h
  34. #include <linux/dma-mapping.h>4 W! n3 I5 P) H

  35. 5 R  p) W# ?8 E, P/ e1 `
  36. #include <mach/memory.h>6 p, x, L) g  L# p- n- f( E
  37. #include <mach/hardware.h>* Y" {' d9 l( T0 u* z
  38. #include <mach/irqs.h>
    : u& E0 {4 T8 p  W( v* q% E  O5 d
  39. #include <asm/hardware/edma.h>
    8 d3 {% N5 u! Y
  40. 2 b& ^9 W8 i) l$ d. ?/ |9 K. R- ?5 W
  41. #undef EDMA3_DEBUG0 m' {# `  ]3 P' r5 H
  42. /*#define EDMA3_DEBUG*/% w8 c% I$ R! k! `& l* |

  43. 8 E1 t4 I2 I# G! F# N; c
  44. #ifdef EDMA3_DEBUG& r+ U3 x6 E5 Z' U+ A0 \/ i) G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 f1 r1 s: y& y! H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). F, h! j6 L( e; \" X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% U: J  ?& Y( W# G  c% X1 ^  _
  48. #else: ^, _+ x7 P; l' ]
  49. #define DMA_PRINTK( x... )6 P: m4 J( p" A
  50. #define DMA_FN_IN. K- Z- |* M9 V
  51. #define DMA_FN_OUT7 |, }" m" a8 J' m: d) z
  52. #endif
    2 x& ^' Z$ l+ H# h" d4 K

  53. % D/ K8 |, r$ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      A" |3 \* Z; m  T2 ?8 x- L8 G5 \% w
  55. #define STATIC_SHIFT                3
    5 r2 s/ _( [2 @  z  d
  56. #define TCINTEN_SHIFT               20# O6 D1 D) `: R' q% v
  57. #define ITCINTEN_SHIFT              21. X& I* d6 F! h
  58. #define TCCHEN_SHIFT                22$ @/ P" z/ M8 y  W* a& B+ F
  59. #define ITCCHEN_SHIFT               23
    " N8 b( U5 T. \& Z* O  A
  60. ) E+ Z. `# Q; ^: Z! ?7 S( L3 m
  61. static volatile int irqraised1 = 0;7 G* v3 F# H9 H" I$ Q; _+ X" x
  62. static volatile int irqraised2 = 0;
    1 e' x2 M, I8 M/ a0 I5 B* m, C# e5 b
  63. # E% W4 P1 X# J! J- Y7 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 c( @$ e1 i2 R8 E5 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 e# W6 k4 ^' l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B1 b7 u# ~4 k' S3 g. B
  67. ) D6 P+ G3 l2 r  o( |. l
  68. dma_addr_t dmaphyssrc1 = 0;7 ?! c6 k% L6 l$ b; s  y
  69. dma_addr_t dmaphyssrc2 = 0;& q/ j1 t6 N6 z: R7 R
  70. dma_addr_t dmaphysdest1 = 0;0 f( l$ ~. h7 Q1 t- F7 U" B+ {, H, _
  71. dma_addr_t dmaphysdest2 = 0;
    $ G+ G0 K2 @, g
  72. ! A/ Z/ }( |8 P$ o7 b
  73. char *dmabufsrc1 = NULL;
    1 U& ?+ v; N$ ^! j8 |
  74. char *dmabufsrc2 = NULL;$ i4 Y0 Q' i' c5 X
  75. char *dmabufdest1 = NULL;
    . x3 C1 p8 Y" D" o/ c
  76. char *dmabufdest2 = NULL;
    ) p9 t7 ^( }6 X5 ]* r) F, d6 }

  77. % J. v! @% Q" k
  78. static int acnt = 512;& K5 }/ f' c  A7 y& W
  79. static int bcnt = 8;
    * S  j, t  M# L
  80. static int ccnt = 8;) F6 R; C1 I0 y5 ]) v3 g+ B7 R' ^
  81. & _; `2 j( |7 ^) q1 B
  82. module_param(acnt, int, S_IRUGO);* `4 z/ p8 [" t9 f7 t7 Y6 r  o% X6 t
  83. module_param(bcnt, int, S_IRUGO);0 t* g0 j5 c- P; s  w5 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ v3 W& d) b' u+ H
& V- e7 h5 t1 ^) x: S7 ~+ V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! F: ?6 _! l7 Y; }% M/ varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 B5 D7 q8 _2 {& E  }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( N6 ?# N0 r/ A; \" P

+ L8 H2 C4 K, v4 G) V, E* }9 e1 w, @2 K; E4 i+ l: o: D2 H7 |9 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 12:04 , Processed in 0.051110 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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