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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ h( p1 t6 E6 D1 M
  1. [code]EDMA sample test application+ E" q; v  K* G" z
  2. /*4 L; W+ D* ^& n# |9 h
  3. * edma_test.c
    ) @. V4 e: f1 t9 p* n
  4. *  g1 C( D* X7 [. Z% F2 R6 @/ o8 M& O
  5. * brief  EDMA3 Test Application8 q5 M8 G: p2 a5 n; m
  6. *
    & G' `. G, t: |: h% J
  7. *   This file contains EDMA3 Test code., v$ o7 ^  q! O' a
  8. */ ]- t* h% v% B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 k" H- r3 Z+ }0 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Y9 }4 r1 q* `3 N
  11. *         TO CHANGE.
    5 u8 V0 r6 h6 z- J8 \
  12. *" S/ x! y. V2 M: m9 K9 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 K4 I3 E8 ?" @
  14. *
    ! f) a2 K& }) N' f  t5 s. z0 T; b
  15. * This program is free software; you can redistribute it and/or
    & n/ u3 u3 N3 ]' S
  16. * modify it under the terms of the GNU General Public License as
    / p- l- s  Z9 V  I* z9 @7 Y
  17. * published by the Free Software Foundation version 2.) f9 |# _# g" ^2 i  D; b! K$ y4 f+ N
  18. *
    " T# J( S2 @0 |. n; e2 G6 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ~2 ^, \( e) h) }5 p
  20. * kind, whether express or implied; without even the implied warranty" f6 M  O* R  L' d$ }. F0 a$ p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" B( E; n- V0 t0 @- e: G0 H
  22. * GNU General Public License for more details.
    , T- i) k/ Q% y! p6 ?! ?) F8 E
  23. */
    1 S4 ]  y  ]$ V8 _4 W; D

  24. 4 M( S" |- Z! k
  25. #include <linux/module.h>
    * x) P, [& v; G; }# |+ i& d0 }
  26. #include <linux/init.h>+ J9 D0 G) Q5 {
  27. #include <linux/errno.h>% w( r8 u. H+ b/ j$ K# x
  28. #include <linux/types.h>
    " t' T  Z( q) C  n
  29. #include <linux/interrupt.h>
    ' K9 u" [. j0 h- G, [* H( x, [
  30. #include <asm/io.h>6 R5 e# T, Y9 i
  31. #include <linux/moduleparam.h>
    ! X5 e8 |! y! x. x
  32. #include <linux/sysctl.h>2 ~. {3 I8 m! _+ V% K' v6 t( H9 N3 m
  33. #include <linux/mm.h>/ F( n* z4 e6 e/ M: m
  34. #include <linux/dma-mapping.h>( D2 N' [) X/ G- ]6 |
  35. 9 z# @7 I2 S* x: S0 [
  36. #include <mach/memory.h>" f& H* ]& B  o3 h2 D) r' g  d; [
  37. #include <mach/hardware.h>5 L+ H+ H1 \& U- [4 X6 n3 @9 i+ D+ L
  38. #include <mach/irqs.h>
    % I8 c8 T/ }& y* X  Q; e4 q. M
  39. #include <asm/hardware/edma.h>; S6 @& V+ k) D, {: q# v) n
  40. ' w$ A2 A1 Z4 i' |& V2 L3 \. e" F  U
  41. #undef EDMA3_DEBUG
    5 Y1 i5 r  c2 v* t) \' q; A
  42. /*#define EDMA3_DEBUG*/
    8 }  ^+ P; B, C  ~# N5 l
  43. 0 f' \& b3 M# I+ J/ W
  44. #ifdef EDMA3_DEBUG) _! l. E! ?8 t7 [# \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 g0 P8 A1 v) r# c) S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      j7 y$ f4 s& d- t+ E9 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 v: w8 r8 H1 W8 y2 h  _
  48. #else
    2 S5 s' ~; R; n' q! k0 d/ q9 x
  49. #define DMA_PRINTK( x... )
    ( T1 o0 O/ W3 @7 [7 \6 A
  50. #define DMA_FN_IN
    3 S5 X0 a  V" {! J
  51. #define DMA_FN_OUT
    / [& M9 `& z/ i" Y) j1 n
  52. #endif: {% J% T7 ~. A  r- r. @1 M' \. A
  53. - e: ^! S+ v5 g7 V: w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 a4 Y* C8 s) }2 V$ O/ ^2 R8 U- C
  55. #define STATIC_SHIFT                39 H. d6 L4 r7 w' q0 V, x0 y* o
  56. #define TCINTEN_SHIFT               20& O' r  P; N, L* g
  57. #define ITCINTEN_SHIFT              21
    7 ]# `8 C3 _1 A8 p; O& V2 ^
  58. #define TCCHEN_SHIFT                22" d7 x) k* f4 L- V& m6 q* c
  59. #define ITCCHEN_SHIFT               23
      ^0 v  m2 [: N, r- n) F6 O2 Z5 i/ L
  60. ( `$ a4 |: c4 f2 X6 n
  61. static volatile int irqraised1 = 0;3 `7 w" \" Y, `& D
  62. static volatile int irqraised2 = 0;: t7 s  E! d$ o! c" G
  63. % F3 h0 [- I. u2 ]7 k# ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Y  {6 A! ~7 S: H, f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F' c  E5 f, e0 @  p" {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( X) ~7 B9 [1 p8 f3 U, J% D3 |

  67. $ G/ R- |) [' m3 Y* ?4 u0 O2 A
  68. dma_addr_t dmaphyssrc1 = 0;
    ' S4 e5 D  \# f5 O! M, j
  69. dma_addr_t dmaphyssrc2 = 0;4 u+ b: ?6 e9 @! [; k0 }  o  ^
  70. dma_addr_t dmaphysdest1 = 0;4 S7 N' l# b: R" }
  71. dma_addr_t dmaphysdest2 = 0;: i$ P3 L: v! d7 |# B0 P( c' l
  72. ) h: e) K, @$ q5 q6 e4 K2 z$ @
  73. char *dmabufsrc1 = NULL;
    - t+ s$ D# s. N2 ~
  74. char *dmabufsrc2 = NULL;; V. S3 h! j) m! J* O
  75. char *dmabufdest1 = NULL;# @4 h  N. @% V, z0 j" U  ~
  76. char *dmabufdest2 = NULL;5 W% M3 y& B$ q$ y3 ^) i+ e

  77. 5 F9 ~+ d% z9 K% w. o6 x
  78. static int acnt = 512;7 R$ l. s3 h* W, B9 _* a  q  h% l
  79. static int bcnt = 8;0 d6 _) Y" e  W7 z! ~4 B
  80. static int ccnt = 8;* i7 c$ m/ C. @' E

  81. $ g; r/ w, l3 ]7 M" V
  82. module_param(acnt, int, S_IRUGO);$ W' q  z2 X! S% Y' E' p" z
  83. module_param(bcnt, int, S_IRUGO);
    1 l* P" v; P/ }1 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 J, M8 \. ?( E3 t7 W' ]0 y5 W; b8 F7 e+ g( T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. C+ S  a$ j6 u5 |6 n6 f, `3 y! x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* _: m- o2 z- d5 C/ A3 M3 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, v& h; J# P1 f% V, ~  z" K4 j# x( |& {
+ }0 g4 a0 V1 Q7 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 08:13 , Processed in 0.041773 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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