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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 v$ @# X+ c- x* p/ a0 F* d1 @5 t) g# X
  1. [code]EDMA sample test application
    0 o$ B4 e: m" n0 Y! L4 v. l) [
  2. /*
    & Y& c) D& w8 w6 d; V1 }
  3. * edma_test.c3 P5 d/ n6 t, X( I; b
  4. *
    3 S2 k+ G4 a6 @4 I7 J* B
  5. * brief  EDMA3 Test Application' U- J# h! _+ R+ B
  6. *
    / b8 A; M" b; W, Z$ J7 J: K, h, A
  7. *   This file contains EDMA3 Test code.
    & c- Q) b$ R; n/ _% q
  8. *" [( r9 @+ Q3 r9 \) E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; U( M- k# ?" n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, I0 ^. N2 s7 H. |
  11. *         TO CHANGE.
    . a5 ~! o  E) G/ E
  12. *- G. E5 _! U" [% ^4 A. D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% f! v" c% t+ u. d8 M
  14. *. x7 S' W2 Z' m9 a2 l" J9 d
  15. * This program is free software; you can redistribute it and/or7 ~8 o8 ^9 B8 G; t
  16. * modify it under the terms of the GNU General Public License as
    / Z* Z7 c' U1 K
  17. * published by the Free Software Foundation version 2.: u4 B' H5 ]5 I2 j# W/ I
  18. *
    # n' T. ]# Z1 b/ \0 A! t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; @$ T* ?( i5 y4 v; l: c
  20. * kind, whether express or implied; without even the implied warranty
    ) @8 R& F$ X/ v8 \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 J  l3 n$ @3 P" d% k* M# a
  22. * GNU General Public License for more details.
    2 ]3 [' o2 A/ x6 K
  23. */: X" _) \9 t: P3 L  Y( L
  24. 5 \+ t' O3 t5 ?' a9 A: N6 S
  25. #include <linux/module.h>
    $ ^3 ^& k$ l; O( E5 \. t# ?
  26. #include <linux/init.h>
    . s3 F4 Y9 n& I0 N0 g
  27. #include <linux/errno.h>
    8 l, V' R/ U4 b3 f" O: W5 r6 V' l
  28. #include <linux/types.h>2 ~, A# i7 _) [% I2 R& Z, ^
  29. #include <linux/interrupt.h>3 }7 A3 Z& c0 V/ m6 Z. f
  30. #include <asm/io.h>6 r+ `; U$ U. t
  31. #include <linux/moduleparam.h>
    - O$ K& N, y1 [+ m; @8 Y  F4 G
  32. #include <linux/sysctl.h>
    7 H  {' e) S, m3 \# d) }. g9 _4 A$ e
  33. #include <linux/mm.h>
    2 g/ t, y6 u; A3 x( k
  34. #include <linux/dma-mapping.h>$ X6 B# y! {# @1 Z) ^! F' g& C

  35. ' y  v* @4 F1 d& y" L* E. _8 Z
  36. #include <mach/memory.h>4 J- o9 X" w% T2 c
  37. #include <mach/hardware.h>  }! k# y+ m- k
  38. #include <mach/irqs.h>
    6 ^' V( w: R, m% M2 `1 R' S* ^
  39. #include <asm/hardware/edma.h>0 S  {4 x; X" S: P- l
  40. 9 o& n- X+ ^0 a1 ^; J
  41. #undef EDMA3_DEBUG) `+ v& M) f2 z" E) H
  42. /*#define EDMA3_DEBUG*/
    9 Y# ^6 V1 B$ s1 w4 e5 w! `

  43. + G) B- A  H2 Z' u9 X$ U9 Z
  44. #ifdef EDMA3_DEBUG
    8 u5 P# _& z5 V# x1 s, c3 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - X# N( z7 g2 F$ V7 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 q+ }$ X2 A6 t/ D1 _  u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l# n: M% w4 p3 ~8 ~( {( u( t. l
  48. #else
    , P& N6 {; h7 l& M
  49. #define DMA_PRINTK( x... )
    9 a* o) S+ i" _! j0 P' O
  50. #define DMA_FN_IN: b$ Z2 ]1 W: k. ?% `
  51. #define DMA_FN_OUT' ]. I0 b1 |  V
  52. #endif
    7 J4 Z$ R2 `* S* Z. E

  53. . A: r$ d# W0 t) c  t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 B' K# a/ g1 _3 `# I- n
  55. #define STATIC_SHIFT                3
    4 o% o! a0 T! z; ^6 u4 D
  56. #define TCINTEN_SHIFT               20( X3 X- G$ n5 O% D4 R- I
  57. #define ITCINTEN_SHIFT              21
    ) C4 I" @! U' Z! D4 {" c1 b
  58. #define TCCHEN_SHIFT                22
    7 b  ~1 g7 w) }) V3 E$ H4 h/ f
  59. #define ITCCHEN_SHIFT               23; u% Y  \/ S2 F) T

  60. . a" T7 `$ h( M/ B* r
  61. static volatile int irqraised1 = 0;! h; m7 t7 V5 M0 X: {+ J9 H
  62. static volatile int irqraised2 = 0;
    3 D$ H! H8 ]' |. T

  63. 5 {/ Y# i2 ]- q1 p( Q) A7 i, {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; s' t- V, p% T. _  c" o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% N3 A& Y1 m. Q6 w$ g3 t/ b& \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b& H. B! D. z- i% x

  67. . v3 J7 @/ M$ N* O9 X! f! Y" ?
  68. dma_addr_t dmaphyssrc1 = 0;. Y" [) y& U; P* o* A; E! J; w& R
  69. dma_addr_t dmaphyssrc2 = 0;
    & ?- C  W9 @6 C4 F- {
  70. dma_addr_t dmaphysdest1 = 0;' \. r5 g7 P" N6 x' t7 O% X
  71. dma_addr_t dmaphysdest2 = 0;0 G) F8 e5 o9 B) X, G8 y
  72. & i1 j% Q7 c; W9 `/ a
  73. char *dmabufsrc1 = NULL;% ~/ T& y8 d6 r
  74. char *dmabufsrc2 = NULL;( v+ N2 n6 T' O3 n: q" Y$ B5 b+ }
  75. char *dmabufdest1 = NULL;4 h3 f0 x! p% t' |, j
  76. char *dmabufdest2 = NULL;
    $ h8 V- N3 n9 n6 ]2 T0 L$ f; g

  77. & q4 U! n1 f) h! [  g! u! @
  78. static int acnt = 512;% _! I) o3 X# X8 r) v; _) ~
  79. static int bcnt = 8;1 ^! C0 L+ l: j
  80. static int ccnt = 8;
    ) u3 o7 Z' x1 l6 |# G

  81. # e& O5 }! R) M, K6 W7 Q7 l- x
  82. module_param(acnt, int, S_IRUGO);
    : Y$ b; P& T. f6 {! u' n0 E
  83. module_param(bcnt, int, S_IRUGO);
    3 ~& L- o3 U+ R0 U, E& [. h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 Y1 Z, l, E5 C! c+ z6 D

( {8 j' ?' d' R, L( [) o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; d' ]4 A3 t5 T# j; U% p0 U. h( v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 c% V5 F+ n! j+ |( R& A+ P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% N: T. W) m* `( I, I5 H
. Q$ v! O( K2 ~( [( L  z! m

# M6 B9 m" H5 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-24 07:21 , Processed in 0.039173 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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