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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . f' G1 I- e# w7 J% F' w( H
  1. [code]EDMA sample test application
    ' R% ^' Z- M+ h+ U
  2. /*# C' O2 A6 o, K8 H
  3. * edma_test.c& i2 x  Y& y5 O. }8 b6 J
  4. *  N; s' @' t1 r2 A7 ^
  5. * brief  EDMA3 Test Application2 Y. v3 v5 H3 Y& @
  6. *' e7 ]0 X" L( @
  7. *   This file contains EDMA3 Test code.$ \  g. E1 ]- P1 f- C! z8 ^7 `0 y) G
  8. *& J9 q7 J0 ^+ \) E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      l1 Q" I3 T4 d4 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 ~* @. {# w2 u% G6 Z- {0 N
  11. *         TO CHANGE.
    ( g3 a$ \0 J0 v2 Z# @' p
  12. *
    - e+ B, l4 H% e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # O# f6 O5 s$ I& \2 V; x0 d
  14. *' Z2 I! b  T0 B9 K
  15. * This program is free software; you can redistribute it and/or: t* p0 S$ T1 Y% v
  16. * modify it under the terms of the GNU General Public License as
    ) Y7 B, V1 o% O5 b5 A
  17. * published by the Free Software Foundation version 2./ p  F* w+ @1 L; P( F: v
  18. *
    , j/ V: y8 v7 {' |# i% Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* K0 m, A- p  [" _8 A
  20. * kind, whether express or implied; without even the implied warranty
    * j6 S2 ^6 O7 F. @/ n- _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # y3 a$ P+ v! {- _) t. G
  22. * GNU General Public License for more details.' S; |" Z' w/ f
  23. */
    * K1 U) e; |8 i- p
  24. 3 F/ D( r" p/ b7 u
  25. #include <linux/module.h>, H# Z; z/ v' ^4 `. i8 G2 L
  26. #include <linux/init.h>9 i9 b/ [1 O; l
  27. #include <linux/errno.h>6 ^, s5 J! q1 L! l' S# ^$ z1 r8 R8 i
  28. #include <linux/types.h>
    / o3 T  L* @( q! c! a
  29. #include <linux/interrupt.h>
    2 G/ y$ f' l( k$ L
  30. #include <asm/io.h>
    ( ~  M" C0 `/ {) V
  31. #include <linux/moduleparam.h>
    . q+ X9 p/ s3 E5 Y$ ]4 |
  32. #include <linux/sysctl.h>
    ! W3 I! w. [: f. ?; L' \
  33. #include <linux/mm.h># Q. g' s8 t& a5 j  D
  34. #include <linux/dma-mapping.h>, K: W4 K% V3 _) G+ \0 O
  35. 3 C; }! G4 u+ Y7 M% P# }
  36. #include <mach/memory.h>
    / H) G% R2 W! z1 i8 v; J$ L
  37. #include <mach/hardware.h>3 B) |3 p" N0 M% u$ b; J% {
  38. #include <mach/irqs.h>
    " x* x5 @; r( ?" l- Z9 h$ C- e
  39. #include <asm/hardware/edma.h>! m7 Z) L; E  ?& o1 }
  40. 3 h1 b3 a5 c7 w/ {
  41. #undef EDMA3_DEBUG
      N$ ]8 _; y4 Y. l  ^
  42. /*#define EDMA3_DEBUG*/
    ' u% G9 a( b5 M, l: U2 R
  43. % W4 g+ A# N+ u- c
  44. #ifdef EDMA3_DEBUG
    % l- n" \, h! r9 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' n) X: B( |7 @8 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). B0 w/ |% I& f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( i# s/ c, ]3 b- U3 u' r1 L$ B( Y: p% F
  48. #else0 L7 f; ]1 Y- d  A& k, f; I" N
  49. #define DMA_PRINTK( x... ), a) V: B  i+ R2 _8 f. G+ W
  50. #define DMA_FN_IN: ^  P0 [! _4 {3 N; {
  51. #define DMA_FN_OUT
    % o% K; d$ h- K! y
  52. #endif1 g) |& a* q/ f8 c( X

  53. " u" O7 y' ?. B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 C5 k) n" I5 \) f4 B, I, w/ a
  55. #define STATIC_SHIFT                3
    + k3 c, d1 D/ z" M0 k) A0 T' n
  56. #define TCINTEN_SHIFT               208 F: z5 R; _/ w4 d
  57. #define ITCINTEN_SHIFT              21$ [9 x. p1 z6 d2 y; e6 y3 T: ?. V, l9 l
  58. #define TCCHEN_SHIFT                22, }! M# O0 o8 B5 A( m+ L
  59. #define ITCCHEN_SHIFT               23
    , \' L8 v8 [$ X

  60. . X3 A! f+ R. s- Q6 ]3 t
  61. static volatile int irqraised1 = 0;
    5 K5 }- x9 `# w/ l) ~" x% V: C
  62. static volatile int irqraised2 = 0;
    & D' ~9 @0 P1 m. E

  63. 5 G2 m, ?- f! S) @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Y+ M* ?. y6 i6 q3 W9 Q4 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Q3 h, \) K, n" [, n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 C2 [3 e. E4 l# V& A$ p! I

  67. 6 F% D! `5 _3 t
  68. dma_addr_t dmaphyssrc1 = 0;% r# L6 g9 B' C5 ~
  69. dma_addr_t dmaphyssrc2 = 0;- ^" z, G& s) |. P: W+ H
  70. dma_addr_t dmaphysdest1 = 0;( l: N8 y. ~  G0 K5 P# w4 T
  71. dma_addr_t dmaphysdest2 = 0;
    / a$ q) v% X% [. V6 Q. x# c5 R8 a6 e
  72. 1 o) S# `. z* N2 j6 K* H) k
  73. char *dmabufsrc1 = NULL;
    : c1 ]8 S5 O) e+ _4 @) v1 ^0 ~! E5 E
  74. char *dmabufsrc2 = NULL;* y$ r- v; d. i1 Z
  75. char *dmabufdest1 = NULL;, S& B2 U8 K- n0 x$ c, l
  76. char *dmabufdest2 = NULL;# k1 U' s+ c# ~4 w7 X( a
  77.   j, f4 E/ \5 [# O! z6 K1 u
  78. static int acnt = 512;
    7 ]9 Y/ Z' J: x3 ~' O$ y
  79. static int bcnt = 8;
    , v  W. k1 ^! Q! ~4 ~* e0 \) [
  80. static int ccnt = 8;1 W- C: d3 Z) R5 ?8 k% I

  81. 0 p  a- ?0 G; Y2 E; D
  82. module_param(acnt, int, S_IRUGO);$ |/ B0 Z0 U) @) ^* D& n- Z! Q3 L
  83. module_param(bcnt, int, S_IRUGO);
    : k4 g7 O" y  A+ C- u2 j& Y  P- k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* ?8 d0 y) i+ Z- P

0 e+ q8 A3 b4 x5 I8 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 g) G3 l1 Y/ ~3 q# [. @' B( Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: q7 c1 N0 f5 A5 J9 K+ C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# O: t" H* h1 W% ^. h" z
" Q% o& u1 y& X
4 r$ d' U6 M% U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 04:59 , Processed in 0.043801 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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