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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) N8 U3 ~' I2 i2 `
  1. [code]EDMA sample test application( S6 E; |# w$ P# B; |
  2. /*3 I$ A4 @6 ^7 I2 A
  3. * edma_test.c
    # A4 s/ S' g7 g1 Q% f1 w, l
  4. *
    - o0 R( |; k: G( h+ j- Q) z
  5. * brief  EDMA3 Test Application
    , a3 o% w8 Z: a+ J
  6. *
    / ^1 ~0 h, Q2 v5 t3 u
  7. *   This file contains EDMA3 Test code.
    ! E8 u/ r# M) l! U" L8 R) |. ~* w
  8. *6 @/ H4 h% b! Z3 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 Y5 @& E/ K& M2 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 ~( P" f& Y; s# \, h
  11. *         TO CHANGE.
    ( F0 f4 I: i: d5 F3 x. }6 X
  12. *! ?0 K) d2 T" x, F* `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: w. n. T0 i2 V( p- V: W+ M) Q8 d
  14. *2 t/ g3 e& q6 p7 s5 u1 \; F* n
  15. * This program is free software; you can redistribute it and/or
    & y# U1 Y0 U2 [  [  K
  16. * modify it under the terms of the GNU General Public License as6 m9 R5 p. R) R# j
  17. * published by the Free Software Foundation version 2.: P# K1 U" S5 Z5 c, A! ~
  18. *0 g( N. @  T( T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ n8 V1 h6 o3 H% |) r9 Z3 A
  20. * kind, whether express or implied; without even the implied warranty
    + o% i% `. H! J9 W  o! b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 E+ W; d1 V, W  A4 o
  22. * GNU General Public License for more details.
    " T; M/ V# d$ H5 N7 r& K5 l) ^: c& `
  23. */
    9 t1 Z& L( K) e, D& J2 O# b- \; z6 R

  24. " v8 K( P; a5 S& S' |7 v
  25. #include <linux/module.h>4 I8 u" R! U/ k
  26. #include <linux/init.h>% U5 G4 j! z6 L; o! s
  27. #include <linux/errno.h>* o' r5 k9 E# |* s. Z
  28. #include <linux/types.h>
    & a# m' K, `$ {( W$ l
  29. #include <linux/interrupt.h>
    . G$ |( m% {' Q) W6 J' b
  30. #include <asm/io.h>
    ( S' X0 P/ G( O* Z1 ~3 a( I' |1 i
  31. #include <linux/moduleparam.h>7 S+ O1 l7 m; e3 f5 I# z+ ]
  32. #include <linux/sysctl.h>
    . c. [' T* U% d" ~3 d
  33. #include <linux/mm.h>
    ; `/ V8 U( z$ D$ r% @; S
  34. #include <linux/dma-mapping.h>
    % O. G; P; g# Q9 g

  35. 9 g* V. \: Z6 J) ?# |- r
  36. #include <mach/memory.h>
    ! h* I3 a" G7 P& R. l7 _
  37. #include <mach/hardware.h>
    % D/ @. G0 @. V2 t4 b+ [" ?; |0 t
  38. #include <mach/irqs.h>
    / g2 d& F, t; h  ^5 P. A; j
  39. #include <asm/hardware/edma.h>% Y' a  G* [1 Y% z, p; X/ d

  40. $ Y+ b& J2 P& u$ }5 Q* q) x, L
  41. #undef EDMA3_DEBUG# B8 W# a: k  r, e# @
  42. /*#define EDMA3_DEBUG*/. F- Z9 v4 y& b! k" |" [6 w, [

  43. " o& ]: M0 C/ K% T- Y
  44. #ifdef EDMA3_DEBUG9 S' o3 f* G4 Y7 I  w1 \0 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) L$ ?1 f9 t8 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * {# T6 T/ s1 L9 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ^$ i( Z5 I0 I" ?( v
  48. #else
    6 X) Y  x# d: ^( _& j3 `
  49. #define DMA_PRINTK( x... )
    5 k; w0 v+ z  H5 j) z; L
  50. #define DMA_FN_IN
    * @# U+ Y% A' p1 D+ \: B( T* Q1 D
  51. #define DMA_FN_OUT# U; O; S/ {0 Y. C* E; q8 `1 `2 L
  52. #endif
    + Q1 c& Y/ z: g- w, ~5 z, g
  53. & a  X( J6 Q+ U+ Q' N9 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : f; G" l2 _2 x+ J3 ~: s" c' s) U
  55. #define STATIC_SHIFT                3% c. }8 ]4 @$ k/ B+ x3 c4 U
  56. #define TCINTEN_SHIFT               20) A5 m, g/ I4 s4 k8 o8 t
  57. #define ITCINTEN_SHIFT              21
    * U! F5 z8 G4 p' p
  58. #define TCCHEN_SHIFT                22
    ( i6 r6 ]9 o( g0 V, O
  59. #define ITCCHEN_SHIFT               23+ g) K/ D% _; c  J

  60. ; B) I: B# w" q0 z; I! V$ l" u
  61. static volatile int irqraised1 = 0;0 I' M8 c+ O2 P% ~+ O! V
  62. static volatile int irqraised2 = 0;4 Z9 s( o1 c: a1 b2 f8 d

  63. + ]# K+ Y3 w: X1 G+ I8 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o3 \4 W! F. e0 E6 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 y! p9 s/ z# s; I  d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ]* \% g8 b- B

  67. / W+ b6 o1 Q9 v6 E6 f
  68. dma_addr_t dmaphyssrc1 = 0;& |9 _% t) N3 Q+ J: p8 W
  69. dma_addr_t dmaphyssrc2 = 0;
    ) G3 ?5 ~3 G$ e) w8 y3 A* A7 x  Q; n
  70. dma_addr_t dmaphysdest1 = 0;' o0 k! W  U4 L
  71. dma_addr_t dmaphysdest2 = 0;
    7 P6 N2 `5 W8 j& o
  72. 8 D+ V; K! W' X, F- W% B
  73. char *dmabufsrc1 = NULL;2 b8 h: b0 Q# }4 w' a" q6 w: R# Y
  74. char *dmabufsrc2 = NULL;
    & u" n8 P+ r# E  M$ j
  75. char *dmabufdest1 = NULL;
    0 R6 K2 u- c5 i; i4 j7 R
  76. char *dmabufdest2 = NULL;
    / u& L8 l, Z1 F% X
  77. ' U! t+ N! o, ]/ q1 }' V0 j  W
  78. static int acnt = 512;
    + c- R7 T5 }; Q( w& ~) g
  79. static int bcnt = 8;
    + y3 X9 d. i3 n7 X4 \3 m. f( \
  80. static int ccnt = 8;
    ' f% }8 X/ p4 a+ ~5 z1 r& ]! n1 g6 X

  81. ( F% k% z* u8 r
  82. module_param(acnt, int, S_IRUGO);. P  W# T) x" H$ C6 Z1 h
  83. module_param(bcnt, int, S_IRUGO);
      `  m( |/ T( p7 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 Y7 R/ G3 y9 @( A
8 m5 y  f% ?! C( }; K# v" E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: f: b! T: y% l  R' H3 e0 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ H  P& Q  M  [7 v! S4 O. V  l7 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* l* r' g6 t1 @4 j3 s' ?. Z; X+ c! _; s: ?' O  f$ y- i4 ^! H1 K, w( W1 b
+ ~" E9 j1 G& K; v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 02:25 , Processed in 0.039493 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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