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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( m) ~) z+ C$ O  s& _3 I2 G" L0 s
  1. [code]EDMA sample test application
    ' f( O) k% I3 a' B2 Y. e
  2. /*. a' H% @0 v0 }: r
  3. * edma_test.c
    * M# y- `- D  K0 k' X* n
  4. *
    - E& K# a! g  u' R' A$ p$ m
  5. * brief  EDMA3 Test Application& I; H+ z8 m6 p% J5 y5 J0 [- V6 ?
  6. *
    & d0 }9 p  J; T1 |0 a
  7. *   This file contains EDMA3 Test code.1 }6 |% Q' {8 z, e% f- ~+ _
  8. *
    3 R+ k- m9 C4 }; {9 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" r; @3 Y3 y$ C( J" S2 U4 H" n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 F: h6 i) f; ]  y% Z1 F
  11. *         TO CHANGE.
    0 l* S7 Z' B9 v& f
  12. *- g1 Y! b" t$ u5 w7 M# ~, ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 y# A: _4 K0 Q8 q) ~) G  Z
  14. *( v3 D+ ~* T& c% R
  15. * This program is free software; you can redistribute it and/or7 {1 ^7 [9 e! _6 s- i
  16. * modify it under the terms of the GNU General Public License as
    ( N1 v  C" a! ~
  17. * published by the Free Software Foundation version 2.5 m$ N7 W( E4 X# v& h* [) {1 w
  18. *
    3 f# A" [% Z  I) ]8 m8 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 m! [' Q& ~4 s* L
  20. * kind, whether express or implied; without even the implied warranty
    & g9 Q) `5 E5 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - r; J! c( q9 I0 ]' H9 ^! z
  22. * GNU General Public License for more details.1 |$ u1 P- {. x4 S+ `' {6 q$ o: b
  23. */
    4 j6 v# K  {: a% _

  24. ! s8 H9 @2 _6 m8 g  o
  25. #include <linux/module.h>; v% d! s) q- r9 E
  26. #include <linux/init.h>/ N. [5 J4 ~( u1 C  O
  27. #include <linux/errno.h>
    * B- {) Q. N3 p
  28. #include <linux/types.h>& ?7 T+ ]2 f1 I+ T6 U; z
  29. #include <linux/interrupt.h>3 ?! G' j) Z- [: r
  30. #include <asm/io.h>5 i9 ^( m* A* W3 R, W* B
  31. #include <linux/moduleparam.h>6 z5 D4 @7 G4 o9 O1 V- y- s/ _: u
  32. #include <linux/sysctl.h>
    # E/ j3 H* o3 [9 A6 R
  33. #include <linux/mm.h>
    . E$ J7 p. M& G( x# L  i3 l6 _
  34. #include <linux/dma-mapping.h>
    ( ~& ^8 H1 ?  ]9 ~7 A
  35. : g! I  V  }, ?6 k. j! y) \; y
  36. #include <mach/memory.h>! q  R# z" ~8 s- K/ V
  37. #include <mach/hardware.h>  L* E. u; M- Y* W
  38. #include <mach/irqs.h>
    2 S% U+ l# f6 I5 `3 D5 F
  39. #include <asm/hardware/edma.h>9 x0 n2 d7 E- L" ~9 _. [- g
  40. & i- D0 q# _' ]8 W$ Q
  41. #undef EDMA3_DEBUG/ E* F% m6 X3 X+ x, n( n0 @/ j5 f
  42. /*#define EDMA3_DEBUG*/
    + l, J0 O' t" F3 N% k

  43. 2 Z- J# I; U0 D: J% [" d
  44. #ifdef EDMA3_DEBUG+ o4 }3 Q' n# y# R; ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 [7 T" Z9 a9 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) o9 e* U7 b8 F) _" ~2 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( {5 B/ D! b0 b2 o, X* v
  48. #else
    ( T( Y% U2 ~4 f3 X+ A
  49. #define DMA_PRINTK( x... )" `. m6 n: v' w7 u1 w, j
  50. #define DMA_FN_IN8 q( p9 F4 C' |+ _/ q+ m$ e: {
  51. #define DMA_FN_OUT, b7 h8 c: L/ N
  52. #endif
    & s" y  r& b. `
  53. / m/ b8 C6 a. G9 Q; Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 L/ b8 Y# u$ l6 O4 n. n; L$ i
  55. #define STATIC_SHIFT                3* }0 n* R9 h$ ~* k6 x
  56. #define TCINTEN_SHIFT               20
    % f# _6 A! u/ ~! F
  57. #define ITCINTEN_SHIFT              21% N8 b- E+ Z  b
  58. #define TCCHEN_SHIFT                22
    8 N8 l, J) o. f: T8 L  v; D
  59. #define ITCCHEN_SHIFT               23# o5 k8 K2 x; y

  60. 6 |* \: N0 g. o2 t: z( Y
  61. static volatile int irqraised1 = 0;1 }) A. V6 ]' C8 J; S$ v9 h
  62. static volatile int irqraised2 = 0;: Z3 p! a  ]5 ?2 H. h/ m& E

  63. 4 t1 H! z+ \+ R. \) n  ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i. K, q' E' z  T, M" T! T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , l' a( h# T, d* f3 T$ a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % |; M* ?1 `5 p9 j' \- \, J

  67. ; @! y$ K+ L# p
  68. dma_addr_t dmaphyssrc1 = 0;1 J# o1 n" R/ _% o" Q
  69. dma_addr_t dmaphyssrc2 = 0;
    # ~) k* t( x, f+ H% E
  70. dma_addr_t dmaphysdest1 = 0;: T+ o3 x" F3 k
  71. dma_addr_t dmaphysdest2 = 0;
    ( S' L2 O, x9 ]( l  G) w
  72. " j- A: Z+ u2 v! I& g3 z3 Q+ g
  73. char *dmabufsrc1 = NULL;
    " r6 j& R1 I8 n7 P( P% o5 J" L( H% J
  74. char *dmabufsrc2 = NULL;
    - j8 e- e( x* r+ N  L
  75. char *dmabufdest1 = NULL;5 [, s+ o) V+ d! Q% f7 B
  76. char *dmabufdest2 = NULL;
    6 V* ]. k1 U, s, i- ]
  77. & z2 G& D) a$ f0 ^/ i3 B" {4 ^
  78. static int acnt = 512;
    8 e. t& F2 I0 O9 C. h
  79. static int bcnt = 8;8 B5 @! K  m* a8 O
  80. static int ccnt = 8;9 e5 @+ g# j8 E! ?2 L
  81. 8 q: `5 x0 j* B# N0 Y1 C
  82. module_param(acnt, int, S_IRUGO);9 R' k; f' P! G# n) I
  83. module_param(bcnt, int, S_IRUGO);
    & L" E) x# L( X3 O( A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 a/ N2 I9 ?$ J# |$ x

* t" \) m3 G0 _/ q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 ]- Y3 P/ _/ y; V: \- Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ R& p) @3 L0 q5 p/ p  C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: o4 \5 g0 q  i5 Z8 I# }6 x9 k

2 u" ^" H9 i* J/ u  l
# h% P8 q+ v+ \+ L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 03:43 , Processed in 0.041077 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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