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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' o$ k" Z, `) Y8 n
  1. [code]EDMA sample test application7 V8 R, |( k. K. H
  2. /*
    & e' c" ~- M- _/ h; ?& q
  3. * edma_test.c& d6 h. t! P$ g) _4 W/ e
  4. *9 _+ ]: q! s+ R' O, J- N
  5. * brief  EDMA3 Test Application/ \- x9 |4 O) V8 ?1 O
  6. *  i- _8 k2 z  a3 O
  7. *   This file contains EDMA3 Test code.7 Q* n0 m+ h8 ~9 C' t+ R
  8. *
    . T) [2 y1 v: O2 ~0 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 y1 H6 L3 M# k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 q  r9 Z% E2 {
  11. *         TO CHANGE.
    1 }# @, b: m$ a3 F
  12. *6 C  Y- x& K/ R  i9 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & \& ^5 ]5 N3 {5 y
  14. *
    & V' y5 D$ ?6 I2 K
  15. * This program is free software; you can redistribute it and/or
    8 d; D+ J  G8 B0 _
  16. * modify it under the terms of the GNU General Public License as: H5 y* d8 |& h" e. G: J
  17. * published by the Free Software Foundation version 2.
    5 I9 M2 N6 I2 @* w
  18. */ u8 ]# c, y+ k# z8 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ o/ O7 O+ I) P1 ]" x2 l3 v
  20. * kind, whether express or implied; without even the implied warranty
    # t* F: n  N& b& h( h: U" U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! h3 d) Z- k! C, y9 A9 A9 a1 q
  22. * GNU General Public License for more details.6 \3 E5 \6 t4 I
  23. */: o6 A8 _, z& u; T& F
  24. 2 |9 g9 Y) S0 w& y$ @9 v
  25. #include <linux/module.h>
    9 ?9 V" i( J6 S# M' t
  26. #include <linux/init.h>1 U7 {* A: t. F( r9 P; z  E7 m3 b" u9 l
  27. #include <linux/errno.h>  x# o* |* Y3 [+ q9 Q& l
  28. #include <linux/types.h>5 Y' F! e% u1 w2 z( O
  29. #include <linux/interrupt.h>
    # Y& b  K* u6 P3 c8 C$ V; c
  30. #include <asm/io.h>" |8 g: h; o% t( [' w" P
  31. #include <linux/moduleparam.h>
    - |' R0 |; L  L9 ]) L3 U
  32. #include <linux/sysctl.h>" C2 D. Q7 N, q. o
  33. #include <linux/mm.h>. G/ W# T( P: h0 L3 |
  34. #include <linux/dma-mapping.h>
    7 ]: c2 y  A- {- q  d2 `; c+ |

  35. ! p; |9 Z% o6 @/ Z
  36. #include <mach/memory.h>5 F/ w/ @% h# s- C- W  b2 [- j
  37. #include <mach/hardware.h>
    / d1 i$ h9 W6 L) i2 L% z
  38. #include <mach/irqs.h>
    : B- l5 H" X4 O) u* S
  39. #include <asm/hardware/edma.h>" ^- @1 a# e* X- d  p

  40. # P$ u9 D9 \9 q* z
  41. #undef EDMA3_DEBUG
    0 X( @5 |/ r. j5 x
  42. /*#define EDMA3_DEBUG*/5 X- M+ c7 j; n) U

  43. & S  p# O" l' Z0 B
  44. #ifdef EDMA3_DEBUG
    1 t) v! `9 Y+ ?7 n0 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ J- N( c4 h( ?' q4 M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " k1 D/ F- K8 ?+ @& d/ V( _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- y& I4 c- o1 G; o
  48. #else5 M( U3 J& O5 N
  49. #define DMA_PRINTK( x... )
    ( d. j* p) W  Q" i+ P
  50. #define DMA_FN_IN
    $ Z* B3 h5 Q2 }/ Z/ A) A
  51. #define DMA_FN_OUT
    - S' A0 e! o" z8 C+ T( L
  52. #endif1 x' Q, f+ [# }+ w( F6 a

  53. ' v/ F9 w5 i2 r$ R3 z' w, s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , X6 Y* `; \# {" t! U5 ]0 X
  55. #define STATIC_SHIFT                30 k( L2 {- C" q  k
  56. #define TCINTEN_SHIFT               20' r) B5 H( p" @6 X4 o1 p; i
  57. #define ITCINTEN_SHIFT              21
    # {( A4 _: k8 H9 x
  58. #define TCCHEN_SHIFT                22( @: r9 \4 @% I5 b
  59. #define ITCCHEN_SHIFT               23
    2 J8 R# u( C3 M# `' `+ K

  60. % I% V3 }4 e7 V
  61. static volatile int irqraised1 = 0;
    % h4 [5 y9 G( V' u  t! Y" o
  62. static volatile int irqraised2 = 0;' p8 i- I7 K2 b* \! x9 _1 m
  63. # y$ r, a) m; L; O' _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A: H; b1 `* u$ X0 |( c4 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y3 g3 [% `3 n0 l+ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 \& S* c1 c. H; ~( I

  67. 9 E/ \9 C3 n( a' T, g9 W/ ^
  68. dma_addr_t dmaphyssrc1 = 0;+ K7 l% b2 Y3 ?4 V6 t
  69. dma_addr_t dmaphyssrc2 = 0;$ {% y- M1 |( f" o# b9 h! I) H
  70. dma_addr_t dmaphysdest1 = 0;! m; \) {8 A. Q3 K0 _8 l1 o* e, ~
  71. dma_addr_t dmaphysdest2 = 0;
    3 v+ A( i* U( \0 \7 [, c
  72. " |1 ]6 _; h. n/ r% a& h
  73. char *dmabufsrc1 = NULL;
    . n! q+ R4 L, |4 f
  74. char *dmabufsrc2 = NULL;
    3 }3 ]8 ?, H: p
  75. char *dmabufdest1 = NULL;
    , h8 v3 R) _* y+ x2 E
  76. char *dmabufdest2 = NULL;
    2 }( E  B8 @7 R& K  U5 e
  77. $ m$ i" F( s, L" q9 Y7 k
  78. static int acnt = 512;
    4 n. M$ d; P7 x! Q  ?7 b$ t
  79. static int bcnt = 8;
    5 r/ l- _+ {& C0 L* y7 n, Z
  80. static int ccnt = 8;$ {0 f; d9 Q* q+ D; I
  81. : C% d( R& [7 F' {
  82. module_param(acnt, int, S_IRUGO);- o8 q) S5 u+ d+ k( P( @6 q
  83. module_param(bcnt, int, S_IRUGO);$ Y; Z- X& S6 L; N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- W$ Y# O. v4 z& E% n4 P, j2 b
8 g! @. x+ M% q0 \3 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 w0 m9 c8 K& F% _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ q3 L' w8 b* ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 S0 F$ d1 x& V

6 J" p) Q7 X. g- J" n3 D4 e
3 y4 N; i/ w8 \$ P/ @" V# Z+ G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 19:04 , Processed in 0.038292 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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