OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I! {! f1 ?6 T3 }; r- Y
  1. [code]EDMA sample test application
    ) D1 K, g# ]4 a8 n7 S  p
  2. /*
    8 ?( L1 ]# j: E( Z5 I1 V% l, C
  3. * edma_test.c/ L# N, _6 C, J( W" h2 U
  4. *# s! r' {# x: b, I0 }2 h' L
  5. * brief  EDMA3 Test Application
    . \& c$ O5 x/ h3 t5 H' p
  6. ** L  M1 t3 S  g1 A9 D8 r9 t' u
  7. *   This file contains EDMA3 Test code.
    5 T; p- Y% n3 Y: B) {1 K0 s
  8. ** @: g4 A1 y* y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; G; v9 B; W: V9 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! k5 T' Q4 t: v, N' k$ `  a
  11. *         TO CHANGE.! o7 |" I1 J- U5 n" f- s
  12. *
    7 M8 e0 z- L8 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 e. a/ Q4 p1 i6 q  a; e
  14. *
    5 ]! w# ]5 i" E  z+ ~
  15. * This program is free software; you can redistribute it and/or
    - z" D6 Z8 I+ Z1 Q- r8 U" c1 o
  16. * modify it under the terms of the GNU General Public License as
    4 N  `! h8 {+ ^1 _+ @+ X6 J: f: M, T
  17. * published by the Free Software Foundation version 2.
      L* ^$ z' N4 C6 }9 R
  18. *' I1 N) y" Q7 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 P3 ~5 e' f# g: t% e, M- a2 Y
  20. * kind, whether express or implied; without even the implied warranty5 n$ H; q, {) b7 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ a0 |* x) z, ^; ^' n+ |
  22. * GNU General Public License for more details.
    $ ~- O+ {- y# c* t
  23. */
    * {, C+ P) M5 i- E

  24. 9 s( [' J5 D+ w7 ?, I2 ^
  25. #include <linux/module.h>; p. [; _, P% t
  26. #include <linux/init.h>+ B) n: u* w8 |6 X
  27. #include <linux/errno.h>
    2 ^: v. E0 }7 P1 z
  28. #include <linux/types.h>
    3 Q+ g+ h) G/ ~# ]& n
  29. #include <linux/interrupt.h>
    ; @& J0 _0 c, h8 b$ p- {
  30. #include <asm/io.h>
    * S: b6 `0 X# @% Z/ U
  31. #include <linux/moduleparam.h>$ r2 U: m% g, c6 |8 B: O
  32. #include <linux/sysctl.h>% Q2 Y  W4 X. ]
  33. #include <linux/mm.h># `4 c! b: N( W! ?1 @
  34. #include <linux/dma-mapping.h>5 V. q$ c: C; g! w. u

  35. . J. `- Z% e! m4 C
  36. #include <mach/memory.h># G3 j- ~. C- n9 Y  {) X! l3 d
  37. #include <mach/hardware.h>' y+ N- {, Y* E9 |# @+ `! H( N
  38. #include <mach/irqs.h>! Q" w. `0 Y* y8 H' k- c
  39. #include <asm/hardware/edma.h>
    0 P' y8 f1 \- Y' C7 l0 w8 c- v- [

  40. 5 V. P) @4 [" u- c6 l+ ^0 ]
  41. #undef EDMA3_DEBUG
    ) d8 I4 ^# t& M
  42. /*#define EDMA3_DEBUG*/+ P$ X; C: @, g, b& ]
  43. 5 n+ Z7 N* m0 s' R2 M6 m
  44. #ifdef EDMA3_DEBUG* O+ g* O5 v; X6 Q6 s+ l* I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ v' {/ e- D! e3 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 A  J6 q- p& [7 A7 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& f! }3 B' Y6 R. `6 q  O
  48. #else" N: S3 j" U1 B$ i
  49. #define DMA_PRINTK( x... )
    ; k3 M2 ~3 o' Y# X
  50. #define DMA_FN_IN
    ! x! _- e2 F+ L4 g" x" ?
  51. #define DMA_FN_OUT
    1 |+ ^9 d/ F% b3 w
  52. #endif* g' W# |3 P1 K) X' H
  53. 2 g( e2 Z! H+ J  V3 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) b$ g! h  E+ N; _% Z: u9 b. g6 u9 ]
  55. #define STATIC_SHIFT                31 t2 I; o& w* E8 b% o
  56. #define TCINTEN_SHIFT               209 K. U0 t7 _8 g9 V
  57. #define ITCINTEN_SHIFT              21
    & w2 l8 y; }; P
  58. #define TCCHEN_SHIFT                22/ Q6 o- h9 f$ C$ q  m
  59. #define ITCCHEN_SHIFT               23
    ; O2 D% ?% z6 x+ N; @3 G4 Z
  60. . f  C3 k0 E3 y$ n0 c
  61. static volatile int irqraised1 = 0;
    $ T) u4 ^- o+ e' e4 o, r  W- Z! r6 w
  62. static volatile int irqraised2 = 0;
    1 c- D/ Y9 ~: e8 X

  63. 4 ]$ `6 Y2 e' p0 M6 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + E8 U5 P. A8 N; m/ w. z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# M. g9 R3 P1 _' y% ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 Y- O8 s! z  F

  67. 7 _+ l8 F2 K9 S, y0 g' G
  68. dma_addr_t dmaphyssrc1 = 0;4 S7 x$ `- e% O  w! Z& \2 Q: |
  69. dma_addr_t dmaphyssrc2 = 0;! ]2 ^- d& ~# J  ?4 Y
  70. dma_addr_t dmaphysdest1 = 0;: N$ P# e$ m6 K* S; i
  71. dma_addr_t dmaphysdest2 = 0;
    4 }( l( C- o7 [5 F7 ^- m# `3 H

  72. ! v' W6 i* C& L; [
  73. char *dmabufsrc1 = NULL;
    1 \' _! }( m, D8 }
  74. char *dmabufsrc2 = NULL;
    " ^* ~- B4 W; I! c% h
  75. char *dmabufdest1 = NULL;
    ' D) U- q" ?. X4 C$ Y
  76. char *dmabufdest2 = NULL;/ j- S4 K0 w! A
  77. 4 V4 e, N0 Y  ~1 R' K& V
  78. static int acnt = 512;8 D7 q# l) D3 M- b% x
  79. static int bcnt = 8;
    # L3 ]6 u( s% ~/ i: r
  80. static int ccnt = 8;
    + @% j+ \) ^% v( E# t$ }8 p1 y2 K7 m
  81. . J3 f. l; q' i- Q7 G0 o9 W# Y
  82. module_param(acnt, int, S_IRUGO);: x) U- {& N: p9 P/ B
  83. module_param(bcnt, int, S_IRUGO);
    - Z& i& p0 [. ?5 n, D" Q/ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& I! o+ ?$ e+ W. U' d' e! L" F, z/ o$ D! N' `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 t  V) I9 n& p. A: O" b- Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: p$ m) t7 @/ S) C! U8 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: L$ i* Z2 |/ B- B

& f+ t4 {$ x& j3 r) ~2 P" f; J0 A5 H2 H" ]0 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 13:08 , Processed in 0.038448 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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