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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ?: c; A+ X! {9 K* I
  1. [code]EDMA sample test application
    4 A1 s6 @& \2 H+ D1 {: G
  2. /*
    $ D) v6 L7 e, s% c, }. U
  3. * edma_test.c  q+ o, x& ?# S* t& ]7 O7 S
  4. *
    1 q/ x, V! N( m: Q3 g& Y5 e
  5. * brief  EDMA3 Test Application
    * R9 ^1 q$ M6 G' {# F( r) e$ }
  6. *
    # B1 K  T* g" U# e( N
  7. *   This file contains EDMA3 Test code.; E/ q% }/ i. y" `! B6 S
  8. *8 b# N" m6 _# O) ^9 x- Q% F* T6 {! e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' r' O, d8 [+ w( P* h3 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 {' `' _4 ]9 G3 `+ l5 G7 P. ]
  11. *         TO CHANGE.( X: M5 \; p7 ?8 c
  12. *8 E2 {  b, K1 b8 T# ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( B7 }! o1 G. e/ {$ ^
  14. *6 @9 j6 U6 n4 `) \
  15. * This program is free software; you can redistribute it and/or: K  ^# f2 J2 H) Y
  16. * modify it under the terms of the GNU General Public License as' c, r3 V8 s- }* _6 b+ h9 l
  17. * published by the Free Software Foundation version 2." ]; E, g& j7 t& n7 B1 t
  18. *
    ( J9 G, ~6 `5 y8 ^: T7 W8 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! Y, Z, l- W! {
  20. * kind, whether express or implied; without even the implied warranty
    6 e: `4 I/ X& W) W6 a0 r9 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ E" r  T* `/ K6 N# W
  22. * GNU General Public License for more details.1 g1 u9 C( [, `
  23. */% F6 d; E7 R3 i' }7 u9 M  @

  24. 4 k2 z$ u7 K$ v/ h: l( w6 O- Z
  25. #include <linux/module.h>
    8 T, \5 J; Z  e
  26. #include <linux/init.h>% m: n' h: {: i  B
  27. #include <linux/errno.h># ^: h6 M* E7 {. I  O
  28. #include <linux/types.h>* u+ _: k" X# v: M- V# g2 w+ O
  29. #include <linux/interrupt.h>
    - v5 G* h$ g$ j, j
  30. #include <asm/io.h>4 p% R8 p& k# w
  31. #include <linux/moduleparam.h>2 l: j' [3 f: ], @; W! T  J2 @
  32. #include <linux/sysctl.h>
    - p( y5 r5 x' n
  33. #include <linux/mm.h>
    : `# K# K9 v1 E8 d7 o- S4 \
  34. #include <linux/dma-mapping.h>
    ' S: Y% ^3 u9 O3 D

  35. ( P" Q  C& F$ N  F/ E5 z
  36. #include <mach/memory.h>
    $ q$ @  d  m5 L& m3 P( E
  37. #include <mach/hardware.h>
    + ^7 }% ~0 S. q3 W0 v: R: w+ \. f
  38. #include <mach/irqs.h>
    * A' y" U! \/ ^, D+ `
  39. #include <asm/hardware/edma.h>; }5 M7 L4 {4 e9 `5 z0 J

  40. / \1 n; q: U6 V& G
  41. #undef EDMA3_DEBUG# r  W8 W. f' ~  W6 {' K2 S
  42. /*#define EDMA3_DEBUG*/
    2 y6 l, R3 D% v+ v6 [+ b- u
  43. 9 i0 ^" J# _6 i) A
  44. #ifdef EDMA3_DEBUG1 \$ a/ ~- p3 l# b! T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " c( r" Z3 ^% h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 A/ ^8 b/ ?5 h) M' K! s6 a- P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m. D3 r4 M3 M# u
  48. #else
    * h- x, J2 j8 w2 v; s% X
  49. #define DMA_PRINTK( x... )( P; z1 Z; X8 \8 b$ {8 u: [% J
  50. #define DMA_FN_IN# \+ {4 o$ w+ u% r7 I1 N
  51. #define DMA_FN_OUT0 X; z0 ?# v6 V! Y% O
  52. #endif$ E3 q# E* C9 }% g! A& P
  53. 7 @9 ^5 a# S' I0 S7 |9 u2 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " \6 `+ c: `" J( Z$ V1 m" Y6 ?
  55. #define STATIC_SHIFT                3
    9 w4 g# E# v5 L  t9 u; |3 b  |- G
  56. #define TCINTEN_SHIFT               20
    ! N# a, V7 I. n# O" {% w
  57. #define ITCINTEN_SHIFT              21( `6 @( q4 F* k4 `" O9 S
  58. #define TCCHEN_SHIFT                22
    . M; P: A7 s/ ~) B
  59. #define ITCCHEN_SHIFT               235 V0 O$ K: n# l- z9 a% c# f

  60. # @, G9 Y+ V; B4 c" h2 A
  61. static volatile int irqraised1 = 0;
    : w/ j6 N4 [! {: o
  62. static volatile int irqraised2 = 0;, {; O& x- K% s4 X6 ~% [- L3 F

  63. ; X7 j5 h% L2 C2 `9 E7 C1 Q( W) ^0 j" b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h$ w0 e0 L4 @( T& r' i0 C5 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % H) k8 P7 J, ~; d. [! X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' x& f. |/ b9 z' c
  67. 6 e) V( Z/ ]# Z, M6 f8 K( p
  68. dma_addr_t dmaphyssrc1 = 0;
    5 ^7 t& i: ]* [' i
  69. dma_addr_t dmaphyssrc2 = 0;- x% F1 E, U3 y: q4 [
  70. dma_addr_t dmaphysdest1 = 0;
    " A! @: o# p; n
  71. dma_addr_t dmaphysdest2 = 0;  i+ c" w  [* S8 ?- Y' E9 `

  72. ) X* w" k9 G$ m6 V# D
  73. char *dmabufsrc1 = NULL;
    ! }/ n5 `$ ~! z, s& @* d: G
  74. char *dmabufsrc2 = NULL;2 C8 Q/ c+ b# t2 q: I1 Q
  75. char *dmabufdest1 = NULL;) f- ], ?$ i- {' A) h
  76. char *dmabufdest2 = NULL;: G. g( ?" W; `5 |
  77. 5 l# O( W5 z" g/ q' ~, Y9 M' Q5 F
  78. static int acnt = 512;
    , J! p, t8 Q/ C$ W7 A
  79. static int bcnt = 8;
    $ U4 U3 E8 H# A+ L( x( d
  80. static int ccnt = 8;
    6 i" M1 }# {+ l6 t- C* r0 {. e

  81.   i* ?# A; s' o+ P  A  T3 y; ]' f. d
  82. module_param(acnt, int, S_IRUGO);
      q: V$ X2 P4 I2 r
  83. module_param(bcnt, int, S_IRUGO);+ x4 G. A& _: G, I8 r6 M2 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ j# y% \; T5 Y# v9 h3 q
8 a3 }5 D# S2 E$ W/ O* ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ]& Z3 G& d3 q+ {% r7 c4 f
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 W; l* L/ t: ^# h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! p  k' i, `/ S9 {- ?, t/ f8 t( i
+ G) j. f+ {9 n8 h  M4 ?& Q3 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-31 00:40 , Processed in 0.042510 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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