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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 @3 s5 v& X+ ^) ]
  1. [code]EDMA sample test application4 g9 @& R' b4 w# b$ e/ r
  2. /*8 I  C0 M6 v" ^( `9 b! ^
  3. * edma_test.c
    3 p  r/ [0 [4 Y) p
  4. *
    3 I( Z1 p" g! m) \2 F
  5. * brief  EDMA3 Test Application4 w, v: q( y# p" K- a4 X
  6. *) G9 |1 V- s! v+ z) A, o
  7. *   This file contains EDMA3 Test code.
    0 l5 Z$ J4 i" t7 [% p% s
  8. *5 q9 i1 }; j. S8 T; M" X; d6 K! ~! \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 j  R( b: R/ n8 l& s+ D! Q7 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % C( G+ d4 Z* s; ~. \9 Y
  11. *         TO CHANGE.9 n& f* ^  [3 J* @6 s
  12. *
    $ H& `$ I6 i' z3 M0 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ?* o( ~. {. `  n5 G  |
  14. *6 c: w8 `. N! R, O2 G/ e7 n' Y) X
  15. * This program is free software; you can redistribute it and/or
    6 A. W6 |/ D( p- G* x
  16. * modify it under the terms of the GNU General Public License as
    % c" p( ^- k. a" i
  17. * published by the Free Software Foundation version 2.
    - X  ^, x. {# |, `
  18. *3 I1 \, u1 A  l' b9 g5 z# v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) P! S* o1 Q$ h7 H
  20. * kind, whether express or implied; without even the implied warranty6 _3 R8 h, a2 [  e: c, T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; f5 o+ K' ~4 S8 Y7 I8 L0 G
  22. * GNU General Public License for more details.
    6 v) ]6 c: F( a0 X; X
  23. */
    9 \! g" j5 W/ T

  24. ' j7 F+ b/ a% q
  25. #include <linux/module.h>
    " x/ r" s- l2 c9 m& K- u
  26. #include <linux/init.h>" `! @) u5 @7 j
  27. #include <linux/errno.h>! Q8 \' Y$ R; E- `* q& L# u6 E
  28. #include <linux/types.h>
    " `/ t8 x' k6 N% o( h. y6 V* ~
  29. #include <linux/interrupt.h>
    7 M5 K4 Z  t+ t+ @$ B
  30. #include <asm/io.h>
    " g" @4 H- p3 h- f2 L$ P
  31. #include <linux/moduleparam.h>
    9 b3 u* g, }0 ~* j7 X" @; x
  32. #include <linux/sysctl.h>2 {2 k0 w( H! F3 T7 Y/ }  m
  33. #include <linux/mm.h>
    , |6 ]/ I' z  H4 a
  34. #include <linux/dma-mapping.h>
    ! h9 |9 E0 D* V; g
  35. 9 P- N5 A% n* @0 V3 I/ l- J
  36. #include <mach/memory.h>- S/ K- `/ G6 m. x: U
  37. #include <mach/hardware.h>
    % _  m' R: b8 D5 A' D
  38. #include <mach/irqs.h>
    3 U. C: [9 ]  E# Q
  39. #include <asm/hardware/edma.h>
    : I% L) D! y* P

  40. 5 |* f1 c% p( g: K3 w
  41. #undef EDMA3_DEBUG& w( J6 @+ Z: b0 w5 Q
  42. /*#define EDMA3_DEBUG*/& V" h1 `9 M" g$ ?/ J+ W

  43. & j* I; u; _  S9 M; [
  44. #ifdef EDMA3_DEBUG8 e+ D; y  ^+ w' q1 n9 s' S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ g& V  X/ e( a3 y% B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 ^8 T: g$ B8 ?# ~. T7 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ E1 C; P3 D* k5 {" d* `  U
  48. #else
    6 R0 @/ K/ l; K0 W2 W
  49. #define DMA_PRINTK( x... )( n# a: v: _3 M9 S! g
  50. #define DMA_FN_IN
    ! a5 q: u! H# _% J, y3 |; S
  51. #define DMA_FN_OUT
    6 j5 ~8 z) M5 R; ~
  52. #endif
    3 A% G* `, T( r$ I, t# B9 R6 n2 D

  53. ; O) O3 @" ]# w: Z, `/ ?# w0 y# g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 H4 v0 X/ Q8 i/ G6 n
  55. #define STATIC_SHIFT                3
    % B; @' U! _4 K) N1 k- ]
  56. #define TCINTEN_SHIFT               20, H8 w0 F7 J9 W# v) y% |
  57. #define ITCINTEN_SHIFT              21( I+ Z9 P  o! F$ _# u( R  J* G. z5 c
  58. #define TCCHEN_SHIFT                224 R' G" ~: L0 L0 w  ~6 b
  59. #define ITCCHEN_SHIFT               23
    6 I. y# z; g/ f! T
  60. 4 u' ^6 j9 \8 P# T  K" I: P! n
  61. static volatile int irqraised1 = 0;
    ! u' \0 I" L8 \. ?5 W: a
  62. static volatile int irqraised2 = 0;( E1 m9 d: r8 I$ p

  63. 4 E- f& G8 ?4 g0 C4 y) h& C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 x4 Z) B' T2 `/ t* |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I, C# I- R! v7 g% J/ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J- B8 S+ L9 |3 v$ ^( ^( Y' p

  67. 4 t  J+ Z1 M( P* [  D9 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    6 J, J7 m) Q6 J" s! [9 C/ ]
  69. dma_addr_t dmaphyssrc2 = 0;! R0 b+ V3 x6 t5 e! u1 V6 R
  70. dma_addr_t dmaphysdest1 = 0;
    * D$ c3 J$ o3 ?3 U7 p2 g- J
  71. dma_addr_t dmaphysdest2 = 0;* K- B; n* Z' R* P
  72. : c: v$ d" ~4 A; H
  73. char *dmabufsrc1 = NULL;
    4 z& b- f8 N. G. ^' H/ Z8 u
  74. char *dmabufsrc2 = NULL;
    . J  d; C7 W5 r5 {: q
  75. char *dmabufdest1 = NULL;
    3 I8 a; v2 C$ z$ R6 c
  76. char *dmabufdest2 = NULL;$ F; H9 C1 F* I: S* N0 D8 b

  77. ; }) e8 {( I) h- |# D
  78. static int acnt = 512;/ h8 y0 f& L& J
  79. static int bcnt = 8;
      ?* Y" }: P% w
  80. static int ccnt = 8;
    " s. c, _9 w1 o3 [* V
  81. : F: q3 P  P8 c+ y8 Q2 _
  82. module_param(acnt, int, S_IRUGO);% P; P8 |: f4 Z9 ^
  83. module_param(bcnt, int, S_IRUGO);
    0 Z- ?6 f! w7 h: R7 s' R8 M2 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 m2 Q/ Q! b- ]6 }& Q+ _  H2 f6 c, e- e! i( ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 a0 n4 l% E# V4 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 f3 T7 @+ e7 Y7 ~* N2 R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' x% |* W0 j' y% q5 ]* z
9 i& c, @! c+ [+ G9 G
  l& a6 \) h& y2 u! [' g+ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 15:41 , Processed in 0.043311 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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