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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / L# y4 m. V. ?" t
  1. [code]EDMA sample test application
    $ X7 T0 n$ M) S
  2. /*/ H6 _' h' b8 n9 Q( W
  3. * edma_test.c: d! `/ ^" S: L! m* X
  4. *
    1 x9 ?2 \" f8 X5 i1 p
  5. * brief  EDMA3 Test Application
    : ]1 U" |4 y0 m/ O
  6. *
    $ o: u! b+ O8 a  R0 Y) a& G7 s
  7. *   This file contains EDMA3 Test code.
    6 H) ~7 d9 Z% }1 k5 N4 G6 m
  8. *) _, K$ V  o  ^! m" F/ ~# L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: }; u( m+ ~( f( H3 j' ~( X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& k. F4 M- R8 |8 B' ~7 v, g
  11. *         TO CHANGE.
    1 L5 T& D5 M" Y- _8 d$ h% B! T
  12. */ U3 _# Q8 F) X# a' n4 U* m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 R) z  m) x6 t) X
  14. *
    - b8 k+ H4 j& y( {! U9 W5 F% a
  15. * This program is free software; you can redistribute it and/or
    " g: N1 C$ g& G; @# g7 {# t
  16. * modify it under the terms of the GNU General Public License as6 l4 s+ ^& t- G! T
  17. * published by the Free Software Foundation version 2.+ X& X6 l. M, @4 R8 ]
  18. *
    0 Q1 i& B2 r& k7 |6 |4 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . ?7 ]: b$ F& e; ^
  20. * kind, whether express or implied; without even the implied warranty: `9 s* F9 {+ S4 S; v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # C! c; l2 ?$ B! y. i
  22. * GNU General Public License for more details.
    # R3 k  r/ U/ j/ x6 }: H
  23. */; i- |5 H$ E8 W3 e. D/ h3 T
  24. # y2 d. a% ]9 b  b4 L, @
  25. #include <linux/module.h>
    # d  q  {  e/ M$ ~: @; ?
  26. #include <linux/init.h>
    - I9 ^8 j) f' n- |1 F6 S
  27. #include <linux/errno.h>. }$ u& X* ?% j7 N9 M1 Y
  28. #include <linux/types.h>
    . E- d) J. d' {6 }
  29. #include <linux/interrupt.h>3 C; n( y1 c& @# x) V& d
  30. #include <asm/io.h>
    # x/ _+ I9 y, t9 _/ |
  31. #include <linux/moduleparam.h>
    0 K4 k5 T; L* B& e& m
  32. #include <linux/sysctl.h>) ]7 A; D% d" Y8 i; k2 a
  33. #include <linux/mm.h># w6 P; J; T- t2 f2 I
  34. #include <linux/dma-mapping.h>- A7 s7 G8 l3 I

  35. 9 k% H) t3 f  E. x6 n
  36. #include <mach/memory.h>1 b1 ?6 I- b% U3 f; f/ J; d3 v. W2 U
  37. #include <mach/hardware.h>
    ; @+ @7 f# a' w0 z% j8 `' }( [
  38. #include <mach/irqs.h>! v# ?7 F+ L" }' k+ C
  39. #include <asm/hardware/edma.h>
    . T& Y  p! X2 k5 h# Z9 O# t5 R
  40. 3 V+ G; J& v8 o% M
  41. #undef EDMA3_DEBUG7 ?% n3 `$ ^! s% g
  42. /*#define EDMA3_DEBUG*/% n" V- l" E3 _7 _" [! a
  43. ( e( V9 g7 W* B3 ?" B7 w6 x: [) b: C, e
  44. #ifdef EDMA3_DEBUG
    & E& `" L- ?: T8 X0 j6 A( H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" h% @* Q' }7 c/ w1 x6 e& B/ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & [9 O- o: u1 S6 G1 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# J4 Y  L) V, X  \, F4 o
  48. #else
    / y' N2 t5 p* D- i$ v) F( R
  49. #define DMA_PRINTK( x... )0 i. c+ P; A3 w3 e
  50. #define DMA_FN_IN
    . |2 I7 E$ Z0 e7 v
  51. #define DMA_FN_OUT9 \4 m; `% @& u9 b. H; ]
  52. #endif
    ' [% o4 k3 }+ W0 C. `: D0 K

  53. 0 @  f4 b9 }5 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # u+ b  E/ N+ a0 J1 m( m
  55. #define STATIC_SHIFT                30 Y% N  Z% _3 \
  56. #define TCINTEN_SHIFT               20
    & `& p: W) J7 ?
  57. #define ITCINTEN_SHIFT              21" Q: K  i( N: F, K/ e
  58. #define TCCHEN_SHIFT                22
    8 I* \* O3 X% |* j: Z& R( D
  59. #define ITCCHEN_SHIFT               234 _" q& M; {* M9 C, c, z5 t* @
  60. 1 p5 y" j5 [. l6 ^/ b
  61. static volatile int irqraised1 = 0;
    / N* \$ `; c$ }% y
  62. static volatile int irqraised2 = 0;4 l0 \: G. I, F8 x+ u! q$ ]# y' s$ K9 M
  63. 9 O# \6 ?+ v# r/ P. b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  c( k9 K7 ]2 W* W6 L3 b" C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 O2 z( c6 N. h  l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 _: w( q9 D% w8 G& g; w
  67. 9 Y1 J0 X; X- c2 Q6 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    ' U$ k( T& d8 E$ Y! A" V/ I
  69. dma_addr_t dmaphyssrc2 = 0;  X8 R1 L5 U0 Q5 T4 @
  70. dma_addr_t dmaphysdest1 = 0;$ v3 }' G4 U8 u+ m2 M
  71. dma_addr_t dmaphysdest2 = 0;2 g) F$ N0 q. S  ^! R+ `

  72. % j3 T' J2 l: h3 y) w  l" Z- }- v
  73. char *dmabufsrc1 = NULL;
    , `0 H8 P. d$ I- T6 S6 ~' g
  74. char *dmabufsrc2 = NULL;% M5 u. [. N& G* X' L7 d) @; K" h
  75. char *dmabufdest1 = NULL;
    ' B2 i9 z4 \/ b- T& l
  76. char *dmabufdest2 = NULL;* A* D7 f" n3 q3 R; F4 ?9 _! f
  77. 1 e2 @6 h& n, x7 F
  78. static int acnt = 512;
    # N3 V6 K3 w, p$ f$ ?
  79. static int bcnt = 8;5 q; ^! t, F: b
  80. static int ccnt = 8;
    " o5 S# R% N; l/ `# v' F- M

  81. & N8 n& J' ^, R* b' Y' M  r5 l
  82. module_param(acnt, int, S_IRUGO);! `, f, c; w' x2 W* C" C& l
  83. module_param(bcnt, int, S_IRUGO);1 V7 s& A6 L# ~6 l3 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! c" g! o  X& R6 @
: A% [* V1 J- i% r0 c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; C6 s; l. r5 K: L" e+ c- J5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ z9 [7 ^" E; y+ M  P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w" v5 H) ^/ _4 X' ~: N) g/ o" W4 H0 a* r; ?
) v2 P7 w, ]; p  v5 c8 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 08:26 , Processed in 0.043989 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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