OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . O0 D# j8 S- P  c4 Z
  1. [code]EDMA sample test application0 Q9 F( C" {% Z7 P
  2. /*! k& Z4 J% P' |" X- u
  3. * edma_test.c
    ' h2 Q' L, y' s1 v; N- U3 E( H
  4. *0 z$ C  d# z* ?3 J" n* ~3 }3 N, j8 J
  5. * brief  EDMA3 Test Application
    2 E; w5 i, I. p! ?" z1 W: H
  6. *& P  a1 Y9 d6 A4 Q# J
  7. *   This file contains EDMA3 Test code.7 d4 X8 t3 N- p
  8. *
    - [3 E* I4 @; t4 |# I' \' S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( j" ^$ `! B2 b1 A* E6 a$ N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" a, b: i% A" ?- v) C! h1 {+ n
  11. *         TO CHANGE./ ~) n, d% g( `1 Y, M9 a9 {
  12. *
    5 c7 \! X9 X+ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; T' b: ^; I$ x9 I% G5 N1 m
  14. *: |7 `6 X1 p+ y
  15. * This program is free software; you can redistribute it and/or
    + V* y2 ]" {- U  h# a
  16. * modify it under the terms of the GNU General Public License as
    3 |, J9 v7 }# ]& A+ u# O
  17. * published by the Free Software Foundation version 2.4 s# p6 }6 O5 B6 S
  18. *, @5 \1 [; v, Z' ?* n# w7 x) \& x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ c+ j9 E$ V  q1 c
  20. * kind, whether express or implied; without even the implied warranty
    + \. D: m6 s5 r  j6 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - M/ b8 I' j5 @2 r' f8 W( S
  22. * GNU General Public License for more details.
    2 `6 C) u8 i1 m0 ~
  23. */
    ( `  N+ ~8 ^% s' f  L  @# ?- T% B* t) T

  24. % N% E& ^; E2 \5 F$ t/ P
  25. #include <linux/module.h>4 l+ K/ R2 _6 {8 ~) i* G
  26. #include <linux/init.h>5 \1 W& p- {. `* X0 F9 x: x
  27. #include <linux/errno.h>9 k( w/ q, o7 e7 r$ y8 @
  28. #include <linux/types.h>
    ' R" N0 Q# W9 I6 _
  29. #include <linux/interrupt.h>
    + |7 ?5 [* K$ c# H; U
  30. #include <asm/io.h>7 w7 n) Y! y' {+ y; q
  31. #include <linux/moduleparam.h>
    0 }6 n3 H6 E! n% P5 O6 e" Z. }
  32. #include <linux/sysctl.h>$ K- v+ R7 `/ G
  33. #include <linux/mm.h>
    # w6 Q& s+ p1 O' ?: X/ M  u
  34. #include <linux/dma-mapping.h>$ L% _$ [  u8 X. X2 R, G, }
  35. 7 ^0 b, O- X, P6 \4 K' Q# z9 g
  36. #include <mach/memory.h>4 A/ q7 U, [# [5 T
  37. #include <mach/hardware.h>
    8 f9 q  t* Z7 ~: D7 ^5 I
  38. #include <mach/irqs.h>
    $ l4 i: F" [9 t6 i5 ?% m  e
  39. #include <asm/hardware/edma.h>4 @3 T' P# h' e* n

  40. $ k2 T5 {! b: a8 a0 O# O/ V
  41. #undef EDMA3_DEBUG7 A, T9 t# u8 X( ?: n
  42. /*#define EDMA3_DEBUG*/' h5 P' D  m8 }+ y" U

  43. 4 `% u' U, x$ ~! R
  44. #ifdef EDMA3_DEBUG
    ! ?! V! |- d2 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 j. G( g# H$ f- I' s# M6 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- v- Z. T) y1 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 E1 E6 w7 h3 |
  48. #else
    # b# O0 |/ Y  G: G+ c
  49. #define DMA_PRINTK( x... )
    & Y  y' O2 z5 a/ C$ t1 `
  50. #define DMA_FN_IN
    " t( H/ x2 _2 `  W/ ~1 n, y
  51. #define DMA_FN_OUT
    # F, }, W# R  N, O; r* m
  52. #endif- U/ J0 w: q0 K

  53. * _! `( f1 Z- y' G( O: d" G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - N0 z5 [$ }4 c" w2 e
  55. #define STATIC_SHIFT                3( a; L& U5 V/ k- r- J
  56. #define TCINTEN_SHIFT               201 k) S# M2 ]& V
  57. #define ITCINTEN_SHIFT              21
    5 ^& o* Q8 v% W% f
  58. #define TCCHEN_SHIFT                22& ~1 d3 C7 R# X
  59. #define ITCCHEN_SHIFT               23
    1 \* Q3 ~' n/ Z

  60. ' k3 f5 {$ U: X( ?' C
  61. static volatile int irqraised1 = 0;
    6 U) [  I- R* k' B
  62. static volatile int irqraised2 = 0;
    ( c+ ^4 S0 a' c) Y6 n
  63. : _2 f( o6 k# }! q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I& z1 d3 `2 O' u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 R4 N& r1 @) `- T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q0 p- A+ T7 j/ Q2 c9 K3 A
  67. 1 T/ M' U6 I( x& ^: Q
  68. dma_addr_t dmaphyssrc1 = 0;2 C: t  S/ u7 S% g0 ^
  69. dma_addr_t dmaphyssrc2 = 0;2 p2 \& ~% u8 G8 z
  70. dma_addr_t dmaphysdest1 = 0;" P8 ?& l: W8 i* ?/ D1 f+ x
  71. dma_addr_t dmaphysdest2 = 0;4 p$ P+ o9 o( `( v9 ^
  72. ! p9 H5 `0 D: ^+ T$ J9 Y7 v
  73. char *dmabufsrc1 = NULL;
    & p+ C! D* e; U' c/ Q. }* \+ y' u
  74. char *dmabufsrc2 = NULL;
    ( n/ D4 w; d& j  O& {5 k
  75. char *dmabufdest1 = NULL;
    / l8 {/ s' c, a
  76. char *dmabufdest2 = NULL;! g2 ^; x  ~9 Q8 W

  77. % ~: A2 Z: ^, A5 O8 t& ^8 p
  78. static int acnt = 512;
    / X( `' E5 K; A
  79. static int bcnt = 8;' w! h1 F& R/ _3 w5 d
  80. static int ccnt = 8;) ?* g! B* T2 L  I" P% Z
  81. , p+ n+ F- P3 b2 k9 H8 n. l
  82. module_param(acnt, int, S_IRUGO);3 C* i* }( s5 _1 d7 O) L, @; s
  83. module_param(bcnt, int, S_IRUGO);  O" D% N/ F4 ?4 V8 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 X0 U: z5 i2 d4 F+ Y& I. K
( D/ m' G/ Y) i0 x$ ^. \# n5 m# E! ]1 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; U7 }0 R* i' L- p5 o! T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! }# h2 n; [$ I1 K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" L; S% ^4 X* o7 U1 R" ^! S

0 b: L! ?9 m% U2 r$ A) X0 Z7 D8 l. s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-24 22:19 , Processed in 0.039925 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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