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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k, l* [& U: z5 X: k
  1. [code]EDMA sample test application; C. B$ s2 o- z* K
  2. /*0 e; c4 z- P: e2 }0 ]( I  G$ S
  3. * edma_test.c
    5 q6 `9 o( G( K
  4. *$ Z, M0 ?5 p8 ~. Z
  5. * brief  EDMA3 Test Application
    # s* n- _- P$ M* r' u: Y& y- k
  6. *
    * y9 a) z* G6 ]/ R: ^3 Z) K; }5 v2 x+ J
  7. *   This file contains EDMA3 Test code.
    : i4 |# _) ]; a: N1 |0 G
  8. *
    9 O7 [( f3 b. p. _# `  Z4 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 {5 m. t1 d4 `8 {/ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 ^' h, P4 a$ a% @3 Z. u: S8 l& J
  11. *         TO CHANGE.
    : k$ W, \( b9 a) S$ [% C) b
  12. *
    ' w: A" S' Y! q( o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. m9 G* U) ]- v9 t# {7 z! b, J: C
  14. *
    3 m& c2 D, n% o7 q' F# Q, g! y$ b
  15. * This program is free software; you can redistribute it and/or, r# K; P/ k9 O
  16. * modify it under the terms of the GNU General Public License as8 O1 u5 {' G" o4 Q" D
  17. * published by the Free Software Foundation version 2.
    ' e, W, q3 V; \+ J/ t% P3 J! V7 k
  18. *
    / T* u/ c) r3 t3 m+ F  `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  v! o9 g* k5 c4 Z0 h
  20. * kind, whether express or implied; without even the implied warranty1 P8 L/ O  D) g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ `" @$ `$ c7 T3 \1 n, ~$ \* D
  22. * GNU General Public License for more details.
    $ N; {' T9 C4 {5 ]' M( _4 Q" U% u6 X
  23. */" f- n- e3 z5 D

  24. 3 s/ R6 J% B9 o5 s1 P  _2 c3 Y
  25. #include <linux/module.h>
    2 p: F& Y. ~% e1 M
  26. #include <linux/init.h>/ y& H% K; Y2 w; H1 s
  27. #include <linux/errno.h>
    % T/ g& k1 i$ ~
  28. #include <linux/types.h>' `! \; `! D: S% T; l0 I
  29. #include <linux/interrupt.h>* l  c+ V% b# O8 f0 \0 Y
  30. #include <asm/io.h>- A+ e6 W% @/ C+ V+ {
  31. #include <linux/moduleparam.h>; E- ]& Z5 N) N$ `! K0 e
  32. #include <linux/sysctl.h>
    : F8 @( Q% M6 H; `' p8 r
  33. #include <linux/mm.h>
    # T7 ^; u( q" c5 d6 D3 G/ w
  34. #include <linux/dma-mapping.h>
    : i7 R1 f5 D2 m5 I

  35. $ S$ X! v7 c. `' r7 Q- L$ [
  36. #include <mach/memory.h>& Z+ \: ?6 _7 h6 W- B( x. k
  37. #include <mach/hardware.h>
    : U8 y$ X5 l2 s* l3 {5 _
  38. #include <mach/irqs.h>
      {! R6 }# r9 m: A+ T
  39. #include <asm/hardware/edma.h>
    ( m0 s) t; i$ V5 ~
  40. 8 u- d  s  S- V1 d7 o4 L6 b
  41. #undef EDMA3_DEBUG
    2 [& j* d* j9 S% D5 x
  42. /*#define EDMA3_DEBUG*/: p6 i( e- ~0 X' [; |. }

  43. 2 t' a& f9 Y/ y9 q1 D: q7 b
  44. #ifdef EDMA3_DEBUG, u4 [8 v! R+ \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), K5 u" o6 |  L4 u3 L* ^; G0 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( }6 @- J9 q) ~; Z4 k7 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 V: P! Z; l( E' o" n& }
  48. #else
    5 w" h7 d* h# [) `) ?) g
  49. #define DMA_PRINTK( x... )
    ' w. w, X) E8 o. E+ f1 R; ^
  50. #define DMA_FN_IN, a) a0 D7 ~  @) f
  51. #define DMA_FN_OUT1 Z# p- J+ |/ E3 i; E
  52. #endif- S% z( k/ x$ ^( d& [1 M
  53. + q  L- X: R+ P; p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 j/ b* N: e  G, S6 i
  55. #define STATIC_SHIFT                3! d8 h% L, y) ?% R3 d9 O* J+ [0 ?
  56. #define TCINTEN_SHIFT               205 A; a3 ?* g- M% R0 N
  57. #define ITCINTEN_SHIFT              210 s- e% L( @, C' z( d" u/ X
  58. #define TCCHEN_SHIFT                229 s1 w2 j8 u2 J6 V
  59. #define ITCCHEN_SHIFT               23& O7 R9 e8 T( o" g

  60. 9 S/ c! T2 ~( k* s: b
  61. static volatile int irqraised1 = 0;" q8 a# I- T  m
  62. static volatile int irqraised2 = 0;
    : F* L1 C4 x! x0 u5 y% s0 q
  63. 0 S9 g5 y7 W+ G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ L0 |$ Z- @* @& Z( w/ K3 m$ ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; l# C0 k% A+ a' L7 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 t% _8 x& t- `* c# C

  67. + e/ W" N  @  i' g2 u" w) p
  68. dma_addr_t dmaphyssrc1 = 0;3 ~: ]1 U2 h+ v; Q! K( t
  69. dma_addr_t dmaphyssrc2 = 0;
    5 h$ }$ p3 H* r% ^$ o, f
  70. dma_addr_t dmaphysdest1 = 0;
    ! w0 [) m3 u: A3 [$ C/ t
  71. dma_addr_t dmaphysdest2 = 0;: P" j6 T8 Z. ?5 C
  72. 1 W  X! M4 [+ Q$ E4 S: L  N" J
  73. char *dmabufsrc1 = NULL;6 A, d& f4 q# `. A
  74. char *dmabufsrc2 = NULL;
    - L2 X2 B% Y% t7 Z" v! C
  75. char *dmabufdest1 = NULL;
    / W- o" C0 E; M2 `/ |
  76. char *dmabufdest2 = NULL;7 X* ]9 i* g* \1 U! X

  77. % w  Z& {( {9 \% t' k# p% q6 g
  78. static int acnt = 512;
    2 D, P0 V' Z. i" u7 r! V" ?
  79. static int bcnt = 8;
      T5 Z& o& r8 F: z4 ?
  80. static int ccnt = 8;
    6 B+ x9 Z4 Y! Y) U3 y6 x' u
  81. 6 m0 p! d: k2 m9 _6 x1 ~
  82. module_param(acnt, int, S_IRUGO);
    & x2 m! m- O: ~3 d: k* K0 m
  83. module_param(bcnt, int, S_IRUGO);% x8 b% P' l# \4 Z( `# i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, ?5 o$ m5 m2 N* M1 v. }7 A

. f& }3 J% u0 J4 |, ~, y6 d# \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ w; E  u8 u+ T, T- X- S6 Y
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 ?0 B- O2 v9 ^9 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 Z. p  [4 J5 L
' z. k, K3 b; B! ^) H$ J
7 W& y2 l. @/ O( L  |' h& G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-4 05:51 , Processed in 0.038503 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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