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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 s9 C" P  g% ^4 S# Z
  1. [code]EDMA sample test application4 M* T* E$ Q0 o; Q0 ~* M$ o. E" H
  2. /*
    ( _/ K7 u4 H, T
  3. * edma_test.c
    & D' d/ ]7 g2 ~
  4. *
    ; S$ Y9 E9 Y, h* a
  5. * brief  EDMA3 Test Application* d$ ?. y# R' U# @
  6. *# I% _: C2 e  N6 Q) C$ K
  7. *   This file contains EDMA3 Test code.5 C1 S0 t8 C, z% _) V! r9 Z0 c5 |
  8. *
    # T1 d- b& P/ |! l" w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , l  H5 a) S. G7 `* `& n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 L6 {% Q6 ~4 O
  11. *         TO CHANGE./ B# G! J+ R) k. J& C1 j8 M9 {
  12. *# i4 z* Y( ]7 q7 b$ M6 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 O0 {3 q9 l, k0 F% r9 @" c+ V
  14. *& l" |  N6 u) r, p$ I% t4 ^- C
  15. * This program is free software; you can redistribute it and/or
    " b. Q" W/ l$ [, G, Z1 D, t
  16. * modify it under the terms of the GNU General Public License as
      ~5 T5 P: |- O' Z9 d, X+ U
  17. * published by the Free Software Foundation version 2.
    7 K3 Y3 z% L) c6 G' R
  18. *. b! g1 f4 f$ v8 I4 h1 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& t% q5 ?7 Y: }& A" v, j
  20. * kind, whether express or implied; without even the implied warranty3 `- w, r0 Z" W4 J+ B! G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: y/ X6 {' V3 k, K- ?
  22. * GNU General Public License for more details.0 B# e* o" a( R8 l! p
  23. *// T+ y; P" E) E4 o4 C, z. X9 H

  24. . s. j2 \, C$ m- X' j" g
  25. #include <linux/module.h>
    / H: g9 p# Q! E& s
  26. #include <linux/init.h>
    : g; b1 U/ M8 p& Y5 n0 U
  27. #include <linux/errno.h>, J6 C0 O9 F- `. \
  28. #include <linux/types.h>) b. }$ I9 b6 K, P4 O0 H# n! H$ H+ S
  29. #include <linux/interrupt.h>
    0 w9 P0 I5 A: H  W) E
  30. #include <asm/io.h>* l+ ^9 |; I9 Z" w* i
  31. #include <linux/moduleparam.h>: j2 R- f) b$ R( B3 M
  32. #include <linux/sysctl.h>
    $ [: ^. r8 m% A7 s* y4 q8 d
  33. #include <linux/mm.h>
    4 E- }1 u7 d  F& _0 H) T( E
  34. #include <linux/dma-mapping.h>
    # y! Z2 z! c8 [/ S
  35. & P, ]" M7 x; S, G# X& K
  36. #include <mach/memory.h>
    : Z! g+ @; i# Y: F
  37. #include <mach/hardware.h>: [" P& c: e( r
  38. #include <mach/irqs.h>
    ' d2 ^: V# g3 p7 d4 c1 |# X
  39. #include <asm/hardware/edma.h>4 S, |9 u# r: Z. l  U
  40. # m* C4 q0 r) M+ P% l
  41. #undef EDMA3_DEBUG/ h$ Y( }: @! s; f  h2 }3 |
  42. /*#define EDMA3_DEBUG*/
    9 g" y2 k% ^( [; T/ A
  43. ' N/ C/ Y6 F  @. h( C& p
  44. #ifdef EDMA3_DEBUG' i% ~! L4 x# |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ?  M2 C7 _) t+ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : [) w+ |! L7 S2 @( u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 h6 Y8 ~6 _5 B/ K: A! ?
  48. #else) Q! `5 m/ M0 j% z2 q7 u6 `
  49. #define DMA_PRINTK( x... )
    2 h  R+ G' S3 s  r
  50. #define DMA_FN_IN
    $ z! O8 B" b* \$ S( v
  51. #define DMA_FN_OUT
    ( R/ p- x* `5 h+ s- X$ d
  52. #endif
    ; E, [$ A3 `5 I9 \/ L( A

  53. 9 ?6 y8 B4 w& I, L1 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! Y: i0 z, K( {9 B
  55. #define STATIC_SHIFT                3
    $ d- S; u2 p4 }5 D
  56. #define TCINTEN_SHIFT               201 `* t8 q  M4 P' o
  57. #define ITCINTEN_SHIFT              218 b$ P8 w) z& p: ]$ _( t+ _1 g! v
  58. #define TCCHEN_SHIFT                22% M0 @  p) M% d$ A
  59. #define ITCCHEN_SHIFT               23
    & p; J  }# F0 {: V" P: O9 k$ B5 S* e' L
  60. # S- u- X2 Y/ N! O: v; u+ X
  61. static volatile int irqraised1 = 0;
    4 |# R9 ]8 G7 ~1 H) T
  62. static volatile int irqraised2 = 0;
    ! N1 J0 r' H/ P) r& K( V4 ^

  63. + j4 O( x& {9 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m, e) }) V2 h5 o; m# O+ l9 Y7 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X( z7 S/ K5 J  d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( @8 W  y  Z1 N* i3 u1 c$ K

  67. $ t0 c/ q4 ]1 Z1 q6 p
  68. dma_addr_t dmaphyssrc1 = 0;% p1 u( U& b5 ?8 G! |
  69. dma_addr_t dmaphyssrc2 = 0;3 P4 Z# f; L  E
  70. dma_addr_t dmaphysdest1 = 0;
    ) s: T$ b0 P- h) e
  71. dma_addr_t dmaphysdest2 = 0;
    ! Z, Q! h4 q. E! I1 y$ ~
  72. : e' D+ T4 d3 s% v! v2 J
  73. char *dmabufsrc1 = NULL;2 _( ?6 g2 f/ {# F+ u
  74. char *dmabufsrc2 = NULL;: _1 c4 q" E# K
  75. char *dmabufdest1 = NULL;
    1 _. o  K% Y: F( _$ J
  76. char *dmabufdest2 = NULL;
    + E% R1 z# b% p
  77. 5 E" G6 y# ~/ |6 c) {" H$ F# n" w
  78. static int acnt = 512;2 R- W7 A) x& R; h1 p% |
  79. static int bcnt = 8;) K5 L1 V0 h. i. `4 o0 m" S3 |0 u& ^
  80. static int ccnt = 8;
    6 S; R) Y  o& k  b9 m
  81. - L( P( x5 h. W+ r
  82. module_param(acnt, int, S_IRUGO);
      M! R6 Q, o% j1 W6 ^
  83. module_param(bcnt, int, S_IRUGO);
    1 j% J- J# z) m* M4 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! D1 z. ~, S3 V' A! T. z9 S8 H

% q% n8 f7 G) A' l" w' h  b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 w9 p; b* O& p5 Q+ k4 t; h- j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  y0 z3 h1 D" O$ R; P0 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 u; O' m$ M9 u) o- {4 g

7 N2 v: K8 r4 F) K
" C) _: n! Y" f0 l: _% ?4 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 11:22 , Processed in 0.042938 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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