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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 c! B9 k( m4 \9 Z
  1. [code]EDMA sample test application' R, B% J# v7 X! v
  2. /*
    7 Q, J1 I5 {* }
  3. * edma_test.c, C* @  N! E& J. W
  4. *3 k1 w0 m3 {3 p* U
  5. * brief  EDMA3 Test Application
    ( m7 j; y7 V  ]( z2 d$ C; m
  6. *' r: ~: U) S0 m* F- a! k1 P
  7. *   This file contains EDMA3 Test code.
    ) v1 M" r  v! q  @: u& i8 _7 K
  8. *( w9 z. [7 O3 d$ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - V2 Q+ y  o' n' i7 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& I8 z# g0 n. y/ `9 T
  11. *         TO CHANGE.
    4 L$ f. B  x" M; Y0 F) K7 }
  12. *
    4 J2 C  A0 I* E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ @! b8 I2 P7 L
  14. *# ]8 [4 \( ^  H/ u7 K4 {
  15. * This program is free software; you can redistribute it and/or& c, u' l+ o  Y! L
  16. * modify it under the terms of the GNU General Public License as
    ) l' B# `. {+ j
  17. * published by the Free Software Foundation version 2.7 w5 E8 B4 }5 h9 W
  18. *
    " X! n( z, r4 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 s" R! y. W% \3 e
  20. * kind, whether express or implied; without even the implied warranty- N8 ?/ }3 @. p! W7 `' ^4 l; }9 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: k! h8 U& n5 w) `
  22. * GNU General Public License for more details.0 n2 h2 O9 H5 W1 J) p- @( p. i7 z/ D
  23. */
    * X$ L/ z# \$ U* ~+ n

  24. 1 V# G) F# v9 I
  25. #include <linux/module.h>
    1 g3 W" L3 P0 _0 h  z: ~! C0 i5 ?
  26. #include <linux/init.h>
    ' c" C9 S1 Z1 {" ]
  27. #include <linux/errno.h>9 b. ]0 a) I+ L- r$ {, v& ~
  28. #include <linux/types.h>, G9 _- M8 s; E- Q; a6 u4 m: W  O3 x
  29. #include <linux/interrupt.h>1 v$ q1 |; n4 Y' c/ T3 F
  30. #include <asm/io.h>
    0 }( P6 G8 f; s6 N
  31. #include <linux/moduleparam.h>' G# H8 l8 N6 x9 m) h$ `
  32. #include <linux/sysctl.h>7 v, p0 H- E" k" T
  33. #include <linux/mm.h>
    9 j- F% |5 x: Y: I2 y
  34. #include <linux/dma-mapping.h>0 h5 q% y9 u9 T

  35. & a  I" k& V* ]# `# ]; `3 Q
  36. #include <mach/memory.h>
    , \7 Y! n1 t/ V; Q( X- e0 O
  37. #include <mach/hardware.h>8 w$ @# P4 ^/ u4 H% }% u5 ^3 g" O
  38. #include <mach/irqs.h>
    1 N6 t+ S8 f4 m. i1 }/ J  c- ?& w2 b
  39. #include <asm/hardware/edma.h>
    + p$ Z: `6 u7 W% a$ D% U( Z

  40. 0 }/ D4 N! M. C% m
  41. #undef EDMA3_DEBUG# Y) N/ y5 f4 M  ~
  42. /*#define EDMA3_DEBUG*/2 B/ o' O1 S$ ^4 l" A2 ?, D
  43. # B1 t/ [7 d! S9 q' [( q/ `
  44. #ifdef EDMA3_DEBUG
    ) P7 M  q& X' l) q. a: ]; x; b5 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% `8 S4 l  {* I* K% m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& _2 f. s4 k, g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), Z" A$ K) F! y* S7 z; Z
  48. #else/ n6 F9 {+ ^0 v/ m- _( l4 S
  49. #define DMA_PRINTK( x... )1 b3 G$ l+ l9 F! _
  50. #define DMA_FN_IN+ a6 ?. `" j& g6 P3 J, b
  51. #define DMA_FN_OUT  N& c1 L8 f' Y  u
  52. #endif3 k' T! r4 x* a' ?

  53. 3 l6 K1 d% z% Q/ O4 N$ J( I& L  x# W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & o& }! X6 ^& A$ ]$ v  }( `
  55. #define STATIC_SHIFT                3# ?: Q. D% y7 U; I5 D
  56. #define TCINTEN_SHIFT               20
    2 Y, F% d% U& v, v$ t* f
  57. #define ITCINTEN_SHIFT              212 ]) `# p! N( Q, e$ i" Z
  58. #define TCCHEN_SHIFT                22( L5 A2 x& m) a+ E3 }8 Q% x
  59. #define ITCCHEN_SHIFT               23
    " t0 m  A7 S8 c' ~1 R- y  i

  60. 6 L3 z" [: g" R# c( e' N0 T
  61. static volatile int irqraised1 = 0;; z# \) y. S& |9 [1 N6 O2 n4 _8 x9 g  u
  62. static volatile int irqraised2 = 0;+ x( R% K2 r2 j7 b6 M8 H! I# H

  63. % U; i) H& T& t# B2 B1 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 H. U! e9 _! _2 E' ^, l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 y" S/ J( S: p, c# m2 `  i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) o) I3 C8 g) r5 F$ A( ?$ ~

  67. # \5 \$ M: m  B9 `
  68. dma_addr_t dmaphyssrc1 = 0;  T8 Z* Y, U4 g5 M$ g
  69. dma_addr_t dmaphyssrc2 = 0;
    ) Y: X: F6 o% E! o
  70. dma_addr_t dmaphysdest1 = 0;
    - X7 e8 P* P( ?! C( S2 a
  71. dma_addr_t dmaphysdest2 = 0;
    ; e- x6 |$ @$ I7 N" x" [1 U# {

  72. 8 }* f) s0 X/ E' y3 V
  73. char *dmabufsrc1 = NULL;
    + I8 m* s" n4 j. z( I$ `/ Q0 T
  74. char *dmabufsrc2 = NULL;
    ' l" n2 Q: c- U4 h
  75. char *dmabufdest1 = NULL;6 {, ^6 L/ ~5 A2 R/ B+ }
  76. char *dmabufdest2 = NULL;
    - j8 Y, I) S% T" l; D/ f  ^
  77. 4 J% H. `) V* Z6 C! d" m7 o- b
  78. static int acnt = 512;
    0 K  s$ o" {) a2 T" W, H
  79. static int bcnt = 8;
    % x7 p  I4 ^' M# N
  80. static int ccnt = 8;
    6 \/ e2 I6 ]  @! m
  81. 7 t& a: y+ S) o
  82. module_param(acnt, int, S_IRUGO);0 S; z% h# t, ]0 i9 O
  83. module_param(bcnt, int, S_IRUGO);
    . @9 Q0 t) E- T# z( u! I# F! p. H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, q+ m0 e4 w6 A/ n% Y
' D$ s8 t" ^( _1 b0 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% T" l# J) z/ v; S% O! E1 e: Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' I7 I7 L' H" {4 [: h0 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 \2 b6 T, {2 I& r7 Z* i& l: \6 r% S; U& P- e
( ~. D. V) J+ ?6 L4 `. Q/ k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 01:17 , Processed in 0.040405 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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