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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 _" E; q- O9 x; D' K8 Q
  1. [code]EDMA sample test application
      c4 C, V  K2 p
  2. /*
    $ T; @; m+ r9 T, h
  3. * edma_test.c
    4 r& ]& z! q1 G! }4 ]  V& Z5 }
  4. *
    - Q. q+ L" r! ~% D/ `( \4 F
  5. * brief  EDMA3 Test Application, T* w" I% p; y
  6. *
    # f( ?% o$ f4 F4 o5 B* d6 J- p
  7. *   This file contains EDMA3 Test code.
    : E& Y! t$ k( _# G' j; I) L  V6 K
  8. *
    $ h# N, o. U( `) p  Q7 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. e1 g  ^5 i4 K! z8 ^7 @5 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 g4 m5 R: `' x2 h+ b6 |
  11. *         TO CHANGE.
    + _: E7 T. @  Y8 H* U: l' v$ I' a
  12. *4 t2 j5 m, i4 ^, o- I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 I% b. S6 n4 o, f
  14. *5 l$ i0 Y* I; h: _9 W$ ^' a- j
  15. * This program is free software; you can redistribute it and/or. O" B/ h; A7 c: S7 F
  16. * modify it under the terms of the GNU General Public License as
    3 n; n4 N% y; O6 ]- W  z
  17. * published by the Free Software Foundation version 2.
    : Z8 q$ L3 l# b8 X
  18. *9 i: k* n. @' Q4 T$ k. L( p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & v; [% W  t$ D: X( ]* }7 K' u
  20. * kind, whether express or implied; without even the implied warranty
    ) O. _( `: J+ z, Z; A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( S  U4 R, G# C5 d
  22. * GNU General Public License for more details.. v4 Y* J6 n5 |+ c2 E8 s
  23. */
    : i" C( F. }9 p

  24. 3 h' U) r6 a" m5 K+ n& H* w
  25. #include <linux/module.h>" H( l0 T! s% w0 Z4 M% H/ ^. c6 S7 I+ j
  26. #include <linux/init.h>
    4 i: g, k1 S: o* h+ Q) @: x0 }* L7 `
  27. #include <linux/errno.h>0 X  \# f- w8 I
  28. #include <linux/types.h>: R3 o- b8 {- [3 C: K
  29. #include <linux/interrupt.h>' B1 V/ N+ y3 J8 y  [/ W
  30. #include <asm/io.h>- k* T) ]( c6 @' c) U
  31. #include <linux/moduleparam.h>
    & J3 [( o9 k# [! a9 }
  32. #include <linux/sysctl.h>
      z9 ^: r7 u7 ~# ?5 U. Y) t- r& R6 O; E
  33. #include <linux/mm.h>
    & v/ l) w7 @' H6 `: Z
  34. #include <linux/dma-mapping.h>
    " o. o5 L# Y1 I) h! T0 \

  35. ' ^' y; B9 c- J
  36. #include <mach/memory.h>3 {  _6 }2 y- V! Z# o/ M
  37. #include <mach/hardware.h>9 O/ G9 r! i; Q8 |5 G% H/ \
  38. #include <mach/irqs.h>
    / z7 X; `) C: x: q! y
  39. #include <asm/hardware/edma.h>
    ' L" J. H1 o1 d

  40. , ?  C- u6 `( e" a
  41. #undef EDMA3_DEBUG* s! r3 |  W$ N- @. E! T# `+ h
  42. /*#define EDMA3_DEBUG*/
    7 q# e5 r! b3 }) L8 x

  43. ; @& \  U  Q( P, y3 G; m2 j. l
  44. #ifdef EDMA3_DEBUG2 c* c8 W4 K3 `7 D" J7 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( f4 J7 m, @6 h  D8 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 F+ O4 L5 [8 b5 Y8 E+ m1 m) r# d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& O0 _$ l3 X4 ~  q3 F3 G
  48. #else3 z9 y$ I( ~' d6 y1 }- m1 w
  49. #define DMA_PRINTK( x... ). Y) ?3 T/ o7 q0 I8 S
  50. #define DMA_FN_IN4 x4 Q2 ]+ A, v' x# a* Z; \
  51. #define DMA_FN_OUT
    - s0 {4 Z& t* F5 |0 K" N- r
  52. #endif7 c( P1 H8 P; M; b% Q4 J) S; y/ H

  53. 4 E: U! q4 b. T* f8 X! K( J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 Y  h0 ^2 ~! ^- A5 \
  55. #define STATIC_SHIFT                3, ?0 m9 m* x' U, y. q9 D' b% u9 D
  56. #define TCINTEN_SHIFT               20
    . `$ R5 o( [* ?0 E
  57. #define ITCINTEN_SHIFT              216 O$ I$ U% p/ G3 J: |8 n  C
  58. #define TCCHEN_SHIFT                22: k* n5 |' S9 A2 C" e
  59. #define ITCCHEN_SHIFT               23
    + k4 C. P7 r  E  L

  60. ! V9 R4 \3 \- k; W" c
  61. static volatile int irqraised1 = 0;7 d, `( h2 @2 x. ~9 M: C; \
  62. static volatile int irqraised2 = 0;
    ( L' J& G4 t6 Q  p, P

  63. / Z% D2 P% h6 S/ E% O$ @- {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! B. @5 D' Y( f, I, j& f; l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ~  H8 K0 o; Z& y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% v7 w" M8 ?' W) G

  67. , p6 T* w! p8 @, S
  68. dma_addr_t dmaphyssrc1 = 0;
    & N! _+ ]* U8 A. U* `, p3 O! R
  69. dma_addr_t dmaphyssrc2 = 0;
    9 e/ X8 j8 F, s, Q2 O$ c
  70. dma_addr_t dmaphysdest1 = 0;
    , N! K3 t, f8 r, I
  71. dma_addr_t dmaphysdest2 = 0;
    % v5 C* t: B0 R4 R# \
  72. - `& ?8 y  \! A# P- x0 |$ S
  73. char *dmabufsrc1 = NULL;- {. ^8 L4 E  l) o% X- w* I7 V* G
  74. char *dmabufsrc2 = NULL;
    6 e6 N: R% v* b/ `# B% W7 F
  75. char *dmabufdest1 = NULL;
      t% g3 _/ e; R$ }* Y
  76. char *dmabufdest2 = NULL;" ~6 S, S6 Z; m+ a  f0 g. i
  77. * x; R6 d; c. I/ e: {8 u2 J1 x
  78. static int acnt = 512;. |- J6 W: O# R9 M- E
  79. static int bcnt = 8;
    + |( v* Z) A, D% b# h* ], c
  80. static int ccnt = 8;" @: ^% t7 \/ ?9 A
  81. , e. J8 Z1 v# u! C0 n; V0 A
  82. module_param(acnt, int, S_IRUGO);% h2 x  m! D( P0 r. V) z, O0 e
  83. module_param(bcnt, int, S_IRUGO);% c) ?& Z$ n! P: D- H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: Y  r3 I, F! X/ d, t( n0 z
" X; N: }2 W0 j' T: a7 h: K. u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! o& x. g- y7 O, S$ L: ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* t8 B# N. {: m0 b  X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  ?( E" b! H9 z4 {9 Y/ w
" A8 S7 N& T5 j" U2 N" V6 s" T5 D
. ^4 N- {& U1 ^3 H5 e( G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 00:08 , Processed in 0.040777 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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