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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 |9 w, }$ s7 G$ R& @$ Z% _6 J
  1. [code]EDMA sample test application
    + T6 {% Z  ?7 q6 c
  2. /*7 L4 p9 c  _. Z: E& ~) T
  3. * edma_test.c- Z) k: n& E# e. M. m  p& J( r
  4. *
    ! c, o# C9 f! M8 X
  5. * brief  EDMA3 Test Application
    % D2 s' u1 P2 o3 a; K
  6. *
    $ q) p1 h/ p5 Q
  7. *   This file contains EDMA3 Test code." K; M8 G8 Z2 g! ]
  8. *! h$ T. G: H. Z/ k; k6 ?. X& P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 k* y  B/ E$ O9 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 G2 |. x: a  @, B% U' ?
  11. *         TO CHANGE.7 F6 F2 d$ I. R! T6 x
  12. *
    4 ^5 @' t' c6 L9 {0 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 Z0 \4 Q! v- v: M) [
  14. *0 z3 ]: I9 i) G& P
  15. * This program is free software; you can redistribute it and/or9 |5 ^/ w8 G# r. m/ B7 `; R% q
  16. * modify it under the terms of the GNU General Public License as
    # e* ^5 L& L$ a7 K6 w  ^; K4 j3 E
  17. * published by the Free Software Foundation version 2.& D# p: ~7 C0 ^+ n: P7 p
  18. *( W* l$ ^0 ]; Y0 G8 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% H8 l% z, S, x1 s; ?; j
  20. * kind, whether express or implied; without even the implied warranty
    * a/ q/ M2 h- _( p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / k! _* k- d5 c2 m: _  ^
  22. * GNU General Public License for more details." U0 Q9 X) C+ M4 K$ O! ?* f/ J5 M
  23. */1 M1 Y$ e/ x- F! L

  24. " }/ t+ g' l: J6 ^: M' ^7 M/ |
  25. #include <linux/module.h>, T4 w# V) ^$ i
  26. #include <linux/init.h>* U+ f: P: E0 @( K; {
  27. #include <linux/errno.h>
    # B3 I( V$ ^8 U3 w5 r
  28. #include <linux/types.h>
    0 I# U2 F! x5 A) J
  29. #include <linux/interrupt.h>
    ; l; L  [$ N. X3 w: p
  30. #include <asm/io.h>
    3 `' f6 D" N; e# F* S$ m
  31. #include <linux/moduleparam.h>: W5 o9 W- {& l0 _
  32. #include <linux/sysctl.h>
      X. U4 C- Y/ `! }& ]/ K
  33. #include <linux/mm.h>
    ) l6 w, Q/ q% a8 d% o/ s/ ?
  34. #include <linux/dma-mapping.h>
    ! ?" l  b, L" y
  35. 4 |( L& \3 H  a4 Q
  36. #include <mach/memory.h>" {9 r3 K3 `& E" r
  37. #include <mach/hardware.h>
    " B: \! C! r- o- w" G0 s  r" D
  38. #include <mach/irqs.h>
    , J; d/ U3 B/ t% v, q1 L* ^6 w' P
  39. #include <asm/hardware/edma.h>
    3 S6 ~' c+ N' Z  A: V, c

  40. + Q- r# W' M# L) h
  41. #undef EDMA3_DEBUG
    9 Q- u2 Q5 g, {2 [0 M% _7 `7 s5 U
  42. /*#define EDMA3_DEBUG*/% M  |6 v# v% E3 O- J0 z
  43. $ k5 b* B3 U# j- h2 A
  44. #ifdef EDMA3_DEBUG3 t, A( C; G' W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - n; m+ N/ j8 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Z7 m5 N5 f6 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 J0 |5 f- I7 }1 X
  48. #else
    " p3 X6 m' q! K7 r5 ^
  49. #define DMA_PRINTK( x... )
    ; ^# o+ d5 E# S$ ~
  50. #define DMA_FN_IN
    " s* L) [# @. x  F) Z0 n7 s
  51. #define DMA_FN_OUT
      j1 ^9 J( V3 j+ u' \; [
  52. #endif9 C6 C7 B/ i* g+ u, F
  53. : w( u# v2 q+ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); E/ x/ x+ h: z6 u% X- x
  55. #define STATIC_SHIFT                3
    $ V1 H7 t! B6 l6 Z9 J  U% Z. J
  56. #define TCINTEN_SHIFT               200 P" U2 Q6 ~' G' d
  57. #define ITCINTEN_SHIFT              21. E5 X# ]( i1 k9 y& D$ v
  58. #define TCCHEN_SHIFT                22
    + w2 f5 X- U4 j# F2 ]
  59. #define ITCCHEN_SHIFT               239 w6 k: j9 T7 a- E# S- m2 U

  60.   Y- i) f7 v4 |
  61. static volatile int irqraised1 = 0;
    2 q8 C$ r0 l5 N) }& N, J  |+ n4 d
  62. static volatile int irqraised2 = 0;
    5 q7 I3 X0 H! _9 N3 y
  63. 2 r9 [3 q6 f8 z9 l2 s9 D& o2 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C# i6 }& n7 V6 {2 h& b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N5 s3 c; Z: ]/ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! E: p7 W: U# Q. F. Z1 Z
  67. $ x( p0 A( p0 D% M3 l7 a. o9 \
  68. dma_addr_t dmaphyssrc1 = 0;# v  B- I3 ^/ d" R! U# M. y
  69. dma_addr_t dmaphyssrc2 = 0;1 j. A8 S/ b7 i2 c; f
  70. dma_addr_t dmaphysdest1 = 0;
    ; g/ T  ^* M2 u' p
  71. dma_addr_t dmaphysdest2 = 0;' D$ ~6 @, V* K' l- i7 G6 _4 c
  72. 1 r+ ]& F, D' S5 _7 O
  73. char *dmabufsrc1 = NULL;
    ! U3 Y) {( ]0 f. D" v
  74. char *dmabufsrc2 = NULL;) B; l& |( g7 p: R1 H
  75. char *dmabufdest1 = NULL;
    8 l* p9 s! n8 Z3 J' h7 U
  76. char *dmabufdest2 = NULL;6 X* d; a, o# k1 v! T
  77. $ i" w/ C- ^* h( ?
  78. static int acnt = 512;
    * C! ?: j; P6 }  o
  79. static int bcnt = 8;1 k# j5 K6 ^! Q  W$ x2 f
  80. static int ccnt = 8;
    ) i$ l, i9 p7 a7 G6 t

  81. 8 U$ @) v# X% w  B7 x( M9 {
  82. module_param(acnt, int, S_IRUGO);
    7 ?! Q) G& q! `! f' W: {! i1 S4 x
  83. module_param(bcnt, int, S_IRUGO);. \' }+ c; G5 ~( H) N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 W4 e( V% v  U6 v2 h  I

- U, }, _2 A, E; l9 j- \) q+ H/ Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 t, ^4 ~4 y! _5 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. J# y1 a& {- ]) q7 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ R2 X# r1 ?2 ~# m% D- B& j

% p9 P) k1 ^" ?7 f6 u5 h+ Z4 @. k: w& G: n, b" z7 X6 Z) a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-6 06:20 , Processed in 0.037215 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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