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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 c, _* y' P6 c0 u# x# G, p. H1 u; x2 J
  1. [code]EDMA sample test application9 e: `3 k9 R: V' F% p) @8 Z
  2. /*3 R% O5 J9 q# k0 m6 z
  3. * edma_test.c
    ! a9 r- e1 T, s7 q( y! b
  4. *: G- l' ^/ J" D& g& q
  5. * brief  EDMA3 Test Application
    0 }: u( @! f: F5 a
  6. *
    2 \, W, C# G- p. ^8 u- `% C
  7. *   This file contains EDMA3 Test code.
    4 g4 p4 Y5 S6 |$ v
  8. *
    9 S) u  `+ d- V7 X7 d+ f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ _5 C7 }# n# O0 g8 E* K0 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ j' K+ G6 t" D' G2 j
  11. *         TO CHANGE.
    + R$ K5 u# G  H( x2 o
  12. *
      j7 O" b* t  ^3 I  o2 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 R- ]1 P( t( ~5 ]
  14. *
    " y# [1 y9 A+ a! u. x6 [4 `3 r6 q
  15. * This program is free software; you can redistribute it and/or6 [, Q! F/ X6 R; w
  16. * modify it under the terms of the GNU General Public License as
    9 `: D  Z: m; i
  17. * published by the Free Software Foundation version 2.
    - n: n& b" U) I3 f; X
  18. *
    ! O1 ?& ]( g1 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- A& u0 ~- C$ b; V; n
  20. * kind, whether express or implied; without even the implied warranty
      @+ H( r# c+ I2 Z2 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' y0 s2 f- }4 |' w. w
  22. * GNU General Public License for more details.( g7 i; c, v1 p5 [2 [* S
  23. */) F0 n2 c: w- w6 z7 p+ B* Q
  24. 1 D0 d0 L! F# B6 e' X2 L
  25. #include <linux/module.h>: A! J. x6 V! E# i. O1 K5 t% X+ e
  26. #include <linux/init.h>
    : g5 ^, _; n& O; u, n# H+ X' [
  27. #include <linux/errno.h>2 ?  l9 C& X% l) b1 O+ [7 A# K3 W
  28. #include <linux/types.h>
    * L; o4 R0 X: Q# m9 \  o
  29. #include <linux/interrupt.h>6 ]4 c) h2 N: {
  30. #include <asm/io.h>
    8 `5 P0 {2 y9 R, d/ k1 J
  31. #include <linux/moduleparam.h>
    2 L: j2 i2 I5 m; q' V: X5 }
  32. #include <linux/sysctl.h>
    * {1 U6 J1 j/ m) [1 X3 U& D$ g7 A
  33. #include <linux/mm.h>
    : k* m9 A; n4 y& |
  34. #include <linux/dma-mapping.h>
    , _+ H& {( }) o5 l2 h
  35. * X- U8 M8 O; ~* |' X
  36. #include <mach/memory.h>$ f, N" M: p/ R& v
  37. #include <mach/hardware.h>" P+ d, h6 ]0 A, g
  38. #include <mach/irqs.h>
    1 R, |; O3 ^1 D, T' m6 V2 F' K5 {
  39. #include <asm/hardware/edma.h>7 j; G' z( u& T' U% l- b
  40. + Z0 G/ P$ Z. r3 n& ?9 d6 |
  41. #undef EDMA3_DEBUG
    " j. ]9 Q6 W& L
  42. /*#define EDMA3_DEBUG*/  x9 q# O+ n. o7 m. i

  43. ) k) U/ b1 K& H. }1 J2 \% \
  44. #ifdef EDMA3_DEBUG  t% @8 y) L2 i- G! R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ~: c% ^# u6 N; R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( v& L9 [7 s" a" O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 f( V5 N7 K( e' Y1 W+ R
  48. #else' `$ Z; [4 @$ x
  49. #define DMA_PRINTK( x... )- A! ]* M% C: ]; |$ j) H& ^
  50. #define DMA_FN_IN8 O! A% e6 A7 k
  51. #define DMA_FN_OUT% D3 j# {: D1 {* t9 T# l
  52. #endif4 H$ R  y- X) M
  53. " Y& }0 M% l( T' N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' m8 @/ P7 R  M  f1 ^+ X
  55. #define STATIC_SHIFT                31 y/ G) r7 e, u! \' k
  56. #define TCINTEN_SHIFT               20
    7 k# ~  v1 p7 W; M" P, I6 s6 V/ q
  57. #define ITCINTEN_SHIFT              21
    ! T6 c1 G' y& ~6 A4 _
  58. #define TCCHEN_SHIFT                22
    # u! x* {7 |+ P1 [
  59. #define ITCCHEN_SHIFT               23# N5 a. l  |' S( _& Z' c
  60. 2 V# _! H" b3 c" E9 x2 l
  61. static volatile int irqraised1 = 0;: D; u2 D$ L8 G: A3 f. N+ a
  62. static volatile int irqraised2 = 0;" J- Q9 _2 S2 s
  63. % a/ j9 i$ K& b1 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [0 M. V+ K- D4 k  q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d% f' a- h: m) X' `5 ?) v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& i- X8 J% c. T

  67. . f- j$ L/ ^7 l. J2 [; y
  68. dma_addr_t dmaphyssrc1 = 0;
    9 d; ?) }2 G3 X6 H" n# ^! }& |2 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ( V2 [# Z8 }  C; {- k4 f- I
  70. dma_addr_t dmaphysdest1 = 0;
    ' G0 S+ w% l+ b& W
  71. dma_addr_t dmaphysdest2 = 0;
    ) V( L; s8 E* c* z# |0 n
  72. 2 [) a/ D2 E# p, _, v, i
  73. char *dmabufsrc1 = NULL;
    1 o9 x; J+ \# I) \' H  L+ |
  74. char *dmabufsrc2 = NULL;
    " p1 Q; x* u# U* a' z
  75. char *dmabufdest1 = NULL;& |$ @( v6 D9 v1 v
  76. char *dmabufdest2 = NULL;( V- I  u- [" q

  77. 7 K" ~% v$ o+ c0 X& {& c
  78. static int acnt = 512;  c' G( j3 B8 B5 w+ s: v( l% o
  79. static int bcnt = 8;
    2 k$ r) l, `' X+ \$ A
  80. static int ccnt = 8;2 \5 n( j8 |# r8 T1 M$ C- W

  81. * x3 M3 b* Z8 x. K( Q2 k. N
  82. module_param(acnt, int, S_IRUGO);6 B; I8 E" r, G) z
  83. module_param(bcnt, int, S_IRUGO);- O$ S6 }6 d. f% O- n$ f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 I8 ?% X8 J7 O& z5 Z/ l: Y
/ w1 Z" s; R, h* [- T: {, T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ N2 I3 e$ g6 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 H, R# f) x. U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# D0 ~0 ]9 }! O
8 U& ^- P5 r& I, M5 A, G' {5 ~- @: _' _# ~7 ]* y' n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 07:26 , Processed in 0.039247 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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