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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; P& D. v0 X- |$ C
  1. [code]EDMA sample test application  N7 B+ v+ A. [3 a, K
  2. /*
    - c$ {4 M5 J( b
  3. * edma_test.c5 L' l7 W3 Z& D7 x6 X
  4. *
    . _) j  C* w! x, ?- L( N. X
  5. * brief  EDMA3 Test Application
    9 i. d9 z. o9 h
  6. *
    + P2 L/ \; j- f  [
  7. *   This file contains EDMA3 Test code.
    # }' o- v8 `; y
  8. *
      @5 d$ A: m/ P" S* f, _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 M  u, s3 C$ h  l: ~7 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" z4 \, S( N# G) B! n! A2 _
  11. *         TO CHANGE.
    % ^' m5 l6 U  J# y  B# ?4 T$ Q
  12. *
    % D, G7 V& k& q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 u4 V0 M/ H0 T
  14. *
    6 j7 \- f; e& V1 [8 P
  15. * This program is free software; you can redistribute it and/or
    ( {$ ~0 b8 p, a: `$ ~2 ~1 j4 ~3 y
  16. * modify it under the terms of the GNU General Public License as
    0 K$ n$ W" I/ D, `. B/ d# j
  17. * published by the Free Software Foundation version 2./ c/ B, b* w2 |6 I& p& f& z4 a7 p
  18. *
    ) e* U7 A/ \; g$ s% T9 h* Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, b7 P' A3 c" S4 Y
  20. * kind, whether express or implied; without even the implied warranty
    1 {- q# G  n# j: `5 y( D6 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : M8 ]5 A9 }9 O9 t/ b
  22. * GNU General Public License for more details.: D+ l9 J0 Q! w, M  |2 L& _
  23. */
    / y) x1 X3 A. f2 }) e' p

  24. 9 C: d6 c; J0 W1 ?% H) q
  25. #include <linux/module.h>
    - E' |4 V8 C6 d
  26. #include <linux/init.h>
    2 [3 L1 ~9 g  d4 w- o/ `
  27. #include <linux/errno.h>
    8 z7 o* w4 x' w9 m  E' \( R4 F
  28. #include <linux/types.h>  U8 u4 }; W; j+ z! X, P
  29. #include <linux/interrupt.h>" B8 P* K  B1 V' _; e) i
  30. #include <asm/io.h>) q6 f0 d+ Z. h8 K
  31. #include <linux/moduleparam.h>
    ; U/ s6 J! L" k* R9 _; @8 [
  32. #include <linux/sysctl.h>
    0 i" p# V. @# K0 J9 Z. `2 ]
  33. #include <linux/mm.h>( Y' N0 X0 k) F0 y( ~' Q
  34. #include <linux/dma-mapping.h>+ U5 y5 K, H3 s* o0 k, s% [

  35. " R) b0 R2 ]2 J0 S  e" `
  36. #include <mach/memory.h>' ?5 j9 g( q3 l8 ?5 q
  37. #include <mach/hardware.h>1 |7 @: D  U  i6 b  G7 C
  38. #include <mach/irqs.h>3 w( b+ p5 m) R6 K1 x
  39. #include <asm/hardware/edma.h>
    : {+ V! e' [) f& j# \+ W
  40. ! Q; V+ U. l& k5 W. j
  41. #undef EDMA3_DEBUG
    5 g( H2 m8 v+ J0 ]
  42. /*#define EDMA3_DEBUG*/
    3 f/ M; N: i( {7 L& W- {
  43. ! N5 _3 C! M+ z% d* p
  44. #ifdef EDMA3_DEBUG
    % \' T6 T# t$ X5 y5 I3 K2 e3 C. n5 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), _9 W+ B: N: Z! r4 R5 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ d7 L  j/ b; h% }3 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v! j" q4 e; Z1 d" y0 @; N4 i' B& E
  48. #else
    ( Q! n( z3 b4 F# u+ R9 u
  49. #define DMA_PRINTK( x... )$ {9 c! V# e% N9 E
  50. #define DMA_FN_IN* f' i. u1 D" z/ S' y( b
  51. #define DMA_FN_OUT# D2 P: y/ p9 @$ _
  52. #endif2 r, B7 H7 g) V! ?0 P
  53. * f, K$ ?1 _# B8 B6 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 w2 H3 |, |1 X/ ~6 r. i
  55. #define STATIC_SHIFT                3$ F  w0 P' i/ Y% U1 Q! B( d0 e
  56. #define TCINTEN_SHIFT               20
    7 ^6 @. c( u! w' k1 M
  57. #define ITCINTEN_SHIFT              21, m- f; N0 G% q
  58. #define TCCHEN_SHIFT                224 }5 o5 n7 y% z0 p. k
  59. #define ITCCHEN_SHIFT               23
    / j% a5 u8 `3 ^0 I
  60. ! l  p6 y. l# [2 V( D- D
  61. static volatile int irqraised1 = 0;
    1 O' L0 X2 E4 S' C; ~: N
  62. static volatile int irqraised2 = 0;
    * P; Q" W9 c2 u- j6 R4 y& t

  63. 8 Q3 D4 p' e4 m  o4 x, C: l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ?5 W! h1 N6 l: S; f9 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 [( M2 Y. f* _0 `7 `9 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! d3 y! P& K; |2 L; H5 g
  67. ; M) A. Y( c3 J0 Z
  68. dma_addr_t dmaphyssrc1 = 0;, J/ P( k. {, k
  69. dma_addr_t dmaphyssrc2 = 0;
    4 c5 z6 T3 J" T& z9 z
  70. dma_addr_t dmaphysdest1 = 0;6 @( Y0 z$ I6 F$ B
  71. dma_addr_t dmaphysdest2 = 0;( ]$ J% `( [! T- R% [$ n

  72. , e2 ?. x5 e$ T! c$ T
  73. char *dmabufsrc1 = NULL;8 w% p5 M  J, B2 G' {3 I( }
  74. char *dmabufsrc2 = NULL;6 `+ Q9 V) f. c0 ]/ O
  75. char *dmabufdest1 = NULL;: z# d: o# K5 n" x8 f
  76. char *dmabufdest2 = NULL;, ?+ z6 u5 ^  j* ?

  77. * K, O, D. Q6 {3 a: T
  78. static int acnt = 512;
    ! d1 Z6 m$ z* L4 `/ X
  79. static int bcnt = 8;
    & [! V) z1 c4 Y( Q% t& h5 Q' e
  80. static int ccnt = 8;
    7 J, E( P5 J" i% @2 R* {. g; @# g
  81. 7 N3 C) J7 s7 O6 m
  82. module_param(acnt, int, S_IRUGO);5 _, W  y* ~4 f# L! d
  83. module_param(bcnt, int, S_IRUGO);. z( y9 i! K! G5 }" p7 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ K# @. V; q1 L% R  M6 C# F

& j/ e. L& U, W) P, j2 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* H! c) ?' x6 {7 A1 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 l8 ^1 ?# x; q$ |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 A+ u# a7 X+ r9 Z: l  S& m
* ^6 I+ a5 B  |" q0 g
- `0 e/ b  w' P% O7 P" d9 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 08:10 , Processed in 0.041081 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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