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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" m& I# U8 A# q# R; [' a
  1. [code]EDMA sample test application: ^- v# V2 ?7 u
  2. /*8 S- Q4 I7 g. _7 E
  3. * edma_test.c
    % I, Y( Q( E( z! j& q
  4. *" b) D* a- i4 p; N$ T
  5. * brief  EDMA3 Test Application
    % h/ k7 O7 x2 ?7 K+ L! e* R
  6. *
    5 L$ M6 A, _( R' ^+ l2 J6 Z
  7. *   This file contains EDMA3 Test code.
    , o4 B1 R5 I8 v7 S" H
  8. *
    ' W0 i# ~/ E5 n  U5 r1 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) r9 C! X1 L" u' T1 L! n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 e; J& A! S, g( {5 h$ E
  11. *         TO CHANGE.! X) X, \: {  G/ W  r
  12. *, b1 E+ z4 Z* o3 n9 K: V" b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) g" G+ t1 A7 u- Q3 _% b4 X
  14. *& }& |: D. w* X! t+ }& H
  15. * This program is free software; you can redistribute it and/or$ F" o2 S8 J) w- M. Z
  16. * modify it under the terms of the GNU General Public License as: f4 a2 P. ?% W6 |% E
  17. * published by the Free Software Foundation version 2.; c# |  d" i* _" h8 I
  18. *
    3 r8 x& t" y- d0 x3 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( g. M; M5 W* t: G  w7 ~) ^" ^5 F
  20. * kind, whether express or implied; without even the implied warranty
    # N" l. v* l6 O( Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * _0 t: I, n- H+ u
  22. * GNU General Public License for more details.
    & Q$ @. Z) L% c: h% p& T! G
  23. */
    & r  ^3 T  }. @4 t) ~- C, `
  24. * T3 N/ H, q, U( N& C, [
  25. #include <linux/module.h>  K: F' }* N) _0 \3 a
  26. #include <linux/init.h>
    - u; W4 {( G' j1 q  `/ B7 l. v
  27. #include <linux/errno.h>
    * B/ c+ e( j. G: k7 |
  28. #include <linux/types.h>
    - ~+ [3 H2 A, O6 b/ i" ?( m
  29. #include <linux/interrupt.h>
    " z$ ~, ^0 ^5 M2 }
  30. #include <asm/io.h>
    ) U2 t8 a1 `* w$ E1 z
  31. #include <linux/moduleparam.h>
    1 K8 H% z6 |, U, ^6 N1 u
  32. #include <linux/sysctl.h>
    5 }/ }; b1 w4 X: Z6 o7 d& O/ Y
  33. #include <linux/mm.h>* N2 s; g7 H: @* ]9 U
  34. #include <linux/dma-mapping.h>9 y" H: o+ x) r) \1 Z: u, }
  35. 7 X" O' z% ]. S1 x  D7 d
  36. #include <mach/memory.h>
    7 B# `. q; c0 k% M
  37. #include <mach/hardware.h>
    7 }3 Y7 i- ~( d7 B
  38. #include <mach/irqs.h>
    - ?& v! E- Q6 G% K: z
  39. #include <asm/hardware/edma.h>1 S4 I/ ]6 ?' ^) i4 r
  40. 2 P! a% g) L  E" E/ J) C; B
  41. #undef EDMA3_DEBUG! ^6 S8 M# Z' m- O5 O1 Z
  42. /*#define EDMA3_DEBUG*/
    : G" }! c1 L9 E* E2 {9 f

  43. % X& d' N( [4 @0 O5 G
  44. #ifdef EDMA3_DEBUG. M7 q. k2 s8 b/ T" L8 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 }% A2 w$ O) C0 X" R  o- P3 |7 b3 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). m2 @( [! z1 i' H1 G& @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i3 g3 D  g2 B) j. v+ u
  48. #else: n+ W9 F1 f0 V9 \
  49. #define DMA_PRINTK( x... )9 f2 @1 h+ q! k. E* l5 t
  50. #define DMA_FN_IN) `& ]+ y! @6 S
  51. #define DMA_FN_OUT1 E: \; W* r6 o( _, ]/ A
  52. #endif
    6 B. F" l- M( d9 ?$ {

  53. 3 x% |7 ]4 w, H9 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : w+ k% u' q) j" A2 P% D. X+ K; T
  55. #define STATIC_SHIFT                3% r+ J; W. w; E4 c2 P4 \- l
  56. #define TCINTEN_SHIFT               20/ h1 ?: y0 |' B5 l+ @( l( q! U: B! F
  57. #define ITCINTEN_SHIFT              210 v9 Q/ h. ^% [& T' b/ Q
  58. #define TCCHEN_SHIFT                229 `# n( I# G6 {, r
  59. #define ITCCHEN_SHIFT               230 U( j  z" z& d  a3 ?
  60. ' W5 D; L) l7 u% y7 t! G
  61. static volatile int irqraised1 = 0;1 h" I8 D$ V5 M2 K( Y
  62. static volatile int irqraised2 = 0;
    9 l2 \: s+ h0 |$ N, R; Z, L
  63. ) m0 ~  e, |) ^% q2 l+ N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v% y5 l% T+ m- r. k, ^" ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! k7 U; I, _5 r) b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^8 a: T& @, A

  67. ( r& W7 P( a, [" n2 W  g7 N
  68. dma_addr_t dmaphyssrc1 = 0;1 j4 R; _( L) d8 S
  69. dma_addr_t dmaphyssrc2 = 0;
    # o% s% B+ q. f( j
  70. dma_addr_t dmaphysdest1 = 0;; k5 t% h- I5 E$ L2 J, s! W  I! _
  71. dma_addr_t dmaphysdest2 = 0;
      ^, I4 ?7 M2 E- H

  72. $ f# k8 q) q, @: }) e6 O- I- N# W
  73. char *dmabufsrc1 = NULL;
    1 O2 l( W0 p# A. E5 {% L% k6 A
  74. char *dmabufsrc2 = NULL;
    ( r+ ]7 @, C! r3 c5 \
  75. char *dmabufdest1 = NULL;1 t! V: A' i$ i6 Y! A
  76. char *dmabufdest2 = NULL;
    5 ]/ }* D% B- D, u# [# L

  77. ) m: e* G9 G3 W$ c7 J, A! H
  78. static int acnt = 512;7 R8 q7 l  L% s" Q5 h
  79. static int bcnt = 8;+ u1 M! |4 l/ c0 n7 I& N
  80. static int ccnt = 8;0 V$ Q6 r' @5 T; K1 s
  81. : O2 j; v+ i* }3 _5 b
  82. module_param(acnt, int, S_IRUGO);
    % }4 @9 A) D4 {: }2 @
  83. module_param(bcnt, int, S_IRUGO);" {& v: t5 Q) O9 }+ I3 B- D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: Y5 c8 D5 e* E9 |
4 [9 U2 f% d/ p/ D5 T- N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% o9 U  ?% i$ q; _. E( f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ q! Y0 ]/ |' J4 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ~- x% l1 x6 L) T+ x

- X* q) s7 L( v; j  F. o
9 q* G1 i: N/ B" l& c1 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 17:45 , Processed in 0.040810 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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