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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' q' ^; {% E0 p
  1. [code]EDMA sample test application& n) j2 Z8 m. x& y, F1 v% w4 _( H1 K4 e
  2. /*+ \" C$ l# O3 ^1 a, i7 ?
  3. * edma_test.c* W) ^. ]5 D; b, z1 X4 Q: Q
  4. *
    2 W: U8 g- i! K* d! d  W
  5. * brief  EDMA3 Test Application
    + M% I: d) R% |) W9 C. b
  6. *$ B( G0 d2 i$ @7 A- M8 b
  7. *   This file contains EDMA3 Test code.
    % ~! G% ^1 M( }
  8. *, {# ~# |3 _7 t, K& `( |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / }2 b% x" R, e$ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ U# W* P) q8 S% o  C  `' p
  11. *         TO CHANGE./ v, T1 n2 O3 z8 u; ]% |) F5 ?/ P
  12. *
    5 ]/ S0 a$ H& A) `$ C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: m+ s# ?$ L6 n6 U$ Y
  14. *3 G; \: I7 a$ m6 t; ^- ?9 _
  15. * This program is free software; you can redistribute it and/or
      d7 I' I7 w( `6 [1 p
  16. * modify it under the terms of the GNU General Public License as
    9 f8 t5 ], P' e# F5 L
  17. * published by the Free Software Foundation version 2.
    7 R* `0 V5 X$ b. i7 k$ p
  18. *
    ' q# L- B8 M6 W, s/ N; l6 m9 |; n' r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- S. S" m4 j" q/ y8 b
  20. * kind, whether express or implied; without even the implied warranty6 s6 W( Z8 g2 C" U0 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 Y& ^1 T% d# [2 q) m$ f
  22. * GNU General Public License for more details.% m- P; w" W+ d7 n) d
  23. */3 B- b& H. @7 d" B, \5 d/ g
  24. ; k( ^1 L$ D8 v+ G; J# f
  25. #include <linux/module.h>
    7 v8 H  G* |( g0 m+ Q5 ~+ [1 [
  26. #include <linux/init.h>
    % J4 ~/ H- g# n2 V* g
  27. #include <linux/errno.h>
    7 v/ `9 i; [. _' W8 I2 `
  28. #include <linux/types.h>& T. I' y) Q/ q' q  F" ^1 b9 _: P( l
  29. #include <linux/interrupt.h>
    $ }% h2 d; H3 E, C; T
  30. #include <asm/io.h>' t: N2 p% ?$ R! ^& j# ?$ f; ~3 a
  31. #include <linux/moduleparam.h>( n8 m4 R0 B6 |  d9 i2 N
  32. #include <linux/sysctl.h>0 }9 Z" U  {  f% i/ t7 }
  33. #include <linux/mm.h>7 q, y9 [7 p1 E
  34. #include <linux/dma-mapping.h>* G) `6 o' T* R' E" [/ C; A

  35. / Z) O/ \: c: ^9 c, H; \% F
  36. #include <mach/memory.h>
    1 p2 d: }: L5 H5 M* x5 Z
  37. #include <mach/hardware.h>+ E/ d& c/ [% ^' T
  38. #include <mach/irqs.h>4 [6 }3 Q* `' {  i0 U) s
  39. #include <asm/hardware/edma.h>% t, c$ k& T7 X
  40. 8 N1 ~  H: \& T3 [2 @. r* p5 v
  41. #undef EDMA3_DEBUG
    , }8 n2 `; b1 \& M) C
  42. /*#define EDMA3_DEBUG*/
    , ?* {) W7 F! Y& k

  43. ' M  O1 H/ o4 f; o  a5 o
  44. #ifdef EDMA3_DEBUG
      j9 r) w2 ?* G$ y; B' A$ h/ [( q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 K- o% T8 r, [2 H# B. @6 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 X5 I# y: N- Y/ q% M5 F; y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S7 d$ o$ s: Q0 }6 @
  48. #else) Q( B% w8 ~9 j+ |/ t  Z* k* @
  49. #define DMA_PRINTK( x... )
    ) @3 ~7 {, k0 |- a
  50. #define DMA_FN_IN
    $ \) W+ B& h' K  ?; I/ K, w/ X
  51. #define DMA_FN_OUT3 H5 O. Y( P: X/ ~
  52. #endif$ _; H$ R0 Y+ F( g
  53. & f# ^) e2 D" g8 W' M# \, g/ a6 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' M% m9 U5 }% W8 ]& X
  55. #define STATIC_SHIFT                3( e+ `* B' c1 a" T! ~
  56. #define TCINTEN_SHIFT               20% |5 D: R) X, }) U
  57. #define ITCINTEN_SHIFT              21! \  ^1 ^6 [% N' _+ o: y* w; c$ N
  58. #define TCCHEN_SHIFT                229 o/ ~( ?' V4 ?3 |
  59. #define ITCCHEN_SHIFT               232 f5 f, V6 y; A0 I- K
  60. , u' F; {: O+ [
  61. static volatile int irqraised1 = 0;( [! N7 c- R2 x' O2 }5 H& z* \
  62. static volatile int irqraised2 = 0;
      G' D* @# h2 Z% A9 y; r6 g

  63. * n0 a0 i( z1 Q" X) ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# h# ], n' |8 e% `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M4 A6 x, }4 ~, H+ S: x* C( F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ M8 h& X) ~+ a' x6 K; j5 x

  67. ! w# @- J: v* w  Z
  68. dma_addr_t dmaphyssrc1 = 0;2 L8 A, Q& T0 A# C2 y4 x. v0 ?& z
  69. dma_addr_t dmaphyssrc2 = 0;' V4 h# ^/ m6 o$ n
  70. dma_addr_t dmaphysdest1 = 0;# k! e( d$ \/ H* Y: g5 \5 v# ~6 q; ]4 u
  71. dma_addr_t dmaphysdest2 = 0;5 B! {: x/ |- |. c
  72. 9 r4 H5 ?3 m4 ]. A
  73. char *dmabufsrc1 = NULL;! \. V9 `" Z4 `
  74. char *dmabufsrc2 = NULL;
    & c! t& x3 {. m
  75. char *dmabufdest1 = NULL;
    / m0 l) q- S5 x3 U8 ^* T0 U
  76. char *dmabufdest2 = NULL;
    , G2 i0 _* _, i, _' E
  77. 4 x9 `6 h: }* V4 S( b
  78. static int acnt = 512;
    9 z; v# a! U+ }) K  H
  79. static int bcnt = 8;
    0 p# n# |# G; B0 g* J, G
  80. static int ccnt = 8;3 C8 [! x3 R# N8 ^
  81. 8 G8 C( f" t) j* d$ m# t. p
  82. module_param(acnt, int, S_IRUGO);
      l7 J9 f" i$ _
  83. module_param(bcnt, int, S_IRUGO);
    + s8 g' h  y# p  d% h4 g: Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 U9 M6 s) e  b9 h# q% U; R, B. s2 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& U1 G; y1 c* [6 I% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 c7 j  {% N+ P" W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 R) l; V/ V7 @
& _' m7 I5 r6 Y" R" L

$ w, q$ l1 A# I7 N7 Z1 ?) S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 03:52 , Processed in 0.043044 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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