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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 U7 c2 y' _$ ~# k7 h0 ^
  1. [code]EDMA sample test application
    * e3 y4 b/ B3 o$ Q- e
  2. /*
    ( l1 A2 d0 ]2 L" n1 ~5 L0 P
  3. * edma_test.c) r9 f+ V# Y& r, c3 b: C
  4. *3 I; _2 J" S1 H) k2 T
  5. * brief  EDMA3 Test Application
    + t+ w- K2 E' ?- P0 v: }
  6. *$ b* J: B  {3 U/ m, b
  7. *   This file contains EDMA3 Test code.
    ) ~* T$ K7 n3 v
  8. *
    . _% o* Z. v5 `' Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& C! V/ g6 J: j) x# m8 K4 ]" p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 K3 a4 x' L, T4 k
  11. *         TO CHANGE." w* A* {8 A+ ]/ ]: k" T5 b6 J
  12. *9 H: z( Y; @% v# u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 r+ S$ P6 b$ }5 C
  14. *
    " m! y% O: u/ F7 a: s8 \8 [. C
  15. * This program is free software; you can redistribute it and/or, q7 o, V8 z" T; O
  16. * modify it under the terms of the GNU General Public License as+ r! P( [$ Z4 {9 Q! P# r1 J
  17. * published by the Free Software Foundation version 2.
    + P! a$ b+ N* U# J1 g" K, y( D
  18. *
    1 U) J& ~# N7 \1 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. k# j6 |5 q7 q, N/ A
  20. * kind, whether express or implied; without even the implied warranty+ H5 v5 {4 ^( b( E" y- x8 U2 f4 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- g; c  i+ B+ j, `+ w8 l2 x
  22. * GNU General Public License for more details.7 m( {( {9 [! G9 i% u
  23. */
    # s* A/ f, r+ K/ x! {
  24. 7 \. g8 P- F- J9 \$ O( `
  25. #include <linux/module.h>
    , X# O( a0 ~2 i1 N( x! C1 I
  26. #include <linux/init.h>
    ' o: O' p* U! t1 f) ~2 z
  27. #include <linux/errno.h>0 A' H4 N6 Y" m9 F
  28. #include <linux/types.h>$ b) \/ x* ^9 u7 L1 V
  29. #include <linux/interrupt.h># S+ v; v$ \2 O1 M3 \3 c8 l
  30. #include <asm/io.h>
    6 x/ A( W* Y: F" q3 L" h9 d
  31. #include <linux/moduleparam.h>
    ) B. Y; F- o- O* x9 G4 t- W4 R5 g/ Q! ~: m
  32. #include <linux/sysctl.h>$ [; O% `9 {: g1 @
  33. #include <linux/mm.h>7 M0 m! g+ D/ k* ~
  34. #include <linux/dma-mapping.h>
      n( L% x; o! X' k, J
  35. 4 y" a0 p6 f& N2 }0 s
  36. #include <mach/memory.h>/ p& E7 M# ?8 u3 e
  37. #include <mach/hardware.h>1 z+ n' V+ Q7 C5 q* @
  38. #include <mach/irqs.h>
    . T3 S+ X: d( s! F7 f5 o
  39. #include <asm/hardware/edma.h>
    & L& e# W& q0 K& r" m6 T0 O  H

  40. & [" A* a- w4 X. o# ^# @" n
  41. #undef EDMA3_DEBUG9 A) W9 a, l0 q
  42. /*#define EDMA3_DEBUG*/
    6 g9 u/ U  D5 O5 V" j

  43.   T  z0 B3 ~3 Q9 T
  44. #ifdef EDMA3_DEBUG
    , q+ \4 s& ~- M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' v0 x$ q% F) f  Y1 w2 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + n4 ]) X# E& ~  Q  C5 w4 f- R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : S; A1 l8 |& J! o+ N: J5 l
  48. #else1 f! R! D+ S& F) p/ o
  49. #define DMA_PRINTK( x... ), a9 M% P0 a  q4 D, @! P: s1 `
  50. #define DMA_FN_IN! Y  _5 M+ Y! {+ e! E) I7 k
  51. #define DMA_FN_OUT
      I: ?( |5 K% C9 W# d
  52. #endif. I( V/ {; l" I+ W+ w

  53. % J& `* |( p" U5 Y# F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). ^( u2 `9 |0 n8 \; a# ^
  55. #define STATIC_SHIFT                3
    / ~( s8 T2 g8 ~9 }5 f8 B# y0 t2 e) U2 c
  56. #define TCINTEN_SHIFT               20' P1 A1 P$ y. x7 D0 T* S
  57. #define ITCINTEN_SHIFT              215 B+ B0 `. @8 Z$ ^/ t, K& n+ j
  58. #define TCCHEN_SHIFT                22
    # v/ w5 @5 o" v& G( c
  59. #define ITCCHEN_SHIFT               23
    , i. X% o4 c6 @$ V. k$ S$ ^
  60. , p3 X6 G0 R/ O8 C! n2 c+ G2 p" U
  61. static volatile int irqraised1 = 0;$ U7 W+ O2 m- V/ ]( G6 @
  62. static volatile int irqraised2 = 0;) n1 V0 @: ^  C- ~) ^3 X, V

  63. 5 P) r( F2 x" U5 k; x5 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & {8 a( {8 i( u4 Q1 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 P7 H6 G3 F; z4 O$ L9 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ~: p* J. c# F. x/ p9 i
  67. ' u9 {' l6 |& @7 m% @3 g  m/ m
  68. dma_addr_t dmaphyssrc1 = 0;5 G& W3 M4 L) T! f' e
  69. dma_addr_t dmaphyssrc2 = 0;
    ( w: A# z. p+ S3 S( @
  70. dma_addr_t dmaphysdest1 = 0;
    + R0 f  r$ Y% ?8 d
  71. dma_addr_t dmaphysdest2 = 0;
    ! T* d( _; h5 A& u, g7 C$ W6 Q  s
  72. ' b# K" A& n) l0 Y+ b
  73. char *dmabufsrc1 = NULL;$ X  v8 e* f8 r& c( z3 Z6 h* g
  74. char *dmabufsrc2 = NULL;. j  [9 x4 |' G; a, _$ x& n
  75. char *dmabufdest1 = NULL;+ P( ?) y/ E6 u& N
  76. char *dmabufdest2 = NULL;
    ! @0 @# z: ~0 B5 t" y- \6 J
  77. * W7 F. y. t' J) H) B$ ~0 V7 {
  78. static int acnt = 512;
    # z+ Q" v! n. }' Y; Q
  79. static int bcnt = 8;
    2 i% R: u' ~# o0 f& p4 v% s( m5 w
  80. static int ccnt = 8;
    , z' t  t; @' t) c" u7 b

  81. ' \/ t2 @9 W' K2 @# k
  82. module_param(acnt, int, S_IRUGO);9 D, {. N0 T: Y2 t. @, C( D; ?
  83. module_param(bcnt, int, S_IRUGO);! [2 i" o8 r% A, ^: z2 u# z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ s3 }: N6 V/ E: B4 m* l4 x* \2 E  z7 N) P7 N* ?3 O% n$ X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 D) `+ a1 Y2 C3 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 p5 v. @' ~1 ^9 p! ^. |; H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: A/ U  v2 U1 t8 y
8 d5 p7 _- C- d! W8 X
0 d' i( g( c5 h. n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 04:03 , Processed in 0.037139 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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