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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Y3 ]" L( {, ^
  1. [code]EDMA sample test application
    8 n: {1 l9 @) ~+ Q) o
  2. /*
    ! F% b) t, V% G  y
  3. * edma_test.c
    9 o" ]) O: P% J+ T( G
  4. *
    ) B4 E6 |2 _& U! I* E* P$ W
  5. * brief  EDMA3 Test Application
    : v5 `* R% [. [
  6. *3 {1 p# m  U! i1 j* ]/ x7 z
  7. *   This file contains EDMA3 Test code.
    $ a2 B% {6 E3 C/ ^$ T
  8. *" H5 u8 O$ [/ g9 c/ [6 q1 Z6 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & B1 G7 k' p$ p& e# W. T' l( ]1 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* U) g: p6 Q5 C! y1 s
  11. *         TO CHANGE.
      t* o  Y* g+ P, ]0 y& ^
  12. *+ M5 g5 u( B: Z- |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 @, h# M2 G/ N3 i
  14. *
    , S  g7 ?* W/ W2 ], ~
  15. * This program is free software; you can redistribute it and/or
    3 a$ L- o6 Q1 {
  16. * modify it under the terms of the GNU General Public License as
    , N& G9 e0 P' Z4 d
  17. * published by the Free Software Foundation version 2.
    4 R7 o7 K1 T8 V$ p0 q  ^
  18. *
    , F3 i5 F1 J* Y$ f5 g, t' X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" J$ v# o# ?; y
  20. * kind, whether express or implied; without even the implied warranty
    % _. u3 `% z# Z' t6 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 F$ d9 z' ^9 u% D' g4 u
  22. * GNU General Public License for more details.
    ! Z) d7 w- d8 o6 t; H; _  w
  23. */
    ) [" t/ F% q$ Z  @/ y8 H4 M
  24. & o8 w& }1 B; A2 z' \
  25. #include <linux/module.h>( m! h: h  q3 b- j% o
  26. #include <linux/init.h>+ T6 F- L( d* g5 R- l3 C' l# @* c
  27. #include <linux/errno.h>
    8 Q/ M8 F3 }& H, c0 p: H
  28. #include <linux/types.h>
    & p' ^' J4 Z1 G* V4 ?9 d6 t
  29. #include <linux/interrupt.h>
    / [, X( ]6 }1 B3 C
  30. #include <asm/io.h>
    ' r; ^* C) l5 P/ ~0 |/ c
  31. #include <linux/moduleparam.h>
    8 _9 @: S- O4 ?9 R* W- H7 E
  32. #include <linux/sysctl.h>" f, I. W% x+ i9 b8 K" b+ {* f& W- l
  33. #include <linux/mm.h>
    3 ]. m, b$ @3 {# i
  34. #include <linux/dma-mapping.h>. n8 j" p5 E5 q) u$ z$ o9 z
  35. 0 r, F8 S& R( y+ B+ C
  36. #include <mach/memory.h>$ Y1 ?1 @/ H# Z; j6 C4 i
  37. #include <mach/hardware.h>- l, ~% c  m' J" X1 o' Y( C
  38. #include <mach/irqs.h>1 ~& n1 b- L3 _9 Z9 u- N+ J
  39. #include <asm/hardware/edma.h>
    , Q2 h* B. k+ O; o6 S( U2 e; c
  40. - a% i" g& f3 ~7 u5 c
  41. #undef EDMA3_DEBUG, S) n+ X" G* \& i1 F
  42. /*#define EDMA3_DEBUG*/( G6 H" R+ {* j- E. b
  43. + H4 E9 G( ?0 t$ x0 l5 ^  u% j
  44. #ifdef EDMA3_DEBUG& X* Y, L, ]5 u( r& U4 O; O3 ]& D& T% J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! m' j. {  j) T: k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . ]/ ]9 J, t5 E$ j2 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ^" g9 S2 S2 Y3 j& G, R
  48. #else& x5 q; `! E. X& v
  49. #define DMA_PRINTK( x... )8 m3 y  D% {7 j5 \- Y6 a1 x
  50. #define DMA_FN_IN
    2 e1 W" ~- A6 A% G" M
  51. #define DMA_FN_OUT
    + Y' r  q9 O# ]8 M( E5 j9 X7 ^
  52. #endif
    4 T& p' u# \2 C5 H/ s. x- H* j1 t

  53. ( s, h, u! A4 z4 \: v7 x, M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ `$ y0 i0 p2 Z1 \  G5 T
  55. #define STATIC_SHIFT                3
    1 b& X8 k9 _1 ^( _+ F6 m1 E' Q
  56. #define TCINTEN_SHIFT               206 Q1 B3 q9 I. s2 ?, Q; R- U
  57. #define ITCINTEN_SHIFT              219 u& p! N, O4 s! |. Z9 \
  58. #define TCCHEN_SHIFT                22
    . r) o5 @. a$ f( V0 K4 n
  59. #define ITCCHEN_SHIFT               23
    8 [" Q; e* Z. C7 X

  60.   `9 F& V$ B+ P, Z- Q9 M* O  k8 a5 G
  61. static volatile int irqraised1 = 0;* y" g5 m3 _. }- D
  62. static volatile int irqraised2 = 0;
    : ?5 z& _8 q! Y0 q* w
  63.   U6 ]+ y6 A. v& }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - p# t1 X7 {! J' Z( G: l. a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# q9 _& j% u' N* a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; c0 u: [/ }/ x( D3 v$ c% o

  67. 4 p: O9 l, \' w$ k
  68. dma_addr_t dmaphyssrc1 = 0;4 _' m9 _2 @4 f3 K
  69. dma_addr_t dmaphyssrc2 = 0;
    8 y7 H. x% b+ r3 O: u) Y
  70. dma_addr_t dmaphysdest1 = 0;
    2 p4 B5 h8 V/ h7 x* f& y# T
  71. dma_addr_t dmaphysdest2 = 0;+ o+ W4 d! u! P2 _( V
  72. 8 N, g, i8 S; \
  73. char *dmabufsrc1 = NULL;
    5 L9 q4 x; T# y3 I4 }
  74. char *dmabufsrc2 = NULL;
    % |3 F# C! I, L) i
  75. char *dmabufdest1 = NULL;9 g" i0 T& \9 I( i# k  d
  76. char *dmabufdest2 = NULL;( [" o6 P+ m% j! W- o! O4 ?$ W7 G9 e

  77. / H3 |* ^0 w  i: i) W% D- i$ M
  78. static int acnt = 512;
    9 ~1 P4 F& N& A' k( m# E
  79. static int bcnt = 8;
    ; R$ q( ?5 ?! w
  80. static int ccnt = 8;9 ]- f9 P2 c0 w( s- p. M% f( _) z' j
  81. 3 A; |; F, R# z
  82. module_param(acnt, int, S_IRUGO);
    / W8 b) N6 X, [2 J
  83. module_param(bcnt, int, S_IRUGO);7 ]0 F+ `* s; d" [( e, Y6 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 `/ B! w- z* Y3 e* g+ d! k" S4 ?* Q6 b) ]+ D3 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 j1 M0 ^8 E* L$ |* J, @% Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ {- C. Y8 |, ?+ [9 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. ]7 `4 C; u4 F
2 \$ R4 S' \# e

( w+ O) O! p) u* g2 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 23:36 , Processed in 0.039295 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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