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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' l* [4 L/ n8 ^' t& j( o
  1. [code]EDMA sample test application* e8 K: p: t0 `: {
  2. /*; u+ p  i3 J6 }( @1 h
  3. * edma_test.c" Y' J) t/ N! t9 u7 i& T
  4. *2 D" V+ g( R2 U) q( n. Q
  5. * brief  EDMA3 Test Application
    9 `: z9 d+ }7 k  e+ P1 C7 G
  6. *
    - v) Y1 q3 d- Z3 t' B
  7. *   This file contains EDMA3 Test code.' Z( M$ H3 H" H8 x& I
  8. *" M" o! v: _2 r. J" X7 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 z3 D8 I7 X1 p5 }% E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. y8 c( H& p: T! v! D+ G, i. _- Q: q
  11. *         TO CHANGE.
    7 e6 a! r( Q) _7 `* ~
  12. *
    2 \+ \- b: T) R, Y7 y" ?$ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! `- r# `3 w9 `6 X, X  t
  14. *
    ; v( U2 M& \) H' J1 s
  15. * This program is free software; you can redistribute it and/or
    2 u+ M  a' Y& w6 g( r! j9 g
  16. * modify it under the terms of the GNU General Public License as
    5 s+ C$ B& |1 ^. q  D' V* S
  17. * published by the Free Software Foundation version 2.
    , f& z' R1 g9 ~6 o0 q/ u
  18. *
    & X. C: E$ W5 c8 O# b1 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! J' q/ E' O6 W9 v. I% B8 x
  20. * kind, whether express or implied; without even the implied warranty. \& ^8 ?0 n& s+ ]" y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( ?5 N! a4 L$ T5 b, i7 j
  22. * GNU General Public License for more details./ [9 v1 B8 j* w2 V% N9 p8 f8 E
  23. */2 t2 a! x# H. u. v# {

  24. . X6 k" y' f. ~9 F
  25. #include <linux/module.h>) e& n+ _) w3 M# ~2 ?3 z7 ^; k
  26. #include <linux/init.h>
    : M3 ^+ T" M. ^' {
  27. #include <linux/errno.h>
    ) F1 D  Z- K& G" Z
  28. #include <linux/types.h>  d8 J1 x+ H3 e+ N/ l' h; v* w" h
  29. #include <linux/interrupt.h>) R$ H, D- F; x5 a6 |
  30. #include <asm/io.h>! q* i$ F9 h4 a1 y% g8 m
  31. #include <linux/moduleparam.h>9 k* ~3 b$ u1 U8 _
  32. #include <linux/sysctl.h>
      K  f+ \  r+ J  Z1 ?# Y
  33. #include <linux/mm.h>
    % f5 w7 C  a, X. X& L
  34. #include <linux/dma-mapping.h>
    # b6 `4 }5 A% c( N0 y* o

  35. 2 J" i  M2 x, C2 Y3 ]
  36. #include <mach/memory.h>
    ) F9 @4 }+ E0 Q& r9 E8 y
  37. #include <mach/hardware.h>
    7 |7 V( e. @9 H+ `4 W
  38. #include <mach/irqs.h>8 `$ K2 a' j' z; p7 P9 J/ K
  39. #include <asm/hardware/edma.h>
    ( l: X% U1 x& R$ ^+ {2 E* I" f! Y# b% [

  40. 3 a8 r$ B2 i* I0 c
  41. #undef EDMA3_DEBUG7 {( B; Z; _7 ~, v: {
  42. /*#define EDMA3_DEBUG*/+ b7 R$ c+ p/ f
  43. 0 o$ E5 C9 `- ~7 l' r8 }
  44. #ifdef EDMA3_DEBUG
    * a9 P) P+ ]& w* c/ |5 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 g* l) r6 ^* X: W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); {. E% J3 H2 {- R- x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 H, [( o' C$ J: G5 W# n, C' I
  48. #else
    8 I6 n" C4 u, A' _( k
  49. #define DMA_PRINTK( x... )
    , P9 Y7 G# L* Y( I; E7 U
  50. #define DMA_FN_IN
    8 E) N) Q$ E* h8 u6 _- E
  51. #define DMA_FN_OUT, V$ w) T( V: h- I# Y
  52. #endif
    , O( `3 |' ^; K$ x- V- T% a
  53. * j) C/ G1 O: A. J8 y0 \+ w1 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      \3 B( G0 B, U9 a
  55. #define STATIC_SHIFT                3
    ( d' J! k4 ^# z$ k2 L
  56. #define TCINTEN_SHIFT               20
    ) i- V! u* s1 S# p0 n
  57. #define ITCINTEN_SHIFT              219 {; W% ?! R% x& D' G0 k8 K* c  _
  58. #define TCCHEN_SHIFT                22* a. P2 Z  g8 `( D
  59. #define ITCCHEN_SHIFT               23
    2 g7 C( ]* Z& Q$ D

  60. ' Q( O3 }% Y8 w' F$ _6 O# m" M
  61. static volatile int irqraised1 = 0;$ C! b4 ~; R1 F1 L6 f" Y8 w
  62. static volatile int irqraised2 = 0;# E0 ]0 ^; h( \) g

  63. # I' F* m# S. f% m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W1 J7 P- h8 ?7 o7 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 J4 k1 n3 l8 h; c* b1 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 t# L# V0 L' c( \, ]3 v- [
  67. % V2 f% S9 v) X' [/ j
  68. dma_addr_t dmaphyssrc1 = 0;( ]- R. {" }/ w
  69. dma_addr_t dmaphyssrc2 = 0;: t3 b3 i( D. K+ x) j# l
  70. dma_addr_t dmaphysdest1 = 0;' E5 i. x+ ?& x+ y/ `
  71. dma_addr_t dmaphysdest2 = 0;) M2 T# N6 \( w) i1 ~

  72. 3 d& y& ]5 U9 i0 _
  73. char *dmabufsrc1 = NULL;
    2 W% L; K. I# W6 t
  74. char *dmabufsrc2 = NULL;
    ( M% e$ ~1 _1 j6 C
  75. char *dmabufdest1 = NULL;$ ~8 ~& y! j- `5 u' a7 W
  76. char *dmabufdest2 = NULL;1 M& b- {! o) R) R, b
  77. 6 z- _% l7 a+ U/ m1 s
  78. static int acnt = 512;
    4 ]8 T6 f( j, d7 K. e: O# u
  79. static int bcnt = 8;8 L* S( l4 U& A
  80. static int ccnt = 8;6 H  ]  a! O% E# \. T, _

  81. 5 R. ?* Q: ?# g  B- @1 v- ~
  82. module_param(acnt, int, S_IRUGO);
    % l- Q, @; a. B/ ]" y( @+ d7 Y
  83. module_param(bcnt, int, S_IRUGO);
    $ G3 \0 E: u3 c3 c7 ]9 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; W) J) ^  j5 [( P, V$ k
+ @/ H5 s. |3 w' k* @. S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# R2 G  ]7 `! w2 u- U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: c- a3 z/ H: J9 t2 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; n2 K- d! f# f' S/ a1 R4 g) O) M4 d/ L) w" U. R
9 U/ K' s4 t) P4 g1 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 21:47 , Processed in 0.039434 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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