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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : T: A0 }: e" L& D; h5 j
  1. [code]EDMA sample test application9 D. z# H6 o; g; B$ o- p7 P
  2. /*% Q1 a9 w1 `( V' C$ P" f
  3. * edma_test.c# G( C2 x: m) S5 w9 [- V" w) j8 O
  4. *
    , ~9 p& H. p1 ^9 E$ X9 M
  5. * brief  EDMA3 Test Application
      D# [6 V6 r: T" s. }
  6. *: I2 q& f" h# v" r0 |, ?
  7. *   This file contains EDMA3 Test code.0 u( _. W; z/ @; ?" Y# N. @
  8. *3 ]7 W9 a& H4 l1 y1 \: k+ u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 c8 r4 N7 S. i; I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Z7 z# e- I3 F6 I. m; N, y" n
  11. *         TO CHANGE.; B5 |! r& J" n' O/ Y  c) `8 t3 P
  12. *) I5 Z6 H' c2 r8 t: H5 ?6 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, l% Z5 z0 m) d+ |+ G2 F. J# U0 _
  14. *
    ; o: g. G6 n8 K, n+ O- P
  15. * This program is free software; you can redistribute it and/or& X- `, E! T% B3 |3 P' B
  16. * modify it under the terms of the GNU General Public License as
    ! d) _4 Q8 G1 W' i' k
  17. * published by the Free Software Foundation version 2.# P9 m+ G4 X8 R3 W7 u
  18. *3 l5 s3 ^3 V; L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + Z, ?# G/ m# _8 ]# o/ d5 `
  20. * kind, whether express or implied; without even the implied warranty) c" }' k' X7 C# _! ?' E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* s9 u7 r6 @* m' m9 }1 ~+ Y1 w
  22. * GNU General Public License for more details.
    # e3 }$ }5 ?8 C' K' X3 f% Y# f6 \
  23. */0 d9 }, I3 G; F; I* Y1 N8 T9 Z
  24. 9 L* y( b+ Z2 C
  25. #include <linux/module.h>6 j: b( G" R6 y
  26. #include <linux/init.h>
    # A7 Z! \7 W) }; ~: @' `8 l8 Z
  27. #include <linux/errno.h>
    ( R2 A$ @- h1 b+ x
  28. #include <linux/types.h>
    5 x. t8 C% N" ^
  29. #include <linux/interrupt.h>6 f& y- Y. k) R9 n" ^% O7 V) M
  30. #include <asm/io.h>) m! `: \9 x0 {4 x2 D$ E2 n
  31. #include <linux/moduleparam.h>
    ( S- Z3 b- }, w2 a, {) S) {: D
  32. #include <linux/sysctl.h>
    # m/ S& @* f7 o. w$ J
  33. #include <linux/mm.h>! r0 B, |4 [- W) f5 J; h- z/ N5 O6 g
  34. #include <linux/dma-mapping.h>% y- W8 u+ }: j: ~

  35. / Y8 q& F. }5 T% {/ U
  36. #include <mach/memory.h>! ]: m- a# G) J9 c' R
  37. #include <mach/hardware.h>
    & _' p2 c' f' S! t+ j! p4 r
  38. #include <mach/irqs.h>
    + Z/ y7 _# d5 p# D
  39. #include <asm/hardware/edma.h>
    - ?+ o8 Q4 T0 X8 {. ?% ?8 U* E! L
  40. , f( ?0 R% W8 y! J6 G5 j" R8 L% d8 t  k
  41. #undef EDMA3_DEBUG" t+ o0 ~. c* h& j
  42. /*#define EDMA3_DEBUG*/
      }' }  `2 M  S  f8 w

  43.   G  _0 H. H/ G) s. G7 H
  44. #ifdef EDMA3_DEBUG
    & E% Q* J5 `; i  C' b2 f, Z) c- B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A$ S; v( j8 n1 l. ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & a3 s! Y) B  g8 b6 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - W1 D- a% ~$ [
  48. #else7 h8 @" T3 x1 C& b
  49. #define DMA_PRINTK( x... )
    % _/ s/ |2 z" i: q$ F& u# i
  50. #define DMA_FN_IN! L9 W5 V8 X" g# O; S" u
  51. #define DMA_FN_OUT
    : c' Y. I' y( h9 ]% ?+ a  V! E
  52. #endif" H1 w+ }1 W/ S: }. h* T9 s5 A
  53. ! Y* y& b( w! H7 t5 O. e2 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): q3 F- N- \! {: D+ P7 B% @9 ]4 H% R
  55. #define STATIC_SHIFT                37 C( c3 j: d  S9 K+ w2 D. j
  56. #define TCINTEN_SHIFT               20. B) G9 J: j# ]7 e3 m: N
  57. #define ITCINTEN_SHIFT              213 E: r& w7 _% s, o6 F
  58. #define TCCHEN_SHIFT                22
    ; i: {8 e+ {2 J, e/ D
  59. #define ITCCHEN_SHIFT               23
    # V+ U8 h- b8 \6 R' q$ v
  60. ' P% K* ]) v2 j( l# z
  61. static volatile int irqraised1 = 0;+ h; z+ s" a. Z+ k
  62. static volatile int irqraised2 = 0;; \: L5 S8 `+ i. g$ V" l4 X2 o

  63. 7 K: D# X8 R5 b5 L4 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 b) o8 w+ ]. y& ^" y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " N6 d3 _3 j* N, L# |) b% @: m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & H' A# g" c1 \" P$ m: V9 z# \, G/ k. z
  67. $ i( C$ K, A" s
  68. dma_addr_t dmaphyssrc1 = 0;- ^0 e. p8 Y% ]
  69. dma_addr_t dmaphyssrc2 = 0;$ |* E/ f$ n/ ~, I6 |: T
  70. dma_addr_t dmaphysdest1 = 0;+ t& f/ A2 n7 J* r6 Y
  71. dma_addr_t dmaphysdest2 = 0;
    + B# _/ L1 I: [, j5 T, s8 b0 ~: b

  72. * y6 k! g. S* \" F# v8 L/ b
  73. char *dmabufsrc1 = NULL;8 x& @* P( w0 i- h
  74. char *dmabufsrc2 = NULL;, i$ G3 z/ B! d, U) H# _
  75. char *dmabufdest1 = NULL;
    + [8 N( t; @: m3 m5 U7 d
  76. char *dmabufdest2 = NULL;
    + X: `8 t/ m6 i, G: J
  77. * [7 i% T0 u* F6 c: M  c$ c
  78. static int acnt = 512;
    - o; G1 v3 x& Y( L; ~# A% }/ C3 H- _- y1 c
  79. static int bcnt = 8;* p7 m2 ~# R" \( i3 l* E& P" I
  80. static int ccnt = 8;$ G  a# m) b5 J( b$ B+ B

  81. : t2 M4 ]4 x" F: T: ~
  82. module_param(acnt, int, S_IRUGO);
    8 a4 t, S6 }6 t. F+ e7 c% O
  83. module_param(bcnt, int, S_IRUGO);
    ! `) h9 @9 m) }% G7 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 j# r9 C9 d/ g
1 O5 l* h! l3 m; T9 @; z1 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ~, U# o$ m9 @/ [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ P' r  n# ^' v- k! I; |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* v- `6 a9 W: ^  p$ ]

, Y+ K( U1 ?7 b5 i! r, ~- p; `% ]/ S6 Z, J3 c8 K, J' w/ B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 18:04 , Processed in 0.041644 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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