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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % T- p: G7 H* S- E
  1. [code]EDMA sample test application  V6 E" n9 p+ H+ b% O* g7 Y
  2. /*
    , Y3 H/ S7 [  h
  3. * edma_test.c2 n+ M  S) |  G7 h
  4. *' ~& x  Q, D+ A0 n- c
  5. * brief  EDMA3 Test Application
    3 N( p6 [9 J1 H+ ]9 H* F& W/ p; E: j
  6. *
    / O9 L& D' J: T6 Z* d
  7. *   This file contains EDMA3 Test code.
    / b( z, k5 l+ i0 K
  8. *% O0 |+ g3 f* Z# @0 u! U; ?2 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* B  [; ^/ Z8 \* D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ Y: v. n7 K% P3 J8 D
  11. *         TO CHANGE.
    2 z6 E, |5 r+ N  M- Q" o
  12. *8 ]6 u: Z, J5 p. |0 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! P$ A  O2 b& V* {3 Y7 ^0 D- I  P
  14. *
    % D# K6 w" k. D0 j2 O6 }+ y
  15. * This program is free software; you can redistribute it and/or
    / ~4 c8 d1 T( V) n0 d
  16. * modify it under the terms of the GNU General Public License as5 e. P+ @1 e# r0 `$ q4 n8 {$ ]
  17. * published by the Free Software Foundation version 2.! z3 i5 W' i& M8 {
  18. *  v% c" e. k; m8 q7 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; I5 t* s4 F: v6 A3 q; l, g3 n. y
  20. * kind, whether express or implied; without even the implied warranty
    # L4 v' D% O% l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 V; [$ u& |! f" Q
  22. * GNU General Public License for more details.
    " }% n  G1 O4 {* p/ R  p
  23. */
    % ?( ~4 T1 g+ z8 g

  24. . n: v% U* t# u7 N; }
  25. #include <linux/module.h>1 f4 U- R8 ?6 ]' p( E
  26. #include <linux/init.h>7 ^8 O) U# Q. D5 E; j3 G- k
  27. #include <linux/errno.h>
    - v! y! }% L! j
  28. #include <linux/types.h>/ Q1 b& ^7 `/ |# D) Q& f
  29. #include <linux/interrupt.h>  Y9 S. h+ Z. U4 ]2 I
  30. #include <asm/io.h>7 i7 G4 t4 `. i  t/ [* T
  31. #include <linux/moduleparam.h>
    : p7 X# B+ h3 v( s0 h, W
  32. #include <linux/sysctl.h>( n4 w, H, m2 j
  33. #include <linux/mm.h># l) F1 I1 @/ _: A
  34. #include <linux/dma-mapping.h>
    ' t9 W% y1 D1 G2 i/ M
  35. 1 a2 E9 K; i, s
  36. #include <mach/memory.h>& P: w' b, Q+ W/ q9 W" c, H* g
  37. #include <mach/hardware.h>
    6 w8 ?; @) e( y4 [( ]
  38. #include <mach/irqs.h>
    # N' N1 I- Q1 K! v' k$ l7 }
  39. #include <asm/hardware/edma.h># J0 X# D- S: m; ]# Z% j, \& `' w
  40. 4 h( ]$ F' H7 f  G1 \. v
  41. #undef EDMA3_DEBUG+ U. C+ F+ o! _! c0 {+ B
  42. /*#define EDMA3_DEBUG*// K+ M1 G( r" g+ G

  43. ' e( y2 W7 z- v
  44. #ifdef EDMA3_DEBUG
    ( o/ k+ C+ s. g' A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ p5 C* e4 ]& z9 S4 t0 \# B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; ]: r, j. ]' v( }9 G2 H$ c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 n. w; t  W( ]% }. q+ F
  48. #else
      G' h; r! q. o3 [7 ^6 c/ v5 b  S! H7 R
  49. #define DMA_PRINTK( x... )+ D; m% q2 X+ ^0 D. X
  50. #define DMA_FN_IN
    4 V! N( T. g8 W9 `- O' V! l0 Z
  51. #define DMA_FN_OUT1 {) S% @; E4 `/ r6 I* ?
  52. #endif7 x/ O* v- j; K. P: S3 j% A8 p
  53. , a' q" W# W* L) l/ T) \; n% r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % c2 B' f! D. ~5 j' g
  55. #define STATIC_SHIFT                3
    : ~0 L' h* C' `0 L7 d. \' u6 Q
  56. #define TCINTEN_SHIFT               20, s! R$ P$ i$ t3 ]1 I$ E6 T
  57. #define ITCINTEN_SHIFT              21
      g) O$ A+ N( W4 q0 O, T
  58. #define TCCHEN_SHIFT                22; V- S9 g. Q0 l% f& v
  59. #define ITCCHEN_SHIFT               23$ Z# Z8 R3 A/ _1 Z

  60. ; u: W, K/ U: }. r8 W$ y
  61. static volatile int irqraised1 = 0;& W0 t8 a6 `; ~' x; A. [
  62. static volatile int irqraised2 = 0;
    6 j4 W% m; m2 z% U

  63. 2 D8 w0 |8 y( q8 v+ M0 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u$ i+ G. C) f$ z0 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : t! v8 y1 Y. X; ?7 u! {! C! r6 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D9 x; o' a6 R2 j- k1 v) d% I
  67. 5 ~* \9 M6 F' U$ }# x+ [4 i1 _
  68. dma_addr_t dmaphyssrc1 = 0;
    8 u5 |* e$ Q/ q8 x4 |
  69. dma_addr_t dmaphyssrc2 = 0;
    ! t7 B$ `! i4 O
  70. dma_addr_t dmaphysdest1 = 0;
    - n( z5 F: W  b7 o# N4 x
  71. dma_addr_t dmaphysdest2 = 0;, R# c( `4 g4 f; g! k8 r
  72. 2 G! y4 W" Z* f5 N% T( n
  73. char *dmabufsrc1 = NULL;' F# i$ ]) {& Y& M
  74. char *dmabufsrc2 = NULL;
    3 C3 r4 O, S4 f- G# L7 F6 w+ i
  75. char *dmabufdest1 = NULL;
    + f7 U2 e" M3 X5 U- c
  76. char *dmabufdest2 = NULL;( z6 U1 y8 y1 z& C; e
  77. ) A' S# U: B' ^$ t0 h
  78. static int acnt = 512;
    2 `+ l/ }; l* @8 R
  79. static int bcnt = 8;: t" s  S; ?- m; ^$ T: Z
  80. static int ccnt = 8;
    ' f  u' S0 T; i/ Y" p
  81. . W! K* A. W6 e
  82. module_param(acnt, int, S_IRUGO);/ `5 \$ I8 K0 h
  83. module_param(bcnt, int, S_IRUGO);
    ) h6 f. ]0 y: D* E) o' a% o3 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" I8 N/ r7 Q; z4 l2 l3 _. p
" X2 x" X& c- ?  x; [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 m8 T# `7 S5 {# ^' w& ]; }6 M5 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 K7 |  x" D, }4 H, o8 b' f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! O! u" t: M; ~

- b7 D6 b0 l5 a6 A5 \7 t# ]; E7 P8 j* k5 V9 l+ }3 p& d( j2 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 11:59 , Processed in 0.038879 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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