OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l, y  ~  Z& G& z7 I$ R$ [* c
  1. [code]EDMA sample test application
    ; w. c2 R1 n, z4 m' ]
  2. /*
    8 s$ z* p4 d- ]7 C5 @& d& |5 j
  3. * edma_test.c5 N5 U+ F" p5 }8 `
  4. *" ]/ G; l0 V  B8 \" f+ h2 i
  5. * brief  EDMA3 Test Application
    8 Z: f/ j2 x8 W) @' f+ ~
  6. *: J- f% A+ `+ k
  7. *   This file contains EDMA3 Test code.
    9 T8 Z5 ^  ]0 k% ~+ M8 m+ H% @% a
  8. *
    % ^$ |$ v, c2 Y% T. p) b* i  }+ _5 h9 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ R, I; ?& M1 d& d  y# v& N: j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ?* c5 p3 |+ D9 R
  11. *         TO CHANGE.! O0 X* K8 p4 {' K. L1 q3 m
  12. *9 S, I" f) J  G" g6 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- n- S3 [, V. k7 f
  14. *+ F) ~/ \5 t7 ]8 c& A
  15. * This program is free software; you can redistribute it and/or. ~5 t8 k4 }6 v- f7 X  X6 G
  16. * modify it under the terms of the GNU General Public License as
    . z5 S. W2 L7 J
  17. * published by the Free Software Foundation version 2.
    . R' S3 e2 W  L! g! u
  18. *
    0 j' z% R% o9 ~/ N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ `5 i2 D* n( U( A: z. ^
  20. * kind, whether express or implied; without even the implied warranty% q4 M  `6 O; a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 r4 B7 U/ `$ Y9 y5 B; @4 T
  22. * GNU General Public License for more details.
    3 L& @7 [! f- y: o- g
  23. */
    " i5 V; N8 q/ ^- A8 ~5 {

  24. $ \6 ^6 Z# i# y/ P- O- ^. U
  25. #include <linux/module.h># @4 s2 e6 d5 e: _& }$ g; j! w6 ~
  26. #include <linux/init.h>/ i$ g. E$ g& n/ u8 c$ }9 Z# T1 ~
  27. #include <linux/errno.h>
    2 e, g7 R4 Q8 t% l+ t( F
  28. #include <linux/types.h>" h7 n! O) `8 m( e4 |2 H& A
  29. #include <linux/interrupt.h>
      g2 e+ I0 R7 o* y
  30. #include <asm/io.h>
    $ N- Q; T: a1 T8 L7 r
  31. #include <linux/moduleparam.h>6 y8 Z# t8 _4 C% M5 N
  32. #include <linux/sysctl.h>( h3 Z" t7 z) ?
  33. #include <linux/mm.h>) _9 c8 \- A; x8 Q/ B. {& A0 _
  34. #include <linux/dma-mapping.h>; i; b& i" x, E' l' r

  35. . h1 b, j) N% S* y6 \
  36. #include <mach/memory.h>
    % j2 o8 E2 D3 X; h9 l& Z" h
  37. #include <mach/hardware.h>1 e8 I. V, s% b+ y9 k
  38. #include <mach/irqs.h>
    ) O( I- {  M) W: K
  39. #include <asm/hardware/edma.h>7 z& C- D! U; }1 x8 l/ M0 |

  40. 7 }/ {" [  Y9 V+ ?% \) H
  41. #undef EDMA3_DEBUG& Z7 q) V7 }- |1 f1 S* L# v" Z
  42. /*#define EDMA3_DEBUG*/: y! ^( q: j8 O3 h6 v! H

  43. 5 e6 N* x9 ~! f2 }$ M
  44. #ifdef EDMA3_DEBUG
    7 {3 c. x2 i" `7 E/ A5 ^0 O% v: W( a4 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 x" P/ I8 H# j8 F4 b& Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 u6 h/ k; N# H, v1 t1 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 s/ N/ u; `6 ^+ F
  48. #else  b0 H7 @# F- A* U; F1 W, @8 ^& L, ^2 Z
  49. #define DMA_PRINTK( x... )
    3 _& t' j7 U+ n! A+ S
  50. #define DMA_FN_IN
    ; i' K  L. a) x* K
  51. #define DMA_FN_OUT8 e- O; C& V2 S
  52. #endif- b) J+ {! r2 v9 M  V) _

  53. 2 j' u& ^; @% B0 S: h) ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 Y  d( {3 i7 b* L3 U, ]& B
  55. #define STATIC_SHIFT                31 E( o; `# n; H6 v4 R0 U0 h
  56. #define TCINTEN_SHIFT               20* J6 n5 ]  K5 F4 `( G0 k; M
  57. #define ITCINTEN_SHIFT              215 N! v1 v4 I5 U' y+ F0 C! p
  58. #define TCCHEN_SHIFT                221 q  A; d! _( h1 I
  59. #define ITCCHEN_SHIFT               235 V, \$ G: X/ x# |
  60.   x) l0 @' ^- C2 j  d
  61. static volatile int irqraised1 = 0;
    - x) t0 q' v8 x3 Y4 [+ g
  62. static volatile int irqraised2 = 0;
    7 @) E8 G8 E% ^* `  @

  63. % R& I4 L$ u: f5 b8 \( Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 o" ^% K2 J/ l" p: K) H) t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! B, `' X9 g. V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ]3 {2 K9 P7 g# R* i/ e3 Y
  67. 1 H3 Y# n: ]* R# ?( `
  68. dma_addr_t dmaphyssrc1 = 0;
    & |* @, W0 _5 L+ ^) ]5 {
  69. dma_addr_t dmaphyssrc2 = 0;
    2 h( Y" [: D) W+ a% D: q
  70. dma_addr_t dmaphysdest1 = 0;
    , c' p& f% l: w+ E. l
  71. dma_addr_t dmaphysdest2 = 0;! X# @* {: x% F+ u8 A! ]

  72.   @' w/ R$ N- \8 E
  73. char *dmabufsrc1 = NULL;2 t$ a5 o/ T# c! o+ Y+ w
  74. char *dmabufsrc2 = NULL;3 f/ ]. S, p$ l' X6 @- S
  75. char *dmabufdest1 = NULL;' C) J/ l- }# S  F
  76. char *dmabufdest2 = NULL;
    , T! ^- ]) n% ]5 }% p1 r! R! c
  77. 7 C& O2 c/ l$ a% g. c
  78. static int acnt = 512;+ j; Y4 w; c0 N( N' J
  79. static int bcnt = 8;) u) r& Q  a0 y. q
  80. static int ccnt = 8;
    & q% h8 G2 X* W. o( E) u3 N

  81. ! Q6 I7 D+ ~1 b( k& k. _' a
  82. module_param(acnt, int, S_IRUGO);  m! J" G" R# V+ v
  83. module_param(bcnt, int, S_IRUGO);$ J# t! o7 T8 W+ f/ p9 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ j' K% o# m% r3 v
, {$ o: ?. n& |0 h" Z" }& L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F! o4 z9 @. F+ G* c$ y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 E, c( R5 v: x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* ~6 f+ E) w4 }( z
9 \$ @) j! w$ i+ F, A% F1 |* c* [9 i" ?+ T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 11:14 , Processed in 0.038026 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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