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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I9 s0 M' o/ w2 t
  1. [code]EDMA sample test application
    # O0 j$ g4 |' ~! m6 m# v- L. ?
  2. /*' x. |4 F  ^6 n
  3. * edma_test.c- G& c5 @7 d( w( @3 e9 @
  4. *
    ' Z, Y) I! C% [- A; T- X
  5. * brief  EDMA3 Test Application2 N& e: {7 k% u) h& U
  6. *6 @3 L9 ~( k' K/ d, T
  7. *   This file contains EDMA3 Test code.
    ( w+ @% K) M; h& z. Z
  8. *5 r* S1 H. o2 J3 H8 t& K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! {0 N- \) T; E0 A% n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - Q, ^; ~) l. \3 `& r; V! b& C0 |
  11. *         TO CHANGE., |1 \$ p3 I6 z( G+ s4 m! Q$ ~
  12. *& G2 e9 D) u& q4 d+ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ k1 r' a- |: L9 \$ o
  14. *& A( i; s8 T. _. {/ C. d
  15. * This program is free software; you can redistribute it and/or- S6 S! E# z4 B  U. Y3 _% g
  16. * modify it under the terms of the GNU General Public License as3 [. d6 f, L6 d3 P5 P/ ]0 x
  17. * published by the Free Software Foundation version 2.
    3 _" b: _( q, O: m
  18. *" U; p: f8 {4 W* D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 h; F8 B/ [3 c6 R  s; J: O1 l
  20. * kind, whether express or implied; without even the implied warranty
    , Q( Q, D- [0 A; O; ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; E, g7 E8 w1 K0 Q  N; [  n
  22. * GNU General Public License for more details.
    & x: j) U3 }% f. M* R9 N) [$ Q4 {" o
  23. */5 l& G0 g; V0 E# n: Z! _8 r! u1 O
  24. ! [2 @* V9 ?' B
  25. #include <linux/module.h>7 o, [; s5 T8 r
  26. #include <linux/init.h>
      r: X. G' p# J; l. X' W
  27. #include <linux/errno.h>
    ( x: _9 O; u. J4 r" v! ?# n# T1 l
  28. #include <linux/types.h>1 ~# P* Z3 [3 w( m5 T7 j! r
  29. #include <linux/interrupt.h>3 u* C. o/ S/ x) o
  30. #include <asm/io.h>
    6 d* I7 z5 A% K# a3 C2 x
  31. #include <linux/moduleparam.h>
    0 m1 J3 `6 k5 t# C6 f* |. r
  32. #include <linux/sysctl.h>
    % `3 c+ I+ x& u1 b6 _/ W
  33. #include <linux/mm.h>' I: \& ], X; s0 }2 P& {
  34. #include <linux/dma-mapping.h>& {7 |3 t4 r4 w

  35. 1 `9 ?4 Z# j# ~3 p, {8 c" {' M
  36. #include <mach/memory.h>) x1 s+ T$ n* f. \* x3 W$ ^8 S0 u$ u
  37. #include <mach/hardware.h>, Q6 d! i7 U+ d0 E5 A6 n% {
  38. #include <mach/irqs.h>% _% b: a# d7 ]. p+ f
  39. #include <asm/hardware/edma.h>
    * S% u( \6 x1 U1 v& d
  40. % F, d# ]  Q9 @( W
  41. #undef EDMA3_DEBUG1 y) Y8 F) `! O, C! q
  42. /*#define EDMA3_DEBUG*/
    : Y0 [9 U# P3 U6 e9 N

  43. ) Y# m* u! p0 b1 z  l
  44. #ifdef EDMA3_DEBUG
    ) ~; j9 e1 t8 m1 R2 _( f" Q) a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" P2 h  o# K% M! m; P1 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- L/ Y8 i6 i4 L. X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 O0 Z1 w9 R. [: b2 _' d
  48. #else
    0 O+ I# g& R. ]1 E2 E
  49. #define DMA_PRINTK( x... )2 i! z3 ?! w  L" g) F
  50. #define DMA_FN_IN6 |4 \- Z- [9 z# \
  51. #define DMA_FN_OUT8 D2 o# O  b  F/ v
  52. #endif( o( P3 A, _2 R8 s

  53. 4 |8 H' E" p$ m8 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + w$ r$ |1 e" L
  55. #define STATIC_SHIFT                3
    " w9 F/ C4 j! a; Y9 v8 h" k
  56. #define TCINTEN_SHIFT               20
    ) U4 h5 v, O+ W. J/ M" q- V
  57. #define ITCINTEN_SHIFT              21
    / q- j- k' S6 M+ N' _; D0 F0 k' a" f
  58. #define TCCHEN_SHIFT                22
      n7 T: @4 |0 z. b( j
  59. #define ITCCHEN_SHIFT               23( S- a& R  u2 y
  60. ' t; G& ~2 T6 a4 ~6 a( V
  61. static volatile int irqraised1 = 0;
      ?1 y6 v; t4 \" \" W% j# c  E2 C
  62. static volatile int irqraised2 = 0;
    ' S  J5 w* A8 z( y- l$ H, N: z

  63. 1 s! A, t( l. y4 r9 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ H6 p3 q5 ?  u# K2 X# k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N+ T4 l9 S  `  p( d8 R. [6 P3 Q1 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c* N6 F  G5 l4 g

  67. : K" W- d5 T+ o& v6 C8 u( a7 m1 J
  68. dma_addr_t dmaphyssrc1 = 0;
    0 W: x7 ~* m/ W# y
  69. dma_addr_t dmaphyssrc2 = 0;
      I; S/ w) z( x, k+ t7 q
  70. dma_addr_t dmaphysdest1 = 0;
    5 P# b7 _, ]: z) [8 y
  71. dma_addr_t dmaphysdest2 = 0;
    1 G. }: B5 W" B3 B/ a* D

  72. . H$ A  V/ m6 D% P/ \
  73. char *dmabufsrc1 = NULL;
    1 j- O3 r  r9 B! Y8 V3 y/ j7 U
  74. char *dmabufsrc2 = NULL;
    $ a3 m  X$ I2 U# H- \1 x, C5 p
  75. char *dmabufdest1 = NULL;3 z/ T  P/ E! t/ D8 {3 J. C
  76. char *dmabufdest2 = NULL;
    # ~/ j) Q8 }( L# ~8 t# J' U

  77. 9 W- _6 b$ Y  t
  78. static int acnt = 512;
    : S% _' b, D, w4 r2 N" q; _
  79. static int bcnt = 8;2 j8 N$ ]+ V+ H7 [2 F9 h' i
  80. static int ccnt = 8;
    6 \) i- V- k4 Z- [6 ^  \0 P  r
  81. " o4 d) o# |, z( X5 `4 H( J3 x
  82. module_param(acnt, int, S_IRUGO);$ Z4 i' F( T( a1 Z
  83. module_param(bcnt, int, S_IRUGO);* B% p8 s/ ?1 o. v) A: p5 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ l2 s& h1 f2 Y# D+ e, a+ n& J) `
, H* J) z& L2 F7 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* Y3 Q9 U+ S5 `. U# A$ J, Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 l5 F8 _, ^* r8 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 G( @  L$ t! ~' B: _9 K, k8 c" w

# h3 h% M/ K5 l5 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 23:18 , Processed in 0.040727 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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