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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" s$ r% r, w, U5 I* ?: I: D
  1. [code]EDMA sample test application, W  @, B1 Q% O" Z( h6 [
  2. /*$ e$ M$ x1 s/ ^, t
  3. * edma_test.c
    ; p9 t- G& j7 ]6 K3 @8 Q% ~
  4. *" C) ]) T. M# n5 h" C
  5. * brief  EDMA3 Test Application
    6 W+ h# x9 c( U; U4 m. j+ N% K
  6. *
      v  F: V! t$ B/ \" I
  7. *   This file contains EDMA3 Test code.
    ) p5 y, o1 w6 `
  8. *' h4 S+ n" E" _' O' g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( O* }- m/ U) \) g7 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ a7 ^9 A: S4 p
  11. *         TO CHANGE.
    ; t) P7 ]# N. U
  12. *
      i* x; S% j2 G! Y) [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 f" ^9 y& [: u2 M) A
  14. *
    4 K6 O" m3 g. j
  15. * This program is free software; you can redistribute it and/or
    0 p) y( k4 h: p/ V' Q. v
  16. * modify it under the terms of the GNU General Public License as/ Z0 u- e9 H% Z
  17. * published by the Free Software Foundation version 2.) M5 l" A! G% c2 o2 k! K9 S+ y
  18. *7 e& \, U. U9 }; G! y$ g0 X9 P- O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 r8 _  c( t4 V* W% L  \( i
  20. * kind, whether express or implied; without even the implied warranty) d& z/ A2 F. A/ b# j; s5 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( ]" J4 H3 A1 b% r; L8 B0 @/ c
  22. * GNU General Public License for more details.
    . N3 N/ E9 m, M# B2 `1 [
  23. */  v' |, ^. \6 Y$ w2 b

  24. 3 r' Y& {2 e% k8 S( F/ \
  25. #include <linux/module.h>
    6 o7 M  L  x6 V3 f+ N7 v
  26. #include <linux/init.h>$ f% G, B: \9 F" Z. @6 N+ p0 M
  27. #include <linux/errno.h>
    * T1 B0 v- N: R& r& I
  28. #include <linux/types.h># W, O& U) R( r& m& l6 Q5 }
  29. #include <linux/interrupt.h>
    # |$ X, p0 I  M0 N& f
  30. #include <asm/io.h>! E3 N1 D: D: N
  31. #include <linux/moduleparam.h>
    $ H* r, M1 C& W
  32. #include <linux/sysctl.h>( f1 e  T/ q, x; I$ F" T
  33. #include <linux/mm.h>( W0 t! m, y! o
  34. #include <linux/dma-mapping.h>
      ?+ z7 V0 O# f1 n" w
  35. 9 H7 y  a; I) k4 ]! z
  36. #include <mach/memory.h>
    ) N+ ?, `5 X6 ~: o6 I4 ^* P6 j
  37. #include <mach/hardware.h>
    * w* s2 F% c2 `, n6 k
  38. #include <mach/irqs.h>* d1 A) d0 d4 f; t  E* t
  39. #include <asm/hardware/edma.h>0 z6 B4 p6 j9 i

  40. # B2 }1 c; v4 U7 |5 k$ W
  41. #undef EDMA3_DEBUG
    : b0 P0 f6 V$ b
  42. /*#define EDMA3_DEBUG*/
    9 V# }0 w; q, R9 Y3 W# U0 w# E
  43. ( k! a) \+ n* x( r% |! H
  44. #ifdef EDMA3_DEBUG: v& l# }( o: F8 q' x2 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / m. X3 ^8 K9 D1 n* n( w5 h3 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 X% O0 z, y* y; Z! A! F" U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 n$ p- H; b8 G( y0 H- p
  48. #else
    2 W: A1 _9 j1 r; t* P- D
  49. #define DMA_PRINTK( x... )
    ! ], B% B/ ^$ |/ r7 H3 z$ V
  50. #define DMA_FN_IN
    2 ~4 `' f& {+ S  l7 d0 p3 g
  51. #define DMA_FN_OUT
    2 }, G1 N. S& {
  52. #endif5 g/ e" _# S; y. @" j3 U

  53. ) [9 p. B( N4 r2 u8 R% |: B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 n( M5 K& B# u
  55. #define STATIC_SHIFT                3
    ) ~; M4 ~' L8 Q, `
  56. #define TCINTEN_SHIFT               20+ D  D5 q+ e! d/ x
  57. #define ITCINTEN_SHIFT              218 v0 a6 ], N8 C" U9 f2 S
  58. #define TCCHEN_SHIFT                220 Z7 ?; {( a% @1 L7 L) c7 I
  59. #define ITCCHEN_SHIFT               236 b+ |3 a  ]3 M# [0 l& j
  60. 0 W9 R/ b- G: g
  61. static volatile int irqraised1 = 0;1 J' n) g) a; ~, g
  62. static volatile int irqraised2 = 0;+ l0 v; L- Q  u; i4 e

  63. ; L* @: W' ^& p4 w3 F0 b% a5 W# @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }7 a5 h4 m5 X5 a, ]: w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k0 E1 T% u2 l9 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ?. W1 z) p4 O3 w; \
  67. % B2 V6 v& O$ Y: h
  68. dma_addr_t dmaphyssrc1 = 0;& ?1 V/ G3 h$ C/ M6 K
  69. dma_addr_t dmaphyssrc2 = 0;7 K5 y  p% c/ s1 h3 h0 V7 {
  70. dma_addr_t dmaphysdest1 = 0;2 c5 E8 T) H- N8 F& D- a
  71. dma_addr_t dmaphysdest2 = 0;6 G4 ?2 z. [) o
  72. / d7 ]7 z5 T) U* p) c1 Z
  73. char *dmabufsrc1 = NULL;
    " Y( I: Q3 _$ d! P
  74. char *dmabufsrc2 = NULL;0 g# D$ g2 o, Y8 j9 B
  75. char *dmabufdest1 = NULL;: ?' X2 k( @; x
  76. char *dmabufdest2 = NULL;
    - p( u  E5 c& r' R# Q- d
  77. % _! Q# Z4 J# U+ G
  78. static int acnt = 512;/ U: l$ K' {9 T' _. R3 ^5 v8 l
  79. static int bcnt = 8;( K& {5 J; D+ S5 _5 v/ O7 Y
  80. static int ccnt = 8;2 V  `$ c2 o% R6 z6 \& B& h

  81. 6 Q' [# J) D4 D6 a: a' L
  82. module_param(acnt, int, S_IRUGO);, R( y" z! l. w* R' ]$ q6 `
  83. module_param(bcnt, int, S_IRUGO);
    9 }  u5 J( K% y1 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- F; U* e. H! Q5 F" ~2 b& ~+ v7 u( w4 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 H, k$ C3 v: O* r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 R1 R$ h2 ^# M7 K* C. R8 ~* y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" j+ b$ n& `" w( V1 }$ i: ]) B

* v( M" S/ M. J" r1 u* r5 e' a9 \2 E" x( y& e3 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 18:21 , Processed in 0.044795 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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