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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 5312|回复: 0

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
发表于 2018-1-30 11:01:43 | 显示全部楼层 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 y% K$ i2 o" w0 K
  1. [code]EDMA sample test application& e' a, u7 Y* G8 y
  2. /*
    ( ~# s& Z" E4 t# `( ?- O3 b
  3. * edma_test.c3 ]( w8 y, m, @  q* g. {
  4. *
    1 V3 y  Y/ i& w' ]
  5. * brief  EDMA3 Test Application
    6 d! M2 M5 ?8 b6 k9 A
  6. *; A! q6 e, G' F$ @4 R6 l% C$ D& z* @+ m
  7. *   This file contains EDMA3 Test code.* b8 E; V& v( R
  8. *
    7 `7 ^  j# `$ v0 X+ F4 U9 S; k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * }0 d. w' D$ u+ v9 I6 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 m; q4 g0 B* t3 A3 R
  11. *         TO CHANGE.
    : _# ^% K. j* M, g* m) l
  12. *+ d1 Z; _% l4 Y$ i' `; }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 A: C2 C4 W! E7 g
  14. *
    ! ]6 a: m4 T+ w- k/ O5 |  U3 ^
  15. * This program is free software; you can redistribute it and/or
    : s, N9 C2 a4 ^/ u" o
  16. * modify it under the terms of the GNU General Public License as
    6 P7 ]( A8 u$ a$ c1 I
  17. * published by the Free Software Foundation version 2.( Q5 K" f0 ?, V" R; G0 ]6 a: f+ f
  18. *
    $ E0 B# u' n+ k- w) L1 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 s7 Z, W$ ~8 V) `' c
  20. * kind, whether express or implied; without even the implied warranty
    & p5 d; E& w) [/ h! B# C1 h8 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 I  j. v$ O6 Q* n+ f% Y- w
  22. * GNU General Public License for more details.
    - t  X' j; O) r! r/ y  y& ?
  23. */9 j9 c( ^7 g  M) C7 T# H

  24. - `# l$ m- A9 m, Q; f; c2 Z% l
  25. #include <linux/module.h>' X2 s/ f" O" w& K% P6 A
  26. #include <linux/init.h>
    ; X5 x0 p7 x; e: I: _
  27. #include <linux/errno.h>
    7 U: L. d, }2 n. R/ G5 K
  28. #include <linux/types.h>- A4 T$ ]9 J- l$ l. j
  29. #include <linux/interrupt.h>% R5 o: b( E9 m% I. A# _# d; t
  30. #include <asm/io.h>2 T4 Y1 u) n6 j( K
  31. #include <linux/moduleparam.h>: a& C5 ?8 v7 I" B" C
  32. #include <linux/sysctl.h>
    0 A! {; C; I$ L8 K$ p$ S/ ~/ X( Y
  33. #include <linux/mm.h>
    , @4 ?7 e; n/ L+ E
  34. #include <linux/dma-mapping.h>
    : i! }9 L. e7 U+ T6 M; w$ v

  35. * A& @: }$ s7 a7 U, j- ]- W
  36. #include <mach/memory.h>
    . W' n' V1 N" o; Z7 p' b
  37. #include <mach/hardware.h>
    ! f4 ^8 o8 T  h+ S7 G
  38. #include <mach/irqs.h>0 @0 z1 i: u+ Q6 v: a3 B3 _
  39. #include <asm/hardware/edma.h>
    4 k1 O" Q. ^3 J/ t$ `* Y

  40. . e5 a. [$ \! W4 V$ W" |
  41. #undef EDMA3_DEBUG
    % o1 K5 |+ M5 Y
  42. /*#define EDMA3_DEBUG*/- Y2 @" w) _2 F6 i2 ^
  43. - V$ w7 O1 N' i
  44. #ifdef EDMA3_DEBUG$ x8 q3 e- {- K0 f7 I  `9 `* Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 S" D1 k# V$ @5 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ]# j& `/ p3 p6 G% o9 V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 H  ]6 Y( z6 L
  48. #else
    . r( _2 G5 B* y5 _
  49. #define DMA_PRINTK( x... )
    * c$ @5 A* Q- g6 }
  50. #define DMA_FN_IN
    # s' k/ V! I# Y# g. `$ E/ s, l; b
  51. #define DMA_FN_OUT
    * X, N2 a& k& Q5 j9 t! v
  52. #endif: D$ `+ D% l/ `' V$ ]. \+ z4 w, p" y
  53. 2 K3 ~. ]' L: s0 |1 {4 V! |3 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& C! o3 G6 n' X  h' L# n7 v
  55. #define STATIC_SHIFT                3( @0 g' C; r" v: b
  56. #define TCINTEN_SHIFT               201 F+ [: F, j+ N4 M
  57. #define ITCINTEN_SHIFT              21
    2 y, B0 j" n4 F; a; T
  58. #define TCCHEN_SHIFT                22
    # F4 F% Q1 X# m& }' P" g1 x4 Z7 J3 B
  59. #define ITCCHEN_SHIFT               23
    4 _8 M- Q. G% b# |) l
  60. . Q. i" `" a# }- i
  61. static volatile int irqraised1 = 0;
    & y6 ?' U4 M- S9 Z* q
  62. static volatile int irqraised2 = 0;! N6 R3 L& t6 ~9 X4 W5 P/ b& [
  63. 1 i7 P/ m1 q( ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + y2 D: a/ w$ M! l1 ?# M' q6 A/ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; S  D3 k8 w5 @% r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 S7 b" ]8 [; m+ [
  67. 8 ?/ _# f: Z7 Y: D/ _( F
  68. dma_addr_t dmaphyssrc1 = 0;
    4 J- c; e+ i; ^
  69. dma_addr_t dmaphyssrc2 = 0;$ S9 }! D% N2 c: Q" a3 Y6 J
  70. dma_addr_t dmaphysdest1 = 0;  l8 O$ d3 R* L4 X& g# |8 h
  71. dma_addr_t dmaphysdest2 = 0;# Y( n, ]7 H, H( o5 U
  72. " W/ x2 P, q: G' ]
  73. char *dmabufsrc1 = NULL;
    : \' c4 g3 }! \# }; l2 G
  74. char *dmabufsrc2 = NULL;) r4 ~' T- N* w5 v0 p- T( c
  75. char *dmabufdest1 = NULL;$ T4 }% E+ R/ Z! K
  76. char *dmabufdest2 = NULL;
    # n: ]* f- w: P! H* j) P. u

  77. 9 T  @, G* K6 _- l' b
  78. static int acnt = 512;
    # Z! k, W8 _1 z6 G7 L0 `1 G
  79. static int bcnt = 8;8 x, X9 p8 |" t
  80. static int ccnt = 8;+ c/ |2 d! u5 m& h: H5 O% K
  81. 3 q$ g$ K5 w% a6 ?# W) R0 w3 `: j
  82. module_param(acnt, int, S_IRUGO);, Q8 w3 F4 X: f, ^! \" K% y
  83. module_param(bcnt, int, S_IRUGO);
    8 C& H2 ]+ ~1 a8 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& c3 S# i/ j: q
& u- \2 {5 i4 ?9 j  T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- s, m$ Y# ~; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% d: G1 U# h- a$ A7 Z, o  U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ O: y! x% ?6 ~& ~/ e

. M4 N% g+ e* d
  W. O4 k( }8 O; y4 A' b) p
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2023-12-11 01:43 , Processed in 0.038048 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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