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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 A+ H3 w$ f" Q' |
  1. [code]EDMA sample test application. l5 e5 g: h( M1 \. i8 p
  2. /*
    * p6 _5 w) U  S  {. ~
  3. * edma_test.c3 ], l( ?2 W4 [( b
  4. *
    3 }, ~* ^, k* U7 f
  5. * brief  EDMA3 Test Application: c$ A, j/ E0 H4 W' W- |
  6. *: P. o( D* X; D
  7. *   This file contains EDMA3 Test code.8 Y( [6 H) B8 ^+ x1 J5 _# P; N
  8. *" c8 ]! E. o$ H5 Q# c0 J( y4 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " O4 }- K! X4 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ f7 U+ B6 n8 g5 m" k( h/ }
  11. *         TO CHANGE.4 ?$ r, R) j0 k# Y
  12. *% r" ^- k7 E' s  h" p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( a1 w9 e7 I. }% |; u  d. H; m4 ^
  14. *: D1 @4 N2 Z9 _. J0 ~, p+ Q  G
  15. * This program is free software; you can redistribute it and/or
    . X! H7 {: t- [
  16. * modify it under the terms of the GNU General Public License as5 c/ z% v6 M6 e$ C+ Z
  17. * published by the Free Software Foundation version 2.
    4 H. h  ?7 c) ]/ j9 J
  18. *
    6 d9 n6 A) H* D3 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?0 M) ^, T+ Z1 c5 [
  20. * kind, whether express or implied; without even the implied warranty1 ]' _$ ]% `! k$ x8 I- \7 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ W- h) u( L' r" P
  22. * GNU General Public License for more details., `* W* u" e) [- D. g$ v% Z
  23. */
    ) q8 c; T1 \7 A4 Z1 @4 |
  24. 7 p. ^3 c: ~) d% g
  25. #include <linux/module.h>
    " \: u! h8 n3 _  o8 P; c; N
  26. #include <linux/init.h>- o, f( b7 w, T1 W4 ?) P! |! z, z, g4 V
  27. #include <linux/errno.h>
    1 z' E" |! G* w! m, f. {
  28. #include <linux/types.h>3 I5 D  |2 b% r$ [2 H
  29. #include <linux/interrupt.h>, B8 t/ n) v$ P% j5 t; ]" v" @7 h
  30. #include <asm/io.h>- {) T# u  K3 R( [5 u/ }
  31. #include <linux/moduleparam.h>
    / H8 [$ I" [! o0 q0 \: G
  32. #include <linux/sysctl.h>
    # m$ ~; ^, c5 U. B
  33. #include <linux/mm.h>' _, V* q5 q: j. e% m% t
  34. #include <linux/dma-mapping.h>; \2 [$ B. M: E5 H$ b6 s: o% p
  35. 1 c- n& J4 R  Z% d4 `
  36. #include <mach/memory.h>
    / K+ s, S0 ~" U: }
  37. #include <mach/hardware.h>& m3 E8 d( ], @% u. K/ X, w# o3 k
  38. #include <mach/irqs.h>
    : O8 Q1 ]* E3 v7 ?) ~! F. ^9 [
  39. #include <asm/hardware/edma.h>
    ; K3 x4 V6 A- o# j/ ^+ M" p

  40. - x: H( \9 D4 \6 }: C& C
  41. #undef EDMA3_DEBUG: p& g3 K  ?5 L/ ^
  42. /*#define EDMA3_DEBUG*/
    ! c3 M: s" F1 I1 w! K

  43. . C) J# H7 W# T; q* Z) h
  44. #ifdef EDMA3_DEBUG
    7 K; ^9 j  L2 v1 @, ^, R* Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 d, a, [3 |) k' j+ N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 h' m; h% K; [7 \4 H4 y# R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; z& `, u% c9 n7 U
  48. #else/ C% b# l0 X; P; T  k: v6 D4 F8 ^
  49. #define DMA_PRINTK( x... )7 V: e! Z- u+ M  R9 e. P
  50. #define DMA_FN_IN
    5 J3 H& p3 n* R1 R7 W* R' l
  51. #define DMA_FN_OUT
    ( J7 }! M1 }: Y( v
  52. #endif& ], A3 N8 P' D2 ^& P. N
  53. 6 `& Z9 z3 h$ [* Q6 Q( @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 `9 P* e. f: c; y4 D
  55. #define STATIC_SHIFT                3( Y( X; ^5 {& p
  56. #define TCINTEN_SHIFT               20- G! G* Q8 ^& I9 ?. B: ]; j
  57. #define ITCINTEN_SHIFT              21) c* b; F4 Y; r$ a
  58. #define TCCHEN_SHIFT                22
    8 X- ~, E$ c, i* Q" v' G
  59. #define ITCCHEN_SHIFT               238 G& d- W- V) }8 x, h! ?
  60. ' C$ y: M7 E2 g0 r! r; f) N( ]3 H) n
  61. static volatile int irqraised1 = 0;0 a3 H* k0 L7 d. y( F) x! W( l
  62. static volatile int irqraised2 = 0;
    . T4 K; [5 S* k, r# H4 X

  63. 1 W" P6 u  S* W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - l& \; d* m: [' s$ f) i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 X) E! D+ V( S5 p* T6 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o; g2 F) |% F
  67. " B9 S0 m3 Y( M& g% t! S
  68. dma_addr_t dmaphyssrc1 = 0;, c" L5 L+ B/ t: N
  69. dma_addr_t dmaphyssrc2 = 0;
    ! b& o- B7 e* l  u
  70. dma_addr_t dmaphysdest1 = 0;. o& T6 V8 t, N% `! U4 V
  71. dma_addr_t dmaphysdest2 = 0;
    * U. f3 m2 x) O7 ^/ x! i

  72. 4 J! r: R5 L5 E0 z/ J
  73. char *dmabufsrc1 = NULL;
    ! |& ^( |, E! O9 \1 m% v; v
  74. char *dmabufsrc2 = NULL;* P; d1 x! K0 y! j& f  l2 y
  75. char *dmabufdest1 = NULL;- s: T( @0 m8 P9 e8 _9 M6 }+ E
  76. char *dmabufdest2 = NULL;! [7 f4 h9 F* P5 N& f

  77. - e( W2 h# z. Q9 j2 r
  78. static int acnt = 512;0 @! a6 L4 x5 N* f5 I
  79. static int bcnt = 8;2 k) y# c$ Q5 Q- c3 F, g0 J" E
  80. static int ccnt = 8;' v+ m5 T: }! _4 m2 x$ Z1 y) [

  81. , k# ~/ ^5 f5 e  G  F- y; S
  82. module_param(acnt, int, S_IRUGO);
    6 h3 Z1 K, }+ S% w* ]6 l. ^
  83. module_param(bcnt, int, S_IRUGO);4 m/ g: c' F  p5 ^0 z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 p2 k% J! _, ?: r4 N' x# u$ q) @/ W7 g# I% L% h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 D! u0 |0 B3 {3 O- u5 ?, Z6 d' T3 }6 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Y7 e4 F; S3 u$ _; n( E- I$ ?3 p" A1 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" |! E/ |  m" c

- H- v( ?1 _  P
( H$ ]0 n% L# A2 U6 }9 Z- W) b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 02:16 , Processed in 0.036828 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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