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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V( p: L% c7 w, I  m
  1. [code]EDMA sample test application2 s1 E! Q9 i: T: Z, h( h' R- ?) F
  2. /*
    - O* B( k; I% w; j
  3. * edma_test.c
    : x2 ^, v1 R' C) \9 G2 ?
  4. *: F+ S0 J% o$ D' J
  5. * brief  EDMA3 Test Application5 F+ i2 H- j+ a
  6. *) Q* F3 R) W) Q6 {  ?3 @/ D7 B
  7. *   This file contains EDMA3 Test code.: y) x1 v' q* T- K- d
  8. *
    * U$ E& g8 q. i3 U  B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' m5 ]$ o* e$ x7 U, p8 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & O  w, t9 T/ n/ O) u
  11. *         TO CHANGE.' t7 Z/ |" M; l* V/ A
  12. *
    5 {* N8 Y' O, j+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! t8 P1 E' X5 _6 }# {' D
  14. *
    ; B) }) W6 \$ n, {0 r
  15. * This program is free software; you can redistribute it and/or- c5 G8 S$ Z: t7 s& ?
  16. * modify it under the terms of the GNU General Public License as6 R6 `3 [. M5 j( w
  17. * published by the Free Software Foundation version 2.* W/ k3 ^( J4 @1 V. }
  18. *3 \/ g. N2 G7 u% j# [# S7 i9 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . ?+ `% W8 x8 G
  20. * kind, whether express or implied; without even the implied warranty% V3 w4 N5 S! N  M- x- Y# @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 B2 e, K" ?5 x' }& H+ X; E
  22. * GNU General Public License for more details.9 m( L! U1 d, F- `. R
  23. */8 _! Y! V2 H# G% I* S
  24. ' u# j; k3 D# G% H  m$ x
  25. #include <linux/module.h>) j3 a( }# I) _1 L9 e
  26. #include <linux/init.h>
    % U. |6 d5 X+ P$ c/ _" Y) c
  27. #include <linux/errno.h>
    " r  U/ y2 T' Z6 L( w
  28. #include <linux/types.h>6 M+ D+ t" k% \/ k' v3 K) f# u
  29. #include <linux/interrupt.h>( F, E* d3 ^. C" l- `5 M
  30. #include <asm/io.h>" \2 P1 L# b' ^  j9 d! {7 Y% H
  31. #include <linux/moduleparam.h>
    6 c! M4 R9 @* d+ j$ |2 c) c  o
  32. #include <linux/sysctl.h>9 G- d0 }" m5 {* F$ U
  33. #include <linux/mm.h>8 @5 Z" ?* U5 z1 g! j8 F
  34. #include <linux/dma-mapping.h>
    8 c( l( v6 @4 i) ^( B: g* B6 G9 o% v
  35. 0 f; W% `4 B& R9 I
  36. #include <mach/memory.h>
    , u0 ~/ [# a- g; N
  37. #include <mach/hardware.h>
    / N. {, P5 ^1 P# |- Z
  38. #include <mach/irqs.h>5 l: S# |! z9 G) ~7 F4 s$ y
  39. #include <asm/hardware/edma.h># n, S0 I: h  o0 H. G: Y! @

  40. ' M: h* q! f( B7 s3 z9 o8 f
  41. #undef EDMA3_DEBUG
    6 O9 i+ N0 L3 p& O
  42. /*#define EDMA3_DEBUG*/) U: e! ~) g  \  L2 b  s" a0 D
  43. & r( O7 E9 O4 F. D
  44. #ifdef EDMA3_DEBUG
    2 B% O. Z4 F0 y4 y6 w5 u5 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! d0 ]8 o+ K3 w' c# }# s1 e0 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Q, r5 _' L) B6 O- q5 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( I: l0 L0 `6 x7 c5 S, ]. v
  48. #else" h8 t7 t3 @- f
  49. #define DMA_PRINTK( x... )8 L5 }3 M$ `8 V+ R; c9 C0 B$ h
  50. #define DMA_FN_IN1 ~  p$ q  Q5 o1 K% {; e
  51. #define DMA_FN_OUT
    ! G) T8 k7 U0 M/ x2 y
  52. #endif
    1 x! N. o; X; H1 G) I% R

  53. 8 o0 f2 I5 S$ C: ~6 n& V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' _* p3 }+ G; |
  55. #define STATIC_SHIFT                32 R* r; i, }0 s+ L! |8 i5 j3 k
  56. #define TCINTEN_SHIFT               202 U$ t  I+ t6 }# n/ L3 ~
  57. #define ITCINTEN_SHIFT              21; O; M) \) m7 `, Y+ p) e& n
  58. #define TCCHEN_SHIFT                22
    : d. s1 E0 k0 f5 |  {
  59. #define ITCCHEN_SHIFT               23
    ; p! m- I3 U- ]7 I& y8 a/ _  P
  60. ' G; F" M1 l- n. ~+ y% ^5 P" _
  61. static volatile int irqraised1 = 0;
      W$ F3 T4 a* b* f' l2 `6 k
  62. static volatile int irqraised2 = 0;
    1 t$ ?* c0 p2 s3 u% _9 E

  63. , r' d* a4 G* S3 t* N. K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z/ T5 F, R5 {' n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: J  w( V; E  }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) g8 q% R+ A& V4 q9 P# N$ o7 L& R7 t
  67. * g9 e# y3 M3 j4 B$ p
  68. dma_addr_t dmaphyssrc1 = 0;. X3 @  \" p. ^  N" x$ e
  69. dma_addr_t dmaphyssrc2 = 0;) s: ~( z2 I$ s
  70. dma_addr_t dmaphysdest1 = 0;
    / N0 l4 }5 o# i. i8 ]% ?
  71. dma_addr_t dmaphysdest2 = 0;
    ) \  b4 Q7 }( T$ O! P6 H
  72. 1 @& t* C/ s; L: U  _
  73. char *dmabufsrc1 = NULL;
    & F1 g8 Z* G/ i- g
  74. char *dmabufsrc2 = NULL;' e% Y1 }8 n. T" H. ^' m7 X
  75. char *dmabufdest1 = NULL;) n9 ?3 J: P1 I. n8 n6 v
  76. char *dmabufdest2 = NULL;2 t5 c7 K4 M' |1 y: C, Q
  77. ( a% R' g+ |' f! {" T+ T
  78. static int acnt = 512;
    1 U  H- j( g- F' f& k& |  X7 A
  79. static int bcnt = 8;: \  f: ^0 h8 k: r
  80. static int ccnt = 8;  A& i2 D5 ]+ c( j

  81. . {' s0 S2 Z4 T' R
  82. module_param(acnt, int, S_IRUGO);
    6 R3 p, L! |' {& L6 e3 p% H! e6 K
  83. module_param(bcnt, int, S_IRUGO);# @% b. @% ?: s3 m$ F) a, A' o# q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% d. J3 {( b/ r% s* @
5 }! r4 H+ n+ _" m  X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- A; o* q) _  S3 C/ k: k+ P$ ?4 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, M7 z! n# G! [& p2 e! b. D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. g; ?5 @. z/ [. g$ w
; y4 Q- M8 P2 t3 C
0 ~' C, Z6 C- Z( o" c0 g- _1 ~' G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 18:04 , Processed in 0.045088 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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