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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 _6 Z+ z3 t) g
  1. [code]EDMA sample test application  f9 V1 v7 {( D. v, I4 L" \6 [
  2. /*
    & P) V/ v( I. m* ]9 P6 [
  3. * edma_test.c
    ) `7 y. I5 M1 V6 j1 W7 g$ y
  4. *8 o  A6 B3 W+ V5 i
  5. * brief  EDMA3 Test Application& _; `' \* @! K' p* g5 ^& G, Z" B
  6. *
    8 x' ?4 A7 A: X5 ~4 B. N5 ?
  7. *   This file contains EDMA3 Test code.1 f. P4 Z' a$ J# X- W) h7 E
  8. *1 t5 B  D; K3 z( q( j# Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 R8 y6 f# M7 P4 k) A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 E0 O4 O; k% ^' {" y' A4 n
  11. *         TO CHANGE.
    0 p8 m8 q) L8 O# G$ c( \8 n9 _
  12. *
    & Z+ B3 m) N/ J: H5 }; T6 J7 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " E+ e! C& ?6 V6 p
  14. *
    1 ~! o- y0 F- |: R7 \
  15. * This program is free software; you can redistribute it and/or: Z- M" e  g0 c& l& u
  16. * modify it under the terms of the GNU General Public License as' q/ z1 U' V( I2 s: y* z. e
  17. * published by the Free Software Foundation version 2.( {4 x+ e# f8 ^6 v6 [
  18. *8 R* k2 M( u. H% S7 H0 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * X% T, \! c. A( {1 U  ^
  20. * kind, whether express or implied; without even the implied warranty* F5 g2 M2 \1 B* J8 ^! T7 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # u( t( `  z% m7 K$ f& S
  22. * GNU General Public License for more details.+ Z: ~+ |, u8 u" \$ m# [$ i4 _
  23. */8 \& h2 G+ q, p* P! J3 d

  24. 3 O4 M5 Y/ i* C! a; c
  25. #include <linux/module.h>
    ( r1 |1 J, ]2 r% D" f! j: P. o
  26. #include <linux/init.h>4 M, ]% F9 `6 P+ Y! f8 ^
  27. #include <linux/errno.h>" v7 w9 @2 Y; @6 X1 \
  28. #include <linux/types.h># [' E. N/ T! a% C9 t
  29. #include <linux/interrupt.h>
    , T% E! R5 q2 E* B
  30. #include <asm/io.h>' B! p: _' l2 H' h0 _
  31. #include <linux/moduleparam.h>2 D  ]( [8 A# K2 i3 X
  32. #include <linux/sysctl.h>
    3 {9 K1 F* }: P& ~. @% R
  33. #include <linux/mm.h>
    % n* @) W. U- p+ ^# J5 p+ a: p0 v
  34. #include <linux/dma-mapping.h>. y1 |, Y/ }# j6 c
  35. / |: s+ D) W& |
  36. #include <mach/memory.h>$ J, q; Y, Q$ v+ R" \: I
  37. #include <mach/hardware.h>$ g+ m. k* F) [/ l1 U
  38. #include <mach/irqs.h>- Z# @5 \3 T" ~8 T/ J* q( x, L
  39. #include <asm/hardware/edma.h>
    * ^6 y/ @6 r3 B* c9 K* z9 B2 s
  40. - K0 a# t9 P7 z# Q
  41. #undef EDMA3_DEBUG
    - j+ D5 u& G5 a9 f( A! R/ H7 d
  42. /*#define EDMA3_DEBUG*/- q4 \4 {- n  a( U8 E- w9 x0 r

  43. . x6 T" h' i* [3 N
  44. #ifdef EDMA3_DEBUG( O# j* v% I& B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : W- z5 N2 H. D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      O; K. ^, |" o! y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r' R. v- v) E8 y
  48. #else) y' G; ]5 m5 g8 r6 Z
  49. #define DMA_PRINTK( x... )
    * l- Z8 j/ |. b' u7 ?5 Y
  50. #define DMA_FN_IN: O4 ~* F4 U/ B3 v* m6 z
  51. #define DMA_FN_OUT0 U+ d9 g1 ?. E
  52. #endif
    4 x3 W/ `4 q# A1 ]9 ]; x
  53. - o9 W- j5 {8 I" P, }1 j. Z  j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 T. @2 B  G6 C5 z
  55. #define STATIC_SHIFT                30 {5 H- k% |2 u2 m+ W+ \
  56. #define TCINTEN_SHIFT               20
    1 H0 ]9 l1 a; L( x1 X' s
  57. #define ITCINTEN_SHIFT              214 X% j1 S0 l- h5 u
  58. #define TCCHEN_SHIFT                224 l4 a9 K, R$ k, K9 C6 l0 i) w
  59. #define ITCCHEN_SHIFT               23
    ! v2 ]' S9 Q' L" b0 A: s, e4 l+ H
  60. - z5 ?3 h' W4 ]1 T
  61. static volatile int irqraised1 = 0;2 Z; J) K/ Z  n
  62. static volatile int irqraised2 = 0;2 u! b' v: G4 o$ w6 {! ], t" b
  63. - i/ E& c* e6 i% q# x$ @* ^: n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: S" P) T& R6 |8 [* u* @% z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* p- P6 V$ x0 X1 e& B' k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Z9 w+ U- [/ {/ A8 j8 x

  67. / G% w- u+ X2 _" r/ {4 O
  68. dma_addr_t dmaphyssrc1 = 0;3 _8 _% }% [5 i- d+ T
  69. dma_addr_t dmaphyssrc2 = 0;2 t7 j8 v! @& T$ X4 C- b
  70. dma_addr_t dmaphysdest1 = 0;
    " N+ b4 X$ H. L+ w7 }: A
  71. dma_addr_t dmaphysdest2 = 0;+ E  ]& K2 d- L6 I) K+ h6 C: M5 ^

  72. 0 p0 V/ E4 W3 |: `% s. `7 I, {
  73. char *dmabufsrc1 = NULL;& s. D5 h% L, o! M
  74. char *dmabufsrc2 = NULL;; j2 F4 m: ?8 t
  75. char *dmabufdest1 = NULL;
      ~2 c; ]" M. N  B  a; J+ x
  76. char *dmabufdest2 = NULL;) E! b" |0 @& k- k* C  s

  77. 7 @+ R) g; W4 w
  78. static int acnt = 512;, R5 n* v( j1 p8 @
  79. static int bcnt = 8;* L5 w9 y7 x1 w! O( ]# |" l
  80. static int ccnt = 8;. P5 O: F, d" P5 Z! |$ V

  81. ( _0 P7 d/ i. k$ y0 K
  82. module_param(acnt, int, S_IRUGO);
    * u$ U0 E# v( c/ {+ M0 }
  83. module_param(bcnt, int, S_IRUGO);
    7 L3 e- W9 U* z! S& w; G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 ^7 m. S2 h; A7 w( {3 `- i* R  U
4 C& ~: s& t+ M1 o3 V" V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ~0 _* @) ], X0 Y" ]5 h4 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- l) y) J) T& i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 I2 \6 F9 [. @+ {: i4 X$ W
2 v/ [+ k8 R" t
  ?* l. E& u/ W( X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-7 09:05 , Processed in 0.048726 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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