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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n* M: l/ F: g6 r' `# O
  1. [code]EDMA sample test application
    # a0 J0 i6 I7 K5 s3 x- H
  2. /*
    5 ~$ |5 ~& T  Z7 U- b
  3. * edma_test.c& t7 I* c3 s- {4 ?/ v
  4. *7 c7 H. C& ~+ ~& s4 W2 I! b% v6 O
  5. * brief  EDMA3 Test Application5 ~% f  E) d1 H7 x; Y1 i) y, M
  6. *
    6 A" S4 e  n2 i0 M# |$ o/ R+ K
  7. *   This file contains EDMA3 Test code./ o- Y) r4 H1 a6 i) t4 W% t1 ^& _
  8. *
    ! ^& Q0 m: Q$ C) M1 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ I2 ~2 ~$ w8 m, k1 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ p% i- }6 i) t* X) N
  11. *         TO CHANGE.
    3 J1 B: c) B5 y8 t
  12. *3 _; M( C# ~5 \( L* U) L. E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 t$ M! {) e$ n: e. J0 g
  14. *( f' w/ _5 c: x/ j/ [
  15. * This program is free software; you can redistribute it and/or- `4 D3 Q8 k6 x) M* P: X3 |# w' a
  16. * modify it under the terms of the GNU General Public License as
    3 \; S) ]% E  X# h7 A8 t# Q3 f) v7 r
  17. * published by the Free Software Foundation version 2.
    ' W3 L! f: G3 W' ]# m% C
  18. *
    . F: t9 r. o7 r* u  _- |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: p! h9 k- `9 @
  20. * kind, whether express or implied; without even the implied warranty
    & w0 U+ x  `. j7 y8 l+ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  t1 a1 _; E8 ?( }
  22. * GNU General Public License for more details.
    ( B& D/ D; I; }( T9 H: z! g
  23. */
    " u9 ~+ @8 l7 d; [7 d

  24. - n, o0 M2 T; l" x" E! B
  25. #include <linux/module.h>
    & D3 r+ N# e6 `
  26. #include <linux/init.h>9 ~# O/ H+ }# `
  27. #include <linux/errno.h>9 t0 q, v- `2 l& x
  28. #include <linux/types.h>- P. D  Z) R4 l7 ~0 ~8 e8 o5 m/ u
  29. #include <linux/interrupt.h>! Y2 [; H4 `3 U
  30. #include <asm/io.h>
    " L) ?4 j; f" Y3 h% H0 L4 \
  31. #include <linux/moduleparam.h>( T& {. \4 p0 R, S* Z- u
  32. #include <linux/sysctl.h>
      D4 m& B1 g" R# t) W; T
  33. #include <linux/mm.h>! i, n9 j" @. q8 V
  34. #include <linux/dma-mapping.h>8 n& k' Y8 d1 b! }* `" u
  35. ' F# n7 S5 ~& c# m- _
  36. #include <mach/memory.h>8 z0 x+ I3 u/ o9 ]: d7 z5 y) `
  37. #include <mach/hardware.h>( w* a0 [, S; l( d6 O
  38. #include <mach/irqs.h># ^- [8 |( P$ ?, f& x3 l& b' n. R
  39. #include <asm/hardware/edma.h>
    9 D" N; v6 N$ t% \" C4 a$ \
  40. ( ^. U: v8 T/ S0 ^* F# C2 K
  41. #undef EDMA3_DEBUG
    9 ~2 S  D& p, o" R5 ~% g4 [
  42. /*#define EDMA3_DEBUG*/$ j& v% B2 ~  A! S
  43. ( @8 `3 l; [! V  r" W) C
  44. #ifdef EDMA3_DEBUG
    2 D) ?, j! `$ y. ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  B3 z  ~7 R- y$ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! x' I! ^% J2 n7 d8 H/ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( [: m9 N/ `) o- U3 x5 K  {' z
  48. #else
    + Z2 w3 l2 K6 v9 N% X  S. w
  49. #define DMA_PRINTK( x... )8 A5 @# Z2 b1 y1 j
  50. #define DMA_FN_IN
    9 }! S5 Q8 q! z$ c- a  L
  51. #define DMA_FN_OUT) p+ j2 ]4 ?. [/ K# K4 K" Y
  52. #endif
    . T+ e( L: k- n5 G0 }
  53. ) v- d* [, ?6 t. ~) {) ?) n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " ]; V( g. X# T: }" a( A, t
  55. #define STATIC_SHIFT                3' @  Q* o1 i8 c+ b2 g% Y! _8 l
  56. #define TCINTEN_SHIFT               20
    2 ]( C& `' Q8 E! N
  57. #define ITCINTEN_SHIFT              21/ L" O% X! Q; F  Y% F& K" a
  58. #define TCCHEN_SHIFT                22
    ! E  l4 T% X: s2 d; s& u% V  H2 e
  59. #define ITCCHEN_SHIFT               23
      U" n' E% z4 f) d

  60. 9 U+ |% u6 t$ @4 I6 e! P6 J
  61. static volatile int irqraised1 = 0;
    , Z0 s3 F! a6 l4 \, O+ R8 _$ S2 Q
  62. static volatile int irqraised2 = 0;* a; ^  A$ u1 k7 B9 }* i

  63. ' H* r% W! Z2 n/ i- u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , S8 g0 r  u! u) I. j3 Z. z) \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & m0 r% R; a1 C1 N6 k$ E: F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^! X& \- ~# N; A9 a! W. _& W
  67. 6 s! L) z& K" N( n
  68. dma_addr_t dmaphyssrc1 = 0;
    , ?7 {# \' M1 m* r
  69. dma_addr_t dmaphyssrc2 = 0;
    + B% y5 S6 r2 A, z
  70. dma_addr_t dmaphysdest1 = 0;
    " i( K7 g  m2 o: d4 _  |3 L$ ^$ Q9 }# k/ x
  71. dma_addr_t dmaphysdest2 = 0;) `$ |; |' v4 B9 i+ C( b9 U
  72. " H) j5 O  C6 u' S$ t# ]
  73. char *dmabufsrc1 = NULL;, M3 v& ]' R( h, n% Y4 \
  74. char *dmabufsrc2 = NULL;
    7 V9 ]" u8 z1 k9 p0 C! G6 l" [
  75. char *dmabufdest1 = NULL;
    & y: X$ M" ^, X
  76. char *dmabufdest2 = NULL;7 w! u0 f( F/ z6 @6 g
  77. " z' a4 l; J8 c  |+ G
  78. static int acnt = 512;# o: `  Z5 m( D
  79. static int bcnt = 8;) e/ ?5 N( @/ A3 p
  80. static int ccnt = 8;
    9 [7 K+ w( I) R7 s% e$ U4 p

  81. 9 t) o9 o4 Y- \; [( m  C' d9 ?! ^
  82. module_param(acnt, int, S_IRUGO);
    4 c- j6 q% g2 m. b6 @
  83. module_param(bcnt, int, S_IRUGO);3 @1 v9 A( H; z# z& n: D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, X2 \  c9 l1 R  C

7 Q9 j9 N4 c8 K* M5 [! ^- n: P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& ]& n" d2 \" [- }. f8 |( r! R5 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: X% F8 G) V% V' J: U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# }9 ^, f( d( R# ]: W
8 \2 g6 s. g; h! i! d, b, S5 ]5 w% Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 00:15 , Processed in 0.039260 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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