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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% g& S3 X; W- j) ~- C
  1. [code]EDMA sample test application4 A8 D& @% E9 s
  2. /*
    / ~! E0 e& p6 V# x" L
  3. * edma_test.c- F1 r2 T" i  r2 B" J! U+ g- e: Y
  4. *  O. |; y5 K! U3 ?
  5. * brief  EDMA3 Test Application2 D7 D+ g. M; ?0 f
  6. *
    3 V( m" s2 Z- A  s6 j3 ]
  7. *   This file contains EDMA3 Test code.
    ; Y* {4 M$ z* D0 }' w8 [& {5 m0 H
  8. *+ M( X! L4 L  Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( k; p8 P5 F5 ]0 s. X/ e3 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i, q9 z# C# o) ^) m
  11. *         TO CHANGE.5 G# M+ h; m6 H7 p0 Y; M
  12. *  o+ d$ e7 I0 ^/ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 I. `! i7 s5 v1 B0 |* v" r3 z+ }7 a- E
  14. *
      k) G7 W6 s* H# a; E6 U7 |
  15. * This program is free software; you can redistribute it and/or5 y- Z' Q1 x/ d+ h
  16. * modify it under the terms of the GNU General Public License as
      O! |1 G0 q1 ^8 L- \( U4 V- l
  17. * published by the Free Software Foundation version 2.
    ( m* P$ H5 W1 b6 q
  18. *
    - p3 `" \# u+ b( R( R& |4 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  g: u: J6 N; L. s0 l% Q
  20. * kind, whether express or implied; without even the implied warranty: ^, B$ N$ ~6 R! o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) n# f  C3 R8 x- E0 ^$ e* o6 U
  22. * GNU General Public License for more details.
    9 C! W2 f! N6 E( y
  23. */
    % U( ?5 s3 N5 m  W/ J" C

  24. 1 ]4 Q1 G2 H. H8 P- C
  25. #include <linux/module.h>
    4 f, x. _/ m: p
  26. #include <linux/init.h>
    + K. V9 f3 i5 q
  27. #include <linux/errno.h>5 o) r" X/ o# @; z4 f. K
  28. #include <linux/types.h>
    9 g) d/ W- H+ o$ S* N' G" q
  29. #include <linux/interrupt.h>
    8 T. L" F% p$ V3 u, f; H
  30. #include <asm/io.h>
    0 e! j6 |* Z+ ?* }, d2 Q& B
  31. #include <linux/moduleparam.h>
    9 P2 b0 j& O- c3 a# @/ F. n
  32. #include <linux/sysctl.h>3 p2 E2 r8 f4 q4 ]
  33. #include <linux/mm.h>% w0 [( t- N- P, \3 [. r7 w
  34. #include <linux/dma-mapping.h>0 x1 N/ G3 c0 O8 s  O5 E

  35. 2 d; e5 g0 \$ I" {1 [  z, a5 Z
  36. #include <mach/memory.h>2 u' Y0 I' ~% W4 _' X, Q
  37. #include <mach/hardware.h>- j: }  Z0 k, b# ?3 r6 x
  38. #include <mach/irqs.h>
    1 ~4 _" }( b" k% ~; O
  39. #include <asm/hardware/edma.h>
    , ^: _# ]4 Z6 s% x% X

  40.   x( ^' T5 Z2 u% B" e
  41. #undef EDMA3_DEBUG
    3 U, x  Q$ f. E% A; `5 x
  42. /*#define EDMA3_DEBUG*/7 h5 n3 I; k1 v9 r* M
  43. & F  ^1 |# v, k- N
  44. #ifdef EDMA3_DEBUG5 L9 i* ^) h5 h$ Q# D) a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + [' k' o5 _' n2 o9 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) Y$ k4 j* F3 s& H0 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 i2 \5 z6 ]- |/ Z* o3 P& L
  48. #else5 Y5 H0 P' q& \
  49. #define DMA_PRINTK( x... )
    6 W. V- X# L8 }1 p/ }9 j* ~
  50. #define DMA_FN_IN/ f" e/ s# }3 p; y( v
  51. #define DMA_FN_OUT
    8 g$ O% ?9 W  ~5 F1 K- `+ e/ S
  52. #endif
    " L! y; J" c  A/ r4 y) ?  U
  53. 9 S# P/ ~* H' d! d/ ]  J/ i; ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 S" ~# h; l+ Q- @2 }, r0 |& h3 S
  55. #define STATIC_SHIFT                3
    & k6 l; N7 f9 x" X: C9 x
  56. #define TCINTEN_SHIFT               20: }2 ?6 {9 W! s( \9 C1 ?% F
  57. #define ITCINTEN_SHIFT              211 L3 Q, K' c8 o- c& c
  58. #define TCCHEN_SHIFT                22
    / G, U- i1 T4 |  |; y0 f$ V) k
  59. #define ITCCHEN_SHIFT               23
    $ A0 u) r6 X' L7 w
  60. : P4 p  {& M/ x* {  G
  61. static volatile int irqraised1 = 0;5 \2 O$ }. j5 B$ o8 k4 v
  62. static volatile int irqraised2 = 0;0 s; T: M9 u' D4 t0 [/ \

  63. 0 w) d; s9 u+ \2 w; u' `5 s9 W0 z$ K2 M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & O0 x2 t7 M& r1 c5 H3 h  x5 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z' d' @- P! y6 X8 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) E  L. ~1 h( w+ |

  67. 8 W1 n" d2 X& {' E; f# ~" D; f
  68. dma_addr_t dmaphyssrc1 = 0;( y2 p9 Z( y3 ?, H. n  }! v. u- A
  69. dma_addr_t dmaphyssrc2 = 0;. G" L0 p) Z# [$ D5 c5 X% h& j% T! m
  70. dma_addr_t dmaphysdest1 = 0;
    0 S+ t' D2 U, D8 t3 V; q6 U
  71. dma_addr_t dmaphysdest2 = 0;/ d( O! c  U% A  D

  72. + b: q4 w9 ~4 y
  73. char *dmabufsrc1 = NULL;
    9 }  H! M4 u7 ?* d* C- a
  74. char *dmabufsrc2 = NULL;
    ! @4 k- r2 o" t* g4 d
  75. char *dmabufdest1 = NULL;+ ^* a. s8 L3 `9 V: e- S* L; {
  76. char *dmabufdest2 = NULL;6 W) t4 f: M2 ]$ h" v

  77. 9 b8 r3 x4 C5 w! _
  78. static int acnt = 512;" V. _9 L1 [5 N8 n! a( U; }
  79. static int bcnt = 8;6 k0 n4 c/ a+ N' G, y$ @
  80. static int ccnt = 8;
    7 W) c" V1 O% }

  81. + {' V$ \! N/ E6 `
  82. module_param(acnt, int, S_IRUGO);# [& {/ ?- e% S# g
  83. module_param(bcnt, int, S_IRUGO);1 l, k. K( D$ z& C( P$ I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 G9 O7 m! d# Q& N4 S  n3 Q
3 L/ l7 o/ G! M6 |' M6 W9 N# @) j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 x6 Z1 \# k5 C5 @' h+ sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 b+ X- f( x% q; o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; t, H  r0 o# H
  ~! d8 o* l0 C
2 L* B( ~# ?- f+ |' k6 q7 N' w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 10:51 , Processed in 0.039973 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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