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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & m" D$ n! d3 o# L" {) P
  1. [code]EDMA sample test application4 y2 d/ }2 V; h3 x! o1 s) C0 {# p3 }
  2. /*
    2 r7 M9 W* J& M: q4 @* y2 D
  3. * edma_test.c7 ~1 B0 v7 T6 V' }/ I+ `
  4. *
    5 Z9 H* B% y1 ?/ H
  5. * brief  EDMA3 Test Application; i1 h/ H+ O  m- V3 z
  6. *
    6 d) j/ s" W& o7 ]4 U" ]
  7. *   This file contains EDMA3 Test code.
    7 a! H$ F/ |. s9 k; e; `
  8. *2 v. p$ \' p- ?; N9 ]4 e8 V& k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 D4 k0 b8 g7 K" ~$ m6 u# W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 c7 h, D  B3 a) j9 Y9 W& a- d$ a: M
  11. *         TO CHANGE.
    " r- o! w& Z0 Y7 [% S4 N; S5 U
  12. *4 ^: x+ Q; Q1 c* e, m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 w0 w% k7 ?3 ^5 I& N2 j- m
  14. *
    . K8 j1 V8 W/ W6 n
  15. * This program is free software; you can redistribute it and/or2 N. G' w, q) i6 n& ~8 U5 U
  16. * modify it under the terms of the GNU General Public License as2 G# N4 M2 j( Y5 j$ G% s9 v
  17. * published by the Free Software Foundation version 2.: H$ T; ^- E4 _" L* \
  18. *
    8 U3 w: b) D/ C, _4 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      g0 o  `2 e+ Z/ v6 _
  20. * kind, whether express or implied; without even the implied warranty8 e9 {. A5 z, S( H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; u4 I1 k" H5 E6 l: c" S# b6 V8 @( Q
  22. * GNU General Public License for more details.* C+ x6 {- b, @5 o
  23. */
    + M2 @1 j2 i. ?5 U% ^9 \) o* P
  24. 2 S% d" e4 g) y5 }. i
  25. #include <linux/module.h>
    : [% F4 _9 f. \' ?/ [
  26. #include <linux/init.h>9 |1 j4 j* c4 q# U- ^' p, z
  27. #include <linux/errno.h>
    : N3 B0 |: `' O5 W. c9 e
  28. #include <linux/types.h>: s5 Z/ r& U) s6 @
  29. #include <linux/interrupt.h>
    0 o' g2 ], S) V0 o1 i
  30. #include <asm/io.h>
    ! |4 ]" [8 N7 K, w' ?
  31. #include <linux/moduleparam.h>
    + T. S$ i; K! v" Z' R  f2 p; w
  32. #include <linux/sysctl.h>
    ; m: Q2 S4 B  x6 I( N* K
  33. #include <linux/mm.h>
    / S6 B4 l" v3 d2 X! w, Q9 Y: E
  34. #include <linux/dma-mapping.h>$ I4 D* P0 x$ B& L- G* F
  35. - i8 m0 Y+ _2 }% ^
  36. #include <mach/memory.h>
    7 K/ |9 t' W& r8 |
  37. #include <mach/hardware.h># l- G" z1 T* m! P# p6 z/ x
  38. #include <mach/irqs.h>' C' R0 ?% S  a7 e
  39. #include <asm/hardware/edma.h>5 _2 s7 e1 {. \4 F* x

  40. 5 P$ a/ A/ b. p& ?( N+ g
  41. #undef EDMA3_DEBUG
    / |) A6 c) [$ Z/ b
  42. /*#define EDMA3_DEBUG*/7 \3 m1 k$ n. |& d; j
  43. 6 ?) e% q7 `* {& c- E+ r
  44. #ifdef EDMA3_DEBUG. ~1 K2 [4 v% G0 `9 B; ~1 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # A4 n% A2 R* j5 C+ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ }! a" e: A3 S' V+ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" b: o' I7 {: s, C! P) y/ k
  48. #else
    - U" g0 e! w* a4 U: M: ?0 }( }# Q
  49. #define DMA_PRINTK( x... )- q. I7 W* h1 P7 b$ g
  50. #define DMA_FN_IN& a; {3 V' M4 @6 {5 R9 c
  51. #define DMA_FN_OUT, k/ E+ P& D# M% y$ w" ^; O
  52. #endif
    4 F4 D( f8 \0 Z- O- z
  53. & ~& u) R/ }6 Y  m: @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); P/ w4 u- S/ M2 z4 q/ j- q
  55. #define STATIC_SHIFT                3
    2 w$ b' |: j7 O, B; a2 R' @9 \
  56. #define TCINTEN_SHIFT               20
    / I2 }, D# K! d3 y8 P
  57. #define ITCINTEN_SHIFT              21  O' Z" c. x7 t8 m* d* B
  58. #define TCCHEN_SHIFT                22, x9 k. r) p/ O% ^; T* j
  59. #define ITCCHEN_SHIFT               23# J! x) n% @; D0 \  e0 T
  60. 6 C! I) {0 \4 B- h
  61. static volatile int irqraised1 = 0;1 c/ L, |1 a. \( x: q+ G, L
  62. static volatile int irqraised2 = 0;
    2 g! W  f& R" F, J; Q$ r
  63. ; ]$ c$ T% X* E6 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z9 t3 ^- V/ }( P2 h/ i- P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u( U1 t# P9 s) j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " u3 C: q+ w! x# q) F1 l

  67. + ^6 F/ f1 W/ p. o$ R) F
  68. dma_addr_t dmaphyssrc1 = 0;4 f9 y* ]  ]/ s6 e3 r6 Q
  69. dma_addr_t dmaphyssrc2 = 0;  Z0 z" H4 Y2 j$ B- L: C) i5 ], e
  70. dma_addr_t dmaphysdest1 = 0;3 R7 S6 a0 p6 e3 d3 S
  71. dma_addr_t dmaphysdest2 = 0;
    1 _0 V; C. c* ^3 g7 G2 V4 X& }
  72. 6 p* J0 ]& ?8 A8 a6 N6 }" _9 f# L
  73. char *dmabufsrc1 = NULL;
    . H4 p6 Z8 L! O9 d! V
  74. char *dmabufsrc2 = NULL;% n* {5 \6 i  F8 l- G, @+ H/ X& ?
  75. char *dmabufdest1 = NULL;8 {3 t: p9 [. v8 @) c
  76. char *dmabufdest2 = NULL;* h) ?5 i6 A6 X4 l# I

  77. & @! B2 E+ W; A+ d, N: e9 n9 Q
  78. static int acnt = 512;, ], [2 E! _" h7 ^  _2 h# H
  79. static int bcnt = 8;6 l- ~( b0 H' R. S: c, F- k0 ~0 f
  80. static int ccnt = 8;
    . [+ j5 I" {* R' [/ D4 m4 l" B

  81. 5 X* S( l6 a+ u. l3 [0 u  y
  82. module_param(acnt, int, S_IRUGO);; h! H1 P5 S* Y- M+ l- a5 q6 J* d
  83. module_param(bcnt, int, S_IRUGO);  Z+ q/ X4 v: ?% W8 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  @* c* h& }7 U1 b1 y. z* L7 H! O8 T, ]0 H' e- j& ?5 d  Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]" s$ U0 X% V6 ?5 b* B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' k2 L8 f( `3 Z) S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" e8 @. h: S5 ?4 ?( ]% {  ]" h
/ V$ a( R' ^% s. J0 |! E8 p( a

# T& w# ^+ E% ^" H4 Y1 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 07:32 , Processed in 0.041017 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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