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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 l" m3 X7 k+ P/ W" k, c
  1. [code]EDMA sample test application
    , E( A* X2 H, E- P
  2. /*2 `: b( a; V& j% X9 S
  3. * edma_test.c- `! I/ }" X0 z. ]+ Z
  4. *# v. B1 m4 m7 B5 H
  5. * brief  EDMA3 Test Application6 G2 x6 a6 D- ]5 _, P0 [% F
  6. *
    / j4 E, T) z1 t( C  {8 i
  7. *   This file contains EDMA3 Test code.
    2 z$ b" N, J% J- P* N  C
  8. *% S, N- W: ^% a. @8 T, o+ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / x; G* b3 c( j- E9 |9 i& f3 |0 c: T# d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ P" Z6 [6 X" P  f6 D' a( b/ j* a! _
  11. *         TO CHANGE.
    6 V* z2 ~& L$ p& _9 h2 h0 `
  12. *
    1 b; i9 {/ ~& Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! g1 K, K3 b& t/ F; ?& p2 p: y
  14. *
    ; x( _0 i$ p+ d3 b
  15. * This program is free software; you can redistribute it and/or
    & _  E1 o4 U# J5 l9 _- `
  16. * modify it under the terms of the GNU General Public License as8 f( i- F) I9 z0 [
  17. * published by the Free Software Foundation version 2.
    % g. n7 b  k% Q
  18. *3 f5 Q* q& x7 B3 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 s+ W5 C* k& [2 e8 b9 |. L9 W; ?
  20. * kind, whether express or implied; without even the implied warranty$ Y5 i) \" [5 B# K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . y$ }& N& _: V# G- S/ s
  22. * GNU General Public License for more details.
    6 u" t" M. n0 z9 _( F
  23. */7 x) K! o' X/ A1 L

  24. 1 `5 t' }0 g, N5 l7 Y0 ]. y; G
  25. #include <linux/module.h>" E2 |; y/ i1 N0 O$ c7 K
  26. #include <linux/init.h>0 x1 F, [- Z9 X* n( t, A1 }, \, G
  27. #include <linux/errno.h>9 N4 I- A: v/ J/ r/ X' ?
  28. #include <linux/types.h>
      m$ X# a: I# m5 N4 A
  29. #include <linux/interrupt.h>1 `, Q1 P, {9 J; E0 c/ o9 k5 O
  30. #include <asm/io.h>% P8 E( _: W% w# n  y" J8 C/ W5 i+ @7 W
  31. #include <linux/moduleparam.h>0 s4 |8 }- {4 f: c, V) E
  32. #include <linux/sysctl.h>
      Y) s3 Y6 E' I% {9 i; ^% g* L
  33. #include <linux/mm.h>% k( M, T7 i7 _
  34. #include <linux/dma-mapping.h># \, k0 q7 d1 U+ i
  35. $ N5 s3 M( d7 ~. b1 r
  36. #include <mach/memory.h># H: f/ l8 h& Y! U2 y& U$ C$ f
  37. #include <mach/hardware.h>
    ! X, S: r6 N. q# ~6 {
  38. #include <mach/irqs.h>5 I9 h" T# N1 n
  39. #include <asm/hardware/edma.h># }9 t9 L1 I7 ~& E
  40.   F" {3 m0 z1 E; m% z: T. {
  41. #undef EDMA3_DEBUG
    # @5 k0 n/ L3 q
  42. /*#define EDMA3_DEBUG*/
    - }0 T( e9 i, M2 @; s; d
  43. + @* w# U) W5 ^! u
  44. #ifdef EDMA3_DEBUG
    0 U6 x1 t$ O' Y6 L9 C( c+ B" m0 S4 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ A7 |8 n4 g% Y7 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 Q% F6 L/ i( S! k/ {4 T4 q" g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 I+ p8 [! g4 Y% l
  48. #else! [5 y- ?  V) u. E
  49. #define DMA_PRINTK( x... )
    0 m  [; L' `7 T
  50. #define DMA_FN_IN
    , x( i6 m* c. @' I0 |
  51. #define DMA_FN_OUT
    ) {, P2 v2 A2 c8 l* g7 g  \
  52. #endif( o  F, S: _- x/ _" f: |: X
  53. : g! z! |" B' w/ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * N& t6 Y! j/ g( L, l: N
  55. #define STATIC_SHIFT                3
    6 r7 ]- m5 r; G1 r. Z) c  l
  56. #define TCINTEN_SHIFT               209 D: @& x$ g. ?3 u* {: Y& g: f& O, h) I
  57. #define ITCINTEN_SHIFT              21
    / O' S* r! j- ?. i# N- I. B9 L! G
  58. #define TCCHEN_SHIFT                22" @) b  A4 H& W
  59. #define ITCCHEN_SHIFT               237 H, d$ O/ c, z- t1 _

  60. 5 \& u) Q4 ?( {% K& P' u$ N
  61. static volatile int irqraised1 = 0;1 f: M7 H6 ^+ Y2 X
  62. static volatile int irqraised2 = 0;3 i9 D9 C& j# f0 |
  63. $ x5 F6 @7 f+ E5 V4 A; ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 M5 r5 o' j+ `7 Q% |. m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Q6 U" R; s  _) C  h7 |& h& `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \+ ]/ G& A0 l# l8 T' y0 H

  67. ) D0 j; M: R& f7 r! O
  68. dma_addr_t dmaphyssrc1 = 0;
    0 h; m3 w+ D. S0 K+ ]5 \( m; U
  69. dma_addr_t dmaphyssrc2 = 0;5 n1 q" C  ]/ T8 P
  70. dma_addr_t dmaphysdest1 = 0;$ x" h2 n% q/ M$ m9 H
  71. dma_addr_t dmaphysdest2 = 0;: c5 y1 ]$ U% S% D" t

  72. 4 I6 O5 N. t! m. h
  73. char *dmabufsrc1 = NULL;
    # d/ o4 V. |# h( y( E" `; S( w
  74. char *dmabufsrc2 = NULL;
    9 r+ [5 h* A- o/ E
  75. char *dmabufdest1 = NULL;7 h7 p8 @: D$ b9 C( T
  76. char *dmabufdest2 = NULL;/ C; b' T& o2 R. e3 T7 Y3 [
  77. * @' _1 u7 Y' k$ z6 z* n
  78. static int acnt = 512;3 W9 [/ G, H4 R# _
  79. static int bcnt = 8;) J' x" \+ H  Q6 R1 K
  80. static int ccnt = 8;8 ^- `: t" }5 t( `: Z
  81. * w+ a+ E$ B8 L, q: U
  82. module_param(acnt, int, S_IRUGO);* ]0 q3 O" U# G' R( ~3 X5 f9 j' ?
  83. module_param(bcnt, int, S_IRUGO);4 c) t# q8 \) H: u+ l( ]" _, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% p. Y* w; y/ F1 i2 E, R

/ y7 u  o9 w6 \, }5 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- o' d9 P: G- [  B3 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 P" d4 k* H4 X. J4 ?" y* ?' T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! |* G/ K8 V% `. D) j* T
/ ^' R* F% B/ C* ]* W% ?: Z" Y$ ^7 e( l$ e2 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 18:34 , Processed in 0.036483 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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