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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 x* ]# ^6 j( z% s. X! W5 z) c) E
  1. [code]EDMA sample test application6 G, F" @0 @$ k
  2. /*+ n! {; _7 c% K4 b" N
  3. * edma_test.c
    ( O& `$ {9 M/ q1 O1 X/ U8 S
  4. *) q1 y) \0 A2 Z1 y" f
  5. * brief  EDMA3 Test Application
    + I4 a, w( E/ F5 o* ]: G7 Q
  6. */ L- P/ N, U& W3 g
  7. *   This file contains EDMA3 Test code.* P8 k* w4 C) E
  8. *  ^2 X6 M) `% o) @/ _1 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {9 L% d# `. P- |+ ]& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 e4 }) @9 x1 P0 p, M3 x0 ?3 y
  11. *         TO CHANGE.8 Q$ Z, p$ M$ h6 H, k, n
  12. *' F4 j- T4 }  D% ?/ d9 c, }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 r  {, }# z# C
  14. *" S: s$ D, g0 V: t% w1 A1 e
  15. * This program is free software; you can redistribute it and/or' h$ s# ~2 Q2 }" G
  16. * modify it under the terms of the GNU General Public License as
    - B: P2 [  u, V6 ^: M- \5 x5 ^2 U
  17. * published by the Free Software Foundation version 2.
    " Y# r' u# \9 W# f& u
  18. *( `8 ?' i0 l% G1 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" d" J5 K5 y) S
  20. * kind, whether express or implied; without even the implied warranty% w, M: q/ D$ G% J$ U4 f# O9 N  b  Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % r& C2 R$ @  C* s) l" j) D% I
  22. * GNU General Public License for more details.6 N2 S9 O: b* z% o
  23. */
    ! j% s* v( e* n& k# L5 v
  24. 1 R7 R" i& K3 R+ N3 _" x
  25. #include <linux/module.h># w8 q) D; H! U/ [' c- }  K
  26. #include <linux/init.h>, _' |4 d9 _  y) G# F& U9 f: v
  27. #include <linux/errno.h>
    * a: v. \; d4 h8 X0 K& \7 M2 m
  28. #include <linux/types.h>
    0 ~! w0 J* Q5 `1 d% {. ]
  29. #include <linux/interrupt.h>" B! P8 m6 ~$ w: u, j; _+ T) q$ R( B
  30. #include <asm/io.h>
    7 F: o; j7 t2 o. `
  31. #include <linux/moduleparam.h>
    - [! z' {9 _: X
  32. #include <linux/sysctl.h>
    ; t. E2 F3 u& m; ?; |- x6 Q
  33. #include <linux/mm.h>
    . c# A7 f" g0 b! V* j. [* ~
  34. #include <linux/dma-mapping.h>
    ) V1 L1 O- f) L* Y  A; Q) q

  35. ! Y& `% o6 x$ t# N' ]
  36. #include <mach/memory.h>( j$ @# U/ Z: T2 p+ h2 S8 M
  37. #include <mach/hardware.h>
    . L% y* t0 E$ U& C
  38. #include <mach/irqs.h>
    - _! N5 P( D! H, d5 Z5 Z
  39. #include <asm/hardware/edma.h>8 m6 u: [. E* |( H. z% G/ Y9 i

  40. 9 ^) }# w1 d# |7 ?( P/ X
  41. #undef EDMA3_DEBUG: O1 d" ^& P! u
  42. /*#define EDMA3_DEBUG*/
    7 A4 |( M/ x! ^% k& L5 ]/ }

  43. # p, L8 b$ |9 v! _; y3 o
  44. #ifdef EDMA3_DEBUG! E: W, Y% S- n8 V  B5 d  G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ^& Y" y: f+ F+ Z) a7 T9 Y2 M  U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( K1 W# [2 C8 B( D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 ?4 q9 p$ G; Z# k
  48. #else
    / j8 d6 u0 y$ S& F- O1 O' {
  49. #define DMA_PRINTK( x... )8 n( F  W. m. c
  50. #define DMA_FN_IN! s$ A( m! f7 ?8 P, Q- l
  51. #define DMA_FN_OUT
    * M$ {9 D: [" j( H
  52. #endif
    3 D  K5 Z; V- G

  53. 7 T; P3 q5 K/ w$ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 `3 G4 A! M+ ?' V) N! v
  55. #define STATIC_SHIFT                31 ?2 [0 `* U' ]! |
  56. #define TCINTEN_SHIFT               20
    : s, Y- t3 Y5 A0 |( }1 L
  57. #define ITCINTEN_SHIFT              21) p1 l. }- p3 F
  58. #define TCCHEN_SHIFT                22
    ) g2 \/ l0 D9 U
  59. #define ITCCHEN_SHIFT               23& `3 q) j: |- B2 u- A! R
  60. 9 C# d$ V7 U3 ~# u1 X( n) p
  61. static volatile int irqraised1 = 0;
    % ^( V6 O- H6 c6 i$ M9 q' d
  62. static volatile int irqraised2 = 0;
    " z  J8 S+ e0 w0 A
  63. - l  m+ B* W: v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; D4 J1 Q, F0 i1 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 z& k! T9 W; Z# p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; r9 Q6 x) w6 L7 X9 o8 P
  67. : {3 c  m$ c$ |$ k9 v, H4 t
  68. dma_addr_t dmaphyssrc1 = 0;6 a8 b3 J1 ?3 ], M6 i
  69. dma_addr_t dmaphyssrc2 = 0;& h+ m* x* n3 q/ B
  70. dma_addr_t dmaphysdest1 = 0;
    - Y  ~" j) I7 a
  71. dma_addr_t dmaphysdest2 = 0;0 O( I( ?( D/ |' p2 a- B! R0 |* t

  72. , x# ~. Y5 U# j' G+ u- a* G' y
  73. char *dmabufsrc1 = NULL;. T9 f8 [4 r, ]- d
  74. char *dmabufsrc2 = NULL;
    " P$ C, y! ^0 y: g7 c. M/ S
  75. char *dmabufdest1 = NULL;
    : S: r7 k0 G6 ]/ ]; z
  76. char *dmabufdest2 = NULL;
    8 H2 d1 h; n- S9 Q: d; g% u
  77. 4 K1 M2 n! `0 ?8 g& Y: k1 A" K9 R
  78. static int acnt = 512;
    - ]. I6 B; W' f; Y
  79. static int bcnt = 8;
    8 f1 J% j) T5 b8 R0 P
  80. static int ccnt = 8;. b4 q5 N: W9 `
  81. 7 |6 n! l0 c( l! o' Y! [
  82. module_param(acnt, int, S_IRUGO);$ B/ |5 z' _, I3 W8 v7 s5 ~
  83. module_param(bcnt, int, S_IRUGO);& R: ?& J( D# @+ V- b9 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% g4 U0 @9 R  u' B, w/ l6 O6 r
( }6 m" P5 Y) H0 F- k4 D* ]5 G- ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 K: A. W1 f( H2 v) ~* b8 P+ q: n# T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) K0 c1 r  V& x$ k% O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 b! P( g1 ]$ t
( J+ b) P( I) c  K
1 L5 Y+ P' b9 l% E1 t! L9 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 00:04 , Processed in 0.037881 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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