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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( |& H0 s& f9 p5 j8 G
  1. [code]EDMA sample test application
    6 C7 P+ k+ E2 I0 d$ h! t
  2. /*
    & J0 n  x( q6 M. U
  3. * edma_test.c! u" p/ ?' C4 [7 {. L& n8 O2 R) Y
  4. *9 T1 y; u7 [$ B' m: a" o
  5. * brief  EDMA3 Test Application
    " y) x# b+ Z$ L
  6. *
    " C3 v+ Q6 C( ^; y
  7. *   This file contains EDMA3 Test code.
    ! l8 R8 `3 t" t/ L$ V" ~
  8. *
    6 v# [. m3 G, r3 n$ k) v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - P1 g, h  V" n4 q$ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* \' [; ?; T# N+ Z
  11. *         TO CHANGE.
    0 s* n( T1 I& [
  12. *
    6 @- y" @  \9 j' G$ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! i& ^) K0 g  O$ U$ o9 P8 f  I  F& M
  14. *5 E+ \+ v; ^& z$ I
  15. * This program is free software; you can redistribute it and/or
    , W( j3 L# L6 J8 w6 I) @) X
  16. * modify it under the terms of the GNU General Public License as' @& K& T8 I, f4 Q# r
  17. * published by the Free Software Foundation version 2.
    : z! f" t" E' J! }" y) Z  t1 u3 k
  18. *: a$ g$ v* a& P& x/ w/ k" d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w  f: A" }7 f) w( u1 y5 Y, D4 d
  20. * kind, whether express or implied; without even the implied warranty. \3 R$ X  |  {  n) S4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 @# K$ L9 F, F' R6 S
  22. * GNU General Public License for more details.
    8 ?! O% L* t1 H2 l
  23. */  W9 V* v. f$ S
  24. + n1 D+ j+ N6 A) y) K
  25. #include <linux/module.h>
    3 B% F# x3 ?9 P# r+ r
  26. #include <linux/init.h>' p3 I3 b! P/ r* t8 @7 I0 ^9 r
  27. #include <linux/errno.h>5 x' P: m) A7 h" f- V7 S
  28. #include <linux/types.h>
    & k4 E' N. Q1 @( o2 M; R5 r
  29. #include <linux/interrupt.h>! _- U2 @/ e$ ~1 M: t+ @7 A4 z3 E
  30. #include <asm/io.h>
    * }' A! Z- h6 u9 X. U6 x
  31. #include <linux/moduleparam.h>5 f# w. O" [* r  i
  32. #include <linux/sysctl.h>: g5 _- B4 A: E- O8 y! y; f  z
  33. #include <linux/mm.h>( h$ v3 ^* o( c6 ]9 p
  34. #include <linux/dma-mapping.h>) ]; }* \8 e! q4 M! s7 e
  35. # D. g: R& A4 t$ T* ?) k2 R
  36. #include <mach/memory.h>; L/ l2 U; q7 `) |
  37. #include <mach/hardware.h>3 ?# f  S, L7 K( u1 i: [
  38. #include <mach/irqs.h>
    ! }; ^' l+ h: m  B
  39. #include <asm/hardware/edma.h>6 m4 D7 E) i" l) L, x1 B
  40. 1 ^4 }% N* {& D0 M- `- A
  41. #undef EDMA3_DEBUG7 K! }4 P( [# P3 I8 }
  42. /*#define EDMA3_DEBUG*/
    % X) G5 u* ]/ u

  43. & H3 G9 v7 P/ h. j
  44. #ifdef EDMA3_DEBUG3 \0 h6 M) q* j  t. `0 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) U2 c# Z3 m( D% a6 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Z. F" d& j* u: `- L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) Q7 Q3 ~) F* L9 d* _  \
  48. #else
    : w0 Z, P) B& u/ ^3 ?
  49. #define DMA_PRINTK( x... )
    & o& {: X; ^1 U- x
  50. #define DMA_FN_IN
    ! K0 `( p- H% _
  51. #define DMA_FN_OUT
    3 X- g( I# v: p. D8 Q
  52. #endif# ~. o" y4 G1 c6 ?
  53. ( \) Y$ a7 B" J( _2 u' c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % y4 o8 ~! j) ^0 A2 u
  55. #define STATIC_SHIFT                33 k# }+ H7 x5 b3 [5 X( l2 C% z. w
  56. #define TCINTEN_SHIFT               20
    & F! L4 c. b& @. f
  57. #define ITCINTEN_SHIFT              21  U$ {3 K) s) ^/ Y% l5 Q
  58. #define TCCHEN_SHIFT                222 m% H) R$ {9 C
  59. #define ITCCHEN_SHIFT               23
    9 r5 d8 R; C. O% C0 ]

  60. ; d# h  ]0 O/ x8 U& P. g7 M
  61. static volatile int irqraised1 = 0;1 p5 T: N" U, ^( O/ T" ~( w' r" \
  62. static volatile int irqraised2 = 0;1 y2 t/ m* k5 H7 e' P* L6 K& f

  63. ! L" b- t, j$ G, U( s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' E" H7 y& ^* f, J" U0 b  s0 ]. {* x% h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' f  X7 H/ o$ R7 j# O$ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* @2 N8 L  @) Q5 j, |

  67. . e& X7 W3 k$ h
  68. dma_addr_t dmaphyssrc1 = 0;- U7 D- s) z- Q; e$ o( {6 ^8 I8 I8 {
  69. dma_addr_t dmaphyssrc2 = 0;. I5 y& J- A6 B+ L
  70. dma_addr_t dmaphysdest1 = 0;( ?, W9 Q# J( e; I# [# ^& \: G
  71. dma_addr_t dmaphysdest2 = 0;
    9 U7 r" j# O9 W" F

  72.   \6 y8 F2 K; P8 o2 F
  73. char *dmabufsrc1 = NULL;! a( V* ~6 I2 [8 B9 k$ T% [
  74. char *dmabufsrc2 = NULL;  c3 \  y2 v1 m2 j4 V; s
  75. char *dmabufdest1 = NULL;
    : f/ R2 C  W. ]* G
  76. char *dmabufdest2 = NULL;0 a+ J9 @% M- }5 X2 t3 O
  77. % Z$ ^/ _; z' ]% w3 a. h. Q, E
  78. static int acnt = 512;; [' H9 `& t5 S: a3 _4 ~$ ^
  79. static int bcnt = 8;: u% Z" X% W" u2 f! J2 s
  80. static int ccnt = 8;" _) X) z3 O1 D9 e) m: s
  81. + ]' p- r/ \/ N- M9 w4 w$ Y
  82. module_param(acnt, int, S_IRUGO);: @! Y: F! F+ n) r
  83. module_param(bcnt, int, S_IRUGO);  {3 C  h( g' k0 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: K$ N' D! l5 O' c1 ?" a
* [9 D/ T: }) r4 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  o! B5 G0 c$ e) Z/ e( M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# R" E5 A9 k* y6 c* M# X/ o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& y( m& c7 K7 c5 u! W. X
( y& ~- g# Z7 F& T( N6 T7 A' H6 ]+ E* Y5 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 18:12 , Processed in 0.038203 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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