OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 D0 _: b; h+ D. K/ ~2 ~, Q; I
  1. [code]EDMA sample test application
    6 x' t" u3 H- x8 I0 A' `
  2. /*
    8 l; @# M1 E, z% Y8 h6 N6 Q
  3. * edma_test.c" `! i6 B; t" {3 N# ]/ W
  4. *- h1 k" S9 p! f6 o8 R  [7 \9 I+ Y
  5. * brief  EDMA3 Test Application2 F, Y3 M/ t3 A+ @, g" a* J- c
  6. *% A: O" h$ X- |: y, O
  7. *   This file contains EDMA3 Test code.7 @. \! C6 j4 B* ^
  8. *3 W5 s, j9 h9 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / O& V% _9 B& p& E9 {; G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 k+ D  L. H# T. K7 d* ^( P
  11. *         TO CHANGE.
    . l! n! t  N6 k& ?. s
  12. *4 j% _% l1 h5 ~/ Y4 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # S( F/ B0 b) m1 I! [: B1 t
  14. *5 ]4 `: `% q" t( i0 J4 i
  15. * This program is free software; you can redistribute it and/or# X; d; ?" x& i& v
  16. * modify it under the terms of the GNU General Public License as
    ; B8 ?% W7 T9 y
  17. * published by the Free Software Foundation version 2.
    ; F4 K# J8 H. }6 b% f
  18. *$ |1 e  M2 t: o" R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 b" k. w, u. g8 s/ _6 H9 J; f
  20. * kind, whether express or implied; without even the implied warranty
    " e2 Y* C5 T: N5 v+ l2 r9 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 B( `9 G1 ~% U3 s: u0 U
  22. * GNU General Public License for more details.2 q7 u9 Y7 C+ Z: p- ^9 [$ X7 `
  23. */; |; w# H+ Y/ t5 K( i6 b# F

  24. 2 i8 f. c0 c& G) p- _( U
  25. #include <linux/module.h>/ |/ F& P) z0 X9 ?3 |/ B" Y$ h
  26. #include <linux/init.h>) c' }  a- r/ X  E* ^% P
  27. #include <linux/errno.h>8 e( g8 b  L+ v6 a, R8 s: A# {- ~% J
  28. #include <linux/types.h>
    0 k* t. L+ k2 Q1 o9 t
  29. #include <linux/interrupt.h>  C7 X7 s. j2 ~, F0 M# R4 v
  30. #include <asm/io.h>
    . R; Q4 n4 d0 ^* K( V
  31. #include <linux/moduleparam.h>9 m; h) F7 C. o% c' m( U- W' l, v
  32. #include <linux/sysctl.h>( o) c4 j* J: Q7 }
  33. #include <linux/mm.h>
    ! o8 Z5 P9 P& ^0 @
  34. #include <linux/dma-mapping.h>
    ! M/ I- \( \& i1 o4 m( u. V( ~
  35. ) F* y9 O9 B  n7 |3 Y- l
  36. #include <mach/memory.h>
    ) V! O0 Z+ }" j" k9 c. S
  37. #include <mach/hardware.h>
    3 N7 n  p4 t$ J5 g5 |# [" G
  38. #include <mach/irqs.h>5 a& P7 p& z2 Q4 I- b( h1 b* i
  39. #include <asm/hardware/edma.h>1 l  F9 d; X( b9 H2 P  a
  40. - i% t" d. e" ~3 k
  41. #undef EDMA3_DEBUG
    5 D1 U2 q% ~  }9 r9 |& j
  42. /*#define EDMA3_DEBUG*/! c- ~1 N# Z1 h" C8 _* x

  43. $ ^) _  P' r1 n+ _. x
  44. #ifdef EDMA3_DEBUG
    ) b3 @5 U0 q5 x' v0 `9 n2 t2 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' k. C% m) m8 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 z9 R+ i/ z$ J& H4 O' |9 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 ~+ `9 S( I; y9 z7 ^
  48. #else- e" \0 r& O. W* \
  49. #define DMA_PRINTK( x... )
    : b3 l4 ]3 c' n4 r: b9 j+ E# s
  50. #define DMA_FN_IN
    + o" V6 _/ @% `3 h( L8 ^* n& s
  51. #define DMA_FN_OUT
    6 S* T  Z1 t) b) k( |5 q) p
  52. #endif+ G* Q: r: y0 c, \8 G

  53. & E5 o9 e4 B6 q% H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 o5 ?; T/ {3 O
  55. #define STATIC_SHIFT                3
    . j2 M5 ^! k$ O" ]  K) A! X0 A" U
  56. #define TCINTEN_SHIFT               20. F' d' K$ X  _
  57. #define ITCINTEN_SHIFT              21! F! H! p* X  j7 F2 w/ M
  58. #define TCCHEN_SHIFT                22
    6 A: e( y+ l- |/ z3 z
  59. #define ITCCHEN_SHIFT               23
    4 G/ B0 f, \* E3 U" W0 {
  60. ( P9 N5 ^( s' m5 `; ^& [% u
  61. static volatile int irqraised1 = 0;* D, C' ], T8 }3 A( f* S0 D
  62. static volatile int irqraised2 = 0;
    + L3 \! [- q: n9 K

  63.   G: y, b5 U6 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / o2 [7 o9 J* Z9 w+ c# t' {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      @8 t* `3 H/ ^0 f  V$ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Y4 g* p" e$ p- J7 n
  67. 6 X" r- t; t' v4 a7 y+ H
  68. dma_addr_t dmaphyssrc1 = 0;
    - S' H' M  M$ p, V5 E& Z" Q
  69. dma_addr_t dmaphyssrc2 = 0;/ u/ E! B9 {1 g1 B% X: P
  70. dma_addr_t dmaphysdest1 = 0;- P% f) Y7 G8 _# {- m$ [4 |% r
  71. dma_addr_t dmaphysdest2 = 0;
    4 `/ W8 k$ _* o8 n5 E. g2 ?0 U  V) D- @
  72. 0 V! B0 G3 p; u3 ~% v
  73. char *dmabufsrc1 = NULL;$ {. A* T; ?; w+ l, Z6 B  T! ]
  74. char *dmabufsrc2 = NULL;
    , h" x' _& S9 K# ?: Q( ]. e
  75. char *dmabufdest1 = NULL;9 Y9 y' W* s" j, q; |$ F
  76. char *dmabufdest2 = NULL;3 j: s' a8 [. b0 U1 W

  77. 2 b$ n$ u7 W! n3 p. Z4 q
  78. static int acnt = 512;
    4 h3 }& }$ s. K; v  c1 x
  79. static int bcnt = 8;- j' P. f& r/ y- X9 D0 R* |9 ?
  80. static int ccnt = 8;" z* P: V" Y" C% ?% L. @3 n2 z7 X* f

  81. & ^) T; D* P* o# f/ H
  82. module_param(acnt, int, S_IRUGO);
    0 x$ e6 O7 S7 F7 R- j. @
  83. module_param(bcnt, int, S_IRUGO);4 N; y; `; E& L. ~0 W4 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, k8 C  Z9 j7 y
! j% `; z# I7 H' H# l* q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; F9 n* b+ q6 d+ }1 X$ P0 ]1 A. E: L/ s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ^9 l  x) W: E* o* _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 ^( a. g, p9 `0 W8 c4 w
, t9 ^0 F  Q1 r5 g

+ u# X0 k+ z+ O2 \& y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 12:56 , Processed in 0.040389 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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