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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, }( \( z( g7 m# D3 G
  1. [code]EDMA sample test application8 c( S  h3 d0 \; F6 ^
  2. /*) f+ P2 L9 h( D7 x4 R+ ?: J
  3. * edma_test.c
    3 l3 p( ?# D: n. w7 A1 J2 P
  4. *
    5 r) L) K. p% A. d- v/ O8 h" e
  5. * brief  EDMA3 Test Application
    7 L" L. e# E' C5 Y% _. d
  6. *
    9 \  `: w; M/ A6 }( H
  7. *   This file contains EDMA3 Test code./ J1 ~6 t1 p% H- a7 z# e
  8. *9 p$ v0 R0 d7 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ~1 C! z8 f0 o) ?4 g8 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( ?0 C' }' ~& u/ X& ?  [' V3 ~
  11. *         TO CHANGE.& k0 Z9 j1 M3 O- Q! ?
  12. *
    % Z, {, g- @4 @, M9 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      c& b9 b  z+ F7 [* P9 z% U
  14. *
    / @7 o0 f2 L$ Z9 U7 q7 w
  15. * This program is free software; you can redistribute it and/or
    / I! J4 [0 {% F  W# N3 P2 `2 H
  16. * modify it under the terms of the GNU General Public License as) ^! E% ^; {- ]1 X
  17. * published by the Free Software Foundation version 2.
    ; c) z8 k' R7 Q+ _
  18. */ C% F9 r5 F5 I3 [( m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 B+ A/ t% |/ Y
  20. * kind, whether express or implied; without even the implied warranty
    # N; R0 R/ s" f+ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& Y/ I) h5 U8 a
  22. * GNU General Public License for more details.
    $ z' K% {- O9 f3 V' h
  23. */4 g5 R# t9 w- B0 T2 \/ u$ r+ e  W& E' h
  24. - G" l' |( R( h
  25. #include <linux/module.h>
    $ Y& r, M( v$ o: }0 I
  26. #include <linux/init.h>6 i' N* {' G3 i
  27. #include <linux/errno.h>  N0 a6 f  G( J8 s0 }8 X' w
  28. #include <linux/types.h>
    ; n  h' q$ [& z
  29. #include <linux/interrupt.h>
    ) b& N$ c( p6 H3 S6 h
  30. #include <asm/io.h>; x; D# z3 h$ f! Q; J
  31. #include <linux/moduleparam.h>
    / W  M& f1 J5 B/ {
  32. #include <linux/sysctl.h>$ A8 r2 q6 K$ U! f7 Y
  33. #include <linux/mm.h>! N; i1 t& k4 J! O% M) [. C6 `
  34. #include <linux/dma-mapping.h>3 i+ G& ~; a' F2 a- i2 u; a
  35. 7 G. R$ q; s& u( h: v
  36. #include <mach/memory.h>
    3 F( [$ x7 b2 n
  37. #include <mach/hardware.h>$ R" R, {- E3 O* I, y( k( u$ C( |
  38. #include <mach/irqs.h>
    # J) m+ e0 F3 j. E* q# [
  39. #include <asm/hardware/edma.h>& S5 O. N+ [; u4 E$ c! O9 f1 L$ ]
  40. * {0 E& j2 `3 b8 R! l% O" C
  41. #undef EDMA3_DEBUG
    0 Z, J. U4 C2 f, Q" M# e
  42. /*#define EDMA3_DEBUG*/4 A3 I+ c% E9 o- V
  43. 7 T5 ?0 R" {7 {6 E  K
  44. #ifdef EDMA3_DEBUG
    ( f$ |, \( E, X( u0 J+ a5 }) l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- e, i2 ?8 T7 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ \- I- Q; G! w1 _4 D% K" S! V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + S$ u+ Q9 d% @5 h- v" ~6 A
  48. #else
    " M! p* s$ b/ V7 @! v
  49. #define DMA_PRINTK( x... )
    0 N: A& s4 v/ R5 {$ Q! k
  50. #define DMA_FN_IN
    7 u7 i. C* t/ M  c7 c- B
  51. #define DMA_FN_OUT. |9 p/ k  R) Y
  52. #endif% h8 A* E* w) C! n% ~8 K

  53. ! q3 m% Z5 V0 f/ B. B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" J# d, o  C' l' U4 ^9 M
  55. #define STATIC_SHIFT                3  t4 }" i- g4 L( _
  56. #define TCINTEN_SHIFT               20
    . U0 B0 U! J  J+ t8 w# `8 c2 \
  57. #define ITCINTEN_SHIFT              21
    / O- v' }2 a1 N" A; b  h
  58. #define TCCHEN_SHIFT                22' E: X+ z1 O/ t* {% K# M
  59. #define ITCCHEN_SHIFT               23/ |# Q' R2 F- e. d; ]& m$ g
  60. - {7 c; |( b8 o+ Q
  61. static volatile int irqraised1 = 0;
    ) ~2 s1 F+ g8 z9 [: t
  62. static volatile int irqraised2 = 0;5 @& X5 C1 W$ t/ L& b7 Y! |4 J
  63. 7 m4 Q7 O7 ]5 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 `) Z  S' k: T$ u5 c4 Z* n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 V) m: p) ]* ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }7 ?, R5 _9 C1 P3 Q
  67. ! k4 I2 \3 {$ l/ t% ]
  68. dma_addr_t dmaphyssrc1 = 0;
    $ `4 }7 }- K! Z, P& ^! \1 L! a0 }
  69. dma_addr_t dmaphyssrc2 = 0;5 G; s" ~' E4 j; i/ P' }1 P* `1 h
  70. dma_addr_t dmaphysdest1 = 0;9 n+ E9 E) W9 h3 E% u8 @( k& `$ W5 d
  71. dma_addr_t dmaphysdest2 = 0;
    / Z- I& F$ ]0 k& |- C) F
  72. 7 ?+ H2 F9 [$ {- L; e1 @1 P: [
  73. char *dmabufsrc1 = NULL;% u  y' ^$ e8 c8 v" b6 T# P
  74. char *dmabufsrc2 = NULL;
    % @0 G6 |1 k" s2 T
  75. char *dmabufdest1 = NULL;" R3 m0 L0 y9 K( E4 g
  76. char *dmabufdest2 = NULL;
    / d3 Z) j1 x& P" I. w. |

  77. 0 z& C: V! v0 W: q# U
  78. static int acnt = 512;8 o3 F6 g+ X" X+ Y# v
  79. static int bcnt = 8;. m: S5 t( e* _) ^
  80. static int ccnt = 8;
    / Z- ]# y! T& A' d' Q) q1 W7 J

  81. 7 ^/ y8 S& {3 q
  82. module_param(acnt, int, S_IRUGO);$ E* U9 ^9 S8 X$ j2 x
  83. module_param(bcnt, int, S_IRUGO);% L, i" M" O0 D" l! y) p! i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- @) l/ P2 z% y/ @" T* B: M  _# c- L$ G2 Z4 {/ [! I3 O4 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" S% X# [# a% T0 J! q4 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 p( K8 z; E0 k/ ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 A. C1 L! A2 d  W: O
/ I2 M) t8 g$ W; l0 Z

$ w4 Y  i! ], H  l( i- f4 G7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-19 15:56 , Processed in 0.040398 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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