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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Q& F$ d, C. d; R
  1. [code]EDMA sample test application; \* G# |! |. P6 k5 i# i9 l
  2. /*- X- E9 z) T* F3 F& I& k$ o
  3. * edma_test.c) C; O; |( p1 L, p, Z$ y- `7 h/ ^
  4. *
    ' f" u9 @2 m' w( C! k( p
  5. * brief  EDMA3 Test Application
    5 C4 g: M2 }, ~6 U( w# r6 }
  6. *$ e$ {1 q" ^4 }' N( U
  7. *   This file contains EDMA3 Test code.
    2 o+ n( r7 j# K8 w
  8. *
    ( a& m4 o* j5 {9 d; o3 n( c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! t8 u. b4 V7 y) o/ A3 e: k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / a1 e# y. v! G0 W, i- X
  11. *         TO CHANGE.( I: ]- @& d* I( F, _+ V$ w' S
  12. *! K, S2 Z) b. Q3 P# h5 D2 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// _2 d; F8 y* _+ Z8 s3 q& a8 t
  14. *
    ; a/ V4 G" `  _2 I, r7 g2 l9 M
  15. * This program is free software; you can redistribute it and/or
    ' E% w, ^7 N% K& B! Y; S
  16. * modify it under the terms of the GNU General Public License as$ A; G+ X0 i- F. Q# j' V6 ?5 S4 ^! _
  17. * published by the Free Software Foundation version 2.
    ) g9 q: @) ~; N: P& F
  18. *
    * @5 N( j1 ]) ^  C2 _/ |+ N, ^# J- J! b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ T& U* W$ a8 [) E3 \1 l) [
  20. * kind, whether express or implied; without even the implied warranty
    5 C  u9 s2 N* `! m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % C8 R. `6 T$ p% u1 ~1 `
  22. * GNU General Public License for more details." P6 k# o8 t+ b6 j
  23. */
    1 l2 @, h, @3 ]8 G0 f8 T
  24.   W. i8 O  U. d7 p
  25. #include <linux/module.h>. z7 d8 S" @& j% a9 E
  26. #include <linux/init.h>
    5 f, B, g; Y# N* g
  27. #include <linux/errno.h>
    & W& V( ]: K9 Z& J1 m
  28. #include <linux/types.h>
    ! |  S; P8 \* ^$ s+ q
  29. #include <linux/interrupt.h>
    2 F5 K$ u0 i7 Z; Y7 L  E# \; \
  30. #include <asm/io.h>* B& G, c7 e0 |% M
  31. #include <linux/moduleparam.h>. m" G5 T) z( o# ?( A
  32. #include <linux/sysctl.h>: R5 B/ q# i- H5 d8 n( l3 r5 \
  33. #include <linux/mm.h>4 l  A' d) @) L. ~$ e+ E
  34. #include <linux/dma-mapping.h>
    ; W9 R1 d0 D; v* N4 \% d# F+ `. b4 X

  35. & ^% a- @8 M/ D9 E- D* g/ D
  36. #include <mach/memory.h>
    7 x/ N1 ]. a+ Y+ E$ a* }
  37. #include <mach/hardware.h>
    + h% {' W. Q# M" M
  38. #include <mach/irqs.h>9 ?+ E' {5 z1 b& g! H4 ^6 N: M# S
  39. #include <asm/hardware/edma.h>* Z, B5 i/ i+ n
  40. 0 x, w9 [3 c$ f
  41. #undef EDMA3_DEBUG
    % l1 H+ s$ b: u/ o' x! J' z  l
  42. /*#define EDMA3_DEBUG*/, i& e% H6 ^6 z! _2 l4 c
  43. - w6 [4 F% h$ C9 r, D; O
  44. #ifdef EDMA3_DEBUG: N( L: u+ O7 `) _' s. b$ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / y, W* N. j' G0 B0 q# p; w5 }+ @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 v: L$ ~! `$ p& B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# }# y4 [7 {1 R
  48. #else9 o7 _! J4 L$ ]* V
  49. #define DMA_PRINTK( x... )
    / }) Y3 d7 E/ B  @1 f9 h) N- y
  50. #define DMA_FN_IN% K% @* u0 F( I9 I' v  d  J
  51. #define DMA_FN_OUT
    ; k2 {* J6 W* k
  52. #endif; w; k8 n7 I0 Y+ a# J+ N3 i. I3 K
  53. + D+ X/ u- s# e5 i: H/ A( x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! u( ]# \- @5 w4 K' S
  55. #define STATIC_SHIFT                3
    2 `6 [; K) V& s3 P. k( o
  56. #define TCINTEN_SHIFT               206 O! P$ P! o0 g5 s8 w
  57. #define ITCINTEN_SHIFT              21
    ) T0 @0 F+ i9 A
  58. #define TCCHEN_SHIFT                22
    ) C. E7 U: ?2 x0 `  p# J2 m5 c
  59. #define ITCCHEN_SHIFT               23( g/ X5 ]. a* {+ ?6 I! a
  60. ) `+ W% @, F8 _' w
  61. static volatile int irqraised1 = 0;
    7 \9 h& C, E. T* L$ _. x3 b" m
  62. static volatile int irqraised2 = 0;
    % q0 }- H* V: e+ b. ^  W; j; r& H6 a

  63. $ S9 M0 U4 `/ j/ \% g( A0 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( i8 T; U& D! }7 m* _6 i# O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 S' R9 \6 R  e6 g0 ^+ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t3 C/ h3 q' d

  67. : S+ S* o2 }( s2 G' T7 S6 D
  68. dma_addr_t dmaphyssrc1 = 0;
    ; _4 L. a7 `+ G% E" S
  69. dma_addr_t dmaphyssrc2 = 0;. G4 X% H" N- [1 f$ |4 X
  70. dma_addr_t dmaphysdest1 = 0;$ ~/ ^" x3 a& b4 j* v  m3 N5 ], M2 r
  71. dma_addr_t dmaphysdest2 = 0;+ R5 g1 {7 w+ b1 n) L
  72. ( m0 N0 W) ?* o0 h; z
  73. char *dmabufsrc1 = NULL;
    ! H* i& }9 E& N1 w
  74. char *dmabufsrc2 = NULL;3 V- _" N5 `1 }9 [! t- h
  75. char *dmabufdest1 = NULL;
    1 c0 H3 ~/ K0 b% y( d& ^
  76. char *dmabufdest2 = NULL;
    ; R, G1 E0 }1 l0 T0 B$ Z

  77. + _# @$ [2 D* s7 G. I# @. q! F' h
  78. static int acnt = 512;
    7 \; Z, }7 v0 r0 P
  79. static int bcnt = 8;
    0 y& p! y# z, E3 B. V+ ?" ?  g
  80. static int ccnt = 8;: X% o. ]' X7 r6 `
  81. 8 k3 W- B7 p- o8 o7 u4 ?
  82. module_param(acnt, int, S_IRUGO);
    5 ?0 d$ ~' O% L; O
  83. module_param(bcnt, int, S_IRUGO);
    ( k# K( y4 P; H9 g, X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 j! c8 j6 o4 l) [- y

) \  @# T: o- ?  ]# o3 n3 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Y& n1 a3 n! `5 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 T$ s( C- x3 \8 P% A: X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 K, }4 \3 y# C7 w: Y' }4 @8 L" h4 o- @/ O
) I9 z: G# [8 [  G# v( ]( B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 16:36 , Processed in 0.036638 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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