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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 y; H) j  A- i* _, e5 p/ `. I$ i
  1. [code]EDMA sample test application1 {+ M+ ^# L/ a! K1 b  p
  2. /*% M: {" K3 L1 N$ R/ i" W1 k% Y
  3. * edma_test.c- d9 T9 Q; h3 H5 u$ E. Z. f
  4. *
    6 a& ~9 P" Q( l' ~( g) F: r7 w! M- {
  5. * brief  EDMA3 Test Application
    9 f  w% R. Y2 B4 x# B
  6. *
    7 x5 b$ y+ a( R% T
  7. *   This file contains EDMA3 Test code." g! Y. w' b+ G  b$ ~
  8. *
    0 d8 M! I/ B+ d# K" q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 y5 n' n) a6 U$ R( f% S, I* k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , q% Z3 s) i9 h
  11. *         TO CHANGE.9 {2 j9 L/ l/ G" \% l5 K
  12. *+ u& \8 C! ]* S9 u& K$ F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- R& J# `1 x) j: |/ b2 _
  14. *
    $ R0 @0 [$ l* M5 ~% f
  15. * This program is free software; you can redistribute it and/or
    $ ~3 o& L6 b& r
  16. * modify it under the terms of the GNU General Public License as
    : p! K: T& z- k
  17. * published by the Free Software Foundation version 2.' V% R7 b& b# I; S. u
  18. *( }- T0 N( i9 h5 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 M( ~$ }4 Q& l0 p' K$ a" A
  20. * kind, whether express or implied; without even the implied warranty
    6 {# I; ^3 M3 ]& h& B7 B7 K. i- B4 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " r9 f" M3 d2 J
  22. * GNU General Public License for more details.
    8 }1 Q; a0 n: L6 x! C% g
  23. */  E; A4 \( j( g( F

  24. " j, W) |' Y3 y5 t0 s: C! ?
  25. #include <linux/module.h>
    ! K- \# [  P+ `: L
  26. #include <linux/init.h>
    ' ?1 o, K4 n4 l$ k. t
  27. #include <linux/errno.h>7 E! E$ T* ?$ C* x; W
  28. #include <linux/types.h>6 u  U4 j  W$ B" ~, s: P
  29. #include <linux/interrupt.h>
    / c! T' C! h6 P4 \
  30. #include <asm/io.h>1 z( i* K/ [4 b9 e
  31. #include <linux/moduleparam.h>
    $ z$ Z" H1 T5 c& V
  32. #include <linux/sysctl.h>
    7 r5 m9 b. C2 i' u$ W  l
  33. #include <linux/mm.h>
    % a! o5 N5 h8 b2 v' B
  34. #include <linux/dma-mapping.h>
    ( D, e) q1 n" w% Y1 m

  35. 2 P8 ~% K0 m% P* R. ^# ]' g
  36. #include <mach/memory.h>
    5 K0 u+ h0 G2 R
  37. #include <mach/hardware.h>
    % P9 f  m% G( j
  38. #include <mach/irqs.h>
      W: ~$ T) @# S  k" l
  39. #include <asm/hardware/edma.h>
    0 b, H1 [& [" ?7 B/ h4 Z/ k

  40. * k2 Z2 y7 Y8 j3 o! x4 I6 n9 C
  41. #undef EDMA3_DEBUG
    0 T- {! p- q/ ?- [1 x1 t
  42. /*#define EDMA3_DEBUG*/
    6 \( C5 @4 L9 }$ z' x2 z# |% C! S
  43. " A1 [+ {* i4 V
  44. #ifdef EDMA3_DEBUG% z6 }8 c. N& J6 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), s% w8 B  \& v# j+ o2 c: g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 B0 Y2 ]9 P/ ~3 b  h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * G2 s% c% D7 [3 t
  48. #else
    7 P' b& Q$ @8 H7 P! g0 Y( I( V3 [
  49. #define DMA_PRINTK( x... ); S5 ^# [) @" Z( h3 N% w
  50. #define DMA_FN_IN4 p! G( t! H/ Q; D' }9 o0 D8 _+ h
  51. #define DMA_FN_OUT# t( B6 x5 t3 e3 Q/ D) U+ ^3 V
  52. #endif5 n+ K' N. e* |& }4 O. c, A

  53. 3 I3 L) K  z5 Z6 i0 s4 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; D" E8 D$ V: v
  55. #define STATIC_SHIFT                3! X' S+ I* s+ y; i
  56. #define TCINTEN_SHIFT               20' S# {+ U) A* K1 [; x( c8 c& Y+ v
  57. #define ITCINTEN_SHIFT              21
    0 R' e. G! T* @  _' ]& W, `
  58. #define TCCHEN_SHIFT                22
    5 R6 }" O8 u& U' i2 g
  59. #define ITCCHEN_SHIFT               23  }7 }5 S2 e$ J# ?3 H

  60. / b7 {% p. c( z; W0 n; S
  61. static volatile int irqraised1 = 0;
    7 ]) h* O6 z, _4 l9 I1 s7 K/ y
  62. static volatile int irqraised2 = 0;
    : f/ n$ U& X8 `3 p: \

  63. 1 J6 |, X. V  E3 O: G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s. r' D# H2 k8 I9 |/ @, T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / L+ ]. f5 _, U9 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # o, J+ p2 v; c; E) `! i% y

  67. : l$ k. r: x& U* {/ R
  68. dma_addr_t dmaphyssrc1 = 0;
    1 O) g3 ]3 [$ w3 H
  69. dma_addr_t dmaphyssrc2 = 0;
    + A! H4 \7 _  B1 E* T; l
  70. dma_addr_t dmaphysdest1 = 0;
    $ o0 u3 {8 E2 A4 \( c( C0 }" V
  71. dma_addr_t dmaphysdest2 = 0;9 ~/ G. D8 B- }; \! b9 M8 V& W- A

  72. & P  W) ^& I$ j' {. \3 O
  73. char *dmabufsrc1 = NULL;. b& h9 B6 K" J3 ~6 X, X
  74. char *dmabufsrc2 = NULL;# z2 }, w" Y7 T  c* w$ l
  75. char *dmabufdest1 = NULL;- q' m: F8 E: F7 b7 [
  76. char *dmabufdest2 = NULL;% e8 O$ l- l/ s- B
  77. ( c4 N& ?. o. |& K7 D
  78. static int acnt = 512;+ k! P+ R, D" v5 O& |8 q9 N
  79. static int bcnt = 8;1 ]) U1 X7 l9 G
  80. static int ccnt = 8;$ e. g: h% N0 }7 R8 K3 i

  81. " b. L  T; T2 N, Q1 x
  82. module_param(acnt, int, S_IRUGO);7 T% d: p3 a( E, s3 ?2 @
  83. module_param(bcnt, int, S_IRUGO);% [: G2 _& P# n9 ^+ e( j/ k( V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ v3 |- }0 y$ @/ \4 S$ x, B  Y9 c
4 n# `: S1 t2 T/ G$ i, E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' W* H! N3 a3 G$ w2 J9 v0 h4 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& b1 R/ I0 _3 ^/ F; ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' d2 {( G1 M) P5 y3 ]' P
7 u# y7 E$ v) _' t: _! ?2 r( h. I2 Q8 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 02:36 , Processed in 0.041446 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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