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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / M/ j6 S( J! F$ s& }
  1. [code]EDMA sample test application
    6 y9 ^! w0 V% r
  2. /*
    - g, i2 V& P: q, R  `! V$ r* q; u
  3. * edma_test.c- j$ X4 F8 ~5 c$ ]( g9 }* J# x
  4. *9 N- D4 V' M0 B9 R0 W9 L
  5. * brief  EDMA3 Test Application& x/ w; Y, g  ]+ }' K) {$ ?5 R
  6. *
    4 l4 a' l! B6 Q( X3 x/ X' Z
  7. *   This file contains EDMA3 Test code.
    ' I7 x3 N$ U; Q. _
  8. *
    , y& a$ r; ~9 C7 q+ Q+ ~7 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 M; f; E' {8 n& P& w" x6 @/ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 B/ C$ f  x# r  t  U2 t; a
  11. *         TO CHANGE.
    ! h" L) _0 R( T6 F+ k: o
  12. *# {& _3 c" Y- J* V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* @1 D1 y, ]+ W7 }4 q" h. v
  14. *
      m: V' e0 q9 k! p/ I
  15. * This program is free software; you can redistribute it and/or
    & {. A# H0 L1 v
  16. * modify it under the terms of the GNU General Public License as
    , X+ M: @7 {2 p# H
  17. * published by the Free Software Foundation version 2.
    $ P4 s$ t0 h2 `/ E7 a# i+ k
  18. *& _, s2 H. v' A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 F5 V6 V" k' K  Y6 @
  20. * kind, whether express or implied; without even the implied warranty
    ' E7 A# m. q, Q5 n3 _9 c" D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( s" R3 \8 {7 l& F
  22. * GNU General Public License for more details./ N) S" ~7 p7 T/ n1 Y* ?
  23. */7 p5 V- l) |  w* u
  24. 8 S& Q# p/ X1 C! F; l8 j
  25. #include <linux/module.h>* P! T" [. F; C' g; y
  26. #include <linux/init.h>
    * I, W) b( E1 W3 ~/ L
  27. #include <linux/errno.h>. |  [2 ^6 y* G+ h. z" b
  28. #include <linux/types.h>
    6 j& _% P8 A9 v. ^8 X! t
  29. #include <linux/interrupt.h>/ G. E* ?% Y" u3 C, \$ |- F
  30. #include <asm/io.h>9 \7 |" _  |: W2 ]& h
  31. #include <linux/moduleparam.h>4 k* g1 U8 r; H
  32. #include <linux/sysctl.h>" W! d8 E8 @; j, Q  n3 {
  33. #include <linux/mm.h>
    ' O2 @. ^9 y) a4 g( ^
  34. #include <linux/dma-mapping.h>
    , w- {  }( [  ~

  35. 2 T# @$ f. Z- e9 A7 G
  36. #include <mach/memory.h>( d6 w2 J- \+ x/ T5 T
  37. #include <mach/hardware.h>
    : C5 a" J+ T3 x
  38. #include <mach/irqs.h>
    - K9 a' p: c2 s' p. W1 t) r' U( i
  39. #include <asm/hardware/edma.h>6 N) A9 ^) j: u4 @& Q1 H, y
  40. 1 C# }8 [2 u3 e* @$ {! p9 c- Z' x
  41. #undef EDMA3_DEBUG4 g" T4 O9 Z& M/ \2 f5 v. b+ k
  42. /*#define EDMA3_DEBUG*/
    7 j+ @; m1 e/ `3 H+ O
  43. % Z  S# M, F$ Y$ T
  44. #ifdef EDMA3_DEBUG+ U9 P1 r1 M5 H9 E9 h9 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 m4 h$ g2 z* y' ^& Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 g7 t+ u( o7 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 c/ J2 G1 B/ g9 _' V- i# u' R
  48. #else2 \+ u/ G2 S; ^% B( ]
  49. #define DMA_PRINTK( x... )* h. U% d; ~7 L0 @2 W3 t, B
  50. #define DMA_FN_IN6 C7 W/ h, p0 y. i$ F, l0 Y
  51. #define DMA_FN_OUT
    ! H+ _2 I5 A# P6 g
  52. #endif* Z" v: t  r' Y; e& J+ V
  53. 0 {7 F1 @- V( w1 V7 Q- y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # _- Z! N" S' Y3 }' _
  55. #define STATIC_SHIFT                35 u" R4 ]) ]: u" X
  56. #define TCINTEN_SHIFT               20/ E2 U  v$ l/ j' O
  57. #define ITCINTEN_SHIFT              215 R- v( f# A5 S; t0 v0 Q
  58. #define TCCHEN_SHIFT                22( _" T! z, w" L, Z
  59. #define ITCCHEN_SHIFT               23
    ) f3 C, w4 N& ~: V' t; ^

  60. + S- m, I; I/ U% z) M# A$ C6 R7 {1 T9 ~
  61. static volatile int irqraised1 = 0;9 |# Q0 G/ f6 P  N  `; W
  62. static volatile int irqraised2 = 0;% `4 h, A/ H! R# s! l. t

  63. 7 c: L) ]; R% N' M6 }6 s+ O% H& k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 [& y6 A! C  Y( U5 V5 `6 d  a: I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . }( f0 x1 u1 n0 p7 }1 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 u# [  V: n; l6 Q
  67. ; g8 h( q" `3 b; |7 H
  68. dma_addr_t dmaphyssrc1 = 0;, D- O7 n% F7 u- {, m
  69. dma_addr_t dmaphyssrc2 = 0;
    4 e# t- w. w0 |/ ]% u( F- f
  70. dma_addr_t dmaphysdest1 = 0;
    8 s, n9 v4 Z4 F$ y: t; Z8 L
  71. dma_addr_t dmaphysdest2 = 0;
    & b# `* |& [) s: P4 T5 g7 g& f
  72. , J( L( X3 I* ]4 }6 w7 G! }
  73. char *dmabufsrc1 = NULL;
    ; x  g4 _* {; |1 Z7 A9 X
  74. char *dmabufsrc2 = NULL;  O  g: |, P) n8 @4 N
  75. char *dmabufdest1 = NULL;
    " b" ^% X- b. y6 D
  76. char *dmabufdest2 = NULL;
    4 f  {/ e- L+ [* s2 D

  77. * M; o  z5 ]7 @# q! T- v
  78. static int acnt = 512;  O6 N' `, T. B( }. K2 O% J
  79. static int bcnt = 8;% b0 m* F! X$ Q# F/ w/ a) h( [$ Y3 U
  80. static int ccnt = 8;
    0 f4 N! ~. v2 ?% V# |

  81. 9 [" |) W; O3 x2 M
  82. module_param(acnt, int, S_IRUGO);3 Y' |# g3 y) z# }& j
  83. module_param(bcnt, int, S_IRUGO);
    9 ~3 h  b- g& W1 G7 O& A1 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 C, {5 k3 \1 K9 B$ L! Y0 p1 j1 I- |) L) _  h- h4 T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- D) I& c7 W, _: E/ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# g  _! [$ E& ^8 H0 }8 c3 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Z$ }6 V  `( \5 L0 E" W
& }. P# T, p; E  z+ F  t
% O8 k6 f6 _! a& S5 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 08:06 , Processed in 0.032985 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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