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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  U' I3 _; m! n
  1. [code]EDMA sample test application, g8 E1 u4 ~3 T
  2. /*
    $ [( N3 q+ I' s1 k' L( V2 v
  3. * edma_test.c
    ) c- N. n6 O$ K. V9 w/ c
  4. *  T, ~# N7 @/ T# U$ E" @
  5. * brief  EDMA3 Test Application2 y' v' M" T, P; ?. Q: t
  6. *
    ' u# P5 X" @" {8 j) f
  7. *   This file contains EDMA3 Test code.! g9 J, K8 Z- |* ^9 {
  8. *
    . _$ R! B, V. }0 n) j6 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % w- f! D. l6 O9 ]' @' ]9 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. j1 r1 t; I5 G" U! W. F* t0 i8 f
  11. *         TO CHANGE." _& T- n6 o1 a$ c" A) |& v
  12. ** F! c' u+ f' Z2 v- G( H" d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 M4 T- S0 D# \; \+ h
  14. *7 \$ t+ ?9 H# G  I9 o4 u0 u
  15. * This program is free software; you can redistribute it and/or$ P' N* P+ @0 A' {! j' |
  16. * modify it under the terms of the GNU General Public License as& O% h0 R1 _" S
  17. * published by the Free Software Foundation version 2.
    0 Q! f1 [' |8 g6 z
  18. *
    , J4 a( B1 B! C6 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 x* t, o; H# G4 T- i. `( u  d% F
  20. * kind, whether express or implied; without even the implied warranty1 F7 A. z0 p8 W& U) U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 Q2 a- m" c' U. Q& C# K
  22. * GNU General Public License for more details.) c& d. t( f" ]  ^
  23. */. x4 c- n$ O6 U3 b: N6 |! m0 H
  24. # @2 W3 \. a- u# R$ p
  25. #include <linux/module.h>
    3 ]  C+ W/ L3 e. Y0 m/ m0 e
  26. #include <linux/init.h>) e6 P6 K3 _6 c- s) Z( R
  27. #include <linux/errno.h>* T; }& J3 G- p) c" P5 p3 V# O
  28. #include <linux/types.h>
    + o  e2 T5 W. X& U5 H0 K0 c8 s
  29. #include <linux/interrupt.h>! {8 W& v0 o* [8 x: n0 \, [
  30. #include <asm/io.h>
    $ m0 H1 r# n7 w7 h0 A
  31. #include <linux/moduleparam.h>4 R& ?- U( u) u. z/ ]0 g* `
  32. #include <linux/sysctl.h>
    1 a! y: B0 S: m, c/ ^. L8 i$ I
  33. #include <linux/mm.h>% s( b9 a4 o1 T+ d! X! l
  34. #include <linux/dma-mapping.h>
    ! X0 M( ]: a2 c+ w2 r3 w5 F3 D) R
  35. 4 o5 p5 ]1 T1 u5 n: l7 y  o
  36. #include <mach/memory.h># n' D, I) z* v$ k6 L/ I- f0 G
  37. #include <mach/hardware.h>. G7 p% X. x/ q4 h
  38. #include <mach/irqs.h>! Z, v& d3 `: R8 u- P
  39. #include <asm/hardware/edma.h>
    + V. h: o8 k9 z4 R- o) p: I5 P
  40. & _% @2 e3 B# P& V7 K
  41. #undef EDMA3_DEBUG" B( X3 w8 a  x8 m( R
  42. /*#define EDMA3_DEBUG*/: ]6 d5 ~$ Y( q8 y

  43. $ k3 W9 A" ?$ q) N. _3 T
  44. #ifdef EDMA3_DEBUG
    ) f; {) z. Y4 i; [7 E: M7 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) Y7 u2 ~  Q/ P9 N2 f3 J' O' x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 r2 p7 E& `, X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 Y+ U( W. B0 M5 ^
  48. #else1 I9 Z! L  e- L, A. |3 j
  49. #define DMA_PRINTK( x... )
    6 p. e: L7 Y" ?& _8 u. g/ o7 U1 q
  50. #define DMA_FN_IN
    0 l* Q% j" [  |# @
  51. #define DMA_FN_OUT
    + h& O$ x* `+ p5 B9 a
  52. #endif' }% o' d! u3 e$ A# q
  53. 0 g3 F& p  D# A8 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * w. S2 ?: _1 t1 W6 `0 K% f
  55. #define STATIC_SHIFT                3
    3 I9 Q+ W& ]( [2 k- v
  56. #define TCINTEN_SHIFT               208 b$ U3 M# @5 `2 [; K3 e
  57. #define ITCINTEN_SHIFT              211 {5 a6 U# M7 F, W0 A, Y
  58. #define TCCHEN_SHIFT                22
    2 ~/ F, N' B! H9 K3 f/ ]
  59. #define ITCCHEN_SHIFT               23: i% F( z. W+ Z
  60. % w* H7 B* s) [/ D+ h3 s
  61. static volatile int irqraised1 = 0;
    5 [* B/ [+ Y, S: p
  62. static volatile int irqraised2 = 0;( d6 f/ [+ _* q6 r) ]2 b, m: ]% R" i

  63. % R) t- @$ D$ b, e  |5 z: P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % h4 O( y, }; r* o8 i+ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n) Q1 o1 V5 r# |# z7 f# O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * \. M5 ]9 H4 w( O
  67. 4 `' f( S  B" T+ J7 L" F" e$ @5 z5 C
  68. dma_addr_t dmaphyssrc1 = 0;0 e/ M' }' ?' G4 ~% r
  69. dma_addr_t dmaphyssrc2 = 0;
    ( }3 E' j8 b* U
  70. dma_addr_t dmaphysdest1 = 0;
    # ?% d% _: |' H' w/ b
  71. dma_addr_t dmaphysdest2 = 0;
    8 O7 P% P( e" t+ u* X& f1 E9 ^/ L
  72. ; n* ^, s  ^1 `
  73. char *dmabufsrc1 = NULL;+ Z; ^8 g8 J3 A2 F8 F% o: F
  74. char *dmabufsrc2 = NULL;7 q( H4 Q" a/ b7 G) Y# f4 H
  75. char *dmabufdest1 = NULL;: m' J" Y8 o: G' L
  76. char *dmabufdest2 = NULL;
    / e# w7 u" x3 h8 W6 {8 o! ?
  77. $ j! X7 C' i9 y2 D$ J
  78. static int acnt = 512;5 V4 W6 H9 M/ o9 Q
  79. static int bcnt = 8;3 C; r7 k7 P  x3 t( G0 [" Q4 Q( e
  80. static int ccnt = 8;+ L% q; @. [& S' |! H$ H
  81. 1 ~3 s* i( P9 H" F: g
  82. module_param(acnt, int, S_IRUGO);7 U( u$ {8 X7 f" R, ?
  83. module_param(bcnt, int, S_IRUGO);
    4 ~: |7 g5 R/ B' \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 m# H0 [# y. b0 ?
+ F  t5 H" ]( v2 j& u( u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! W6 P7 H& k% J0 Q" J9 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 F3 R. L1 p7 |1 M! O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 J. h6 p3 ^, `+ d% ~/ l  n8 K' d
9 g# p0 ?1 T' b& t* T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 23:52 , Processed in 0.037036 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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