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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; |$ R  V( o- l
  1. [code]EDMA sample test application
    8 ?! n. B; e3 P# m9 L3 S4 @, |& w
  2. /*7 w0 @) g) l4 C
  3. * edma_test.c9 s* }* N% R5 t2 k6 U; f
  4. *
    / _3 K7 N9 |4 f% s& @
  5. * brief  EDMA3 Test Application' [6 |" ^1 Q: w8 z3 K
  6. *
    - }. n+ W- Q9 s8 @! O" Y" o
  7. *   This file contains EDMA3 Test code.* B$ {5 e1 d' u" r
  8. *
    1 m7 d. l0 u# S8 j& }- g7 y! N' o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / @! x6 o1 c! ?, ~9 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ p, O+ m5 ^- h0 G' g
  11. *         TO CHANGE.
    & D6 K0 ]" \$ A' D: i
  12. *- N8 e1 J+ ~0 [  d. Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# s5 Y! w3 S$ W6 ~+ C
  14. *
    / W; z  L- l& B5 j' H! e4 w$ R6 o
  15. * This program is free software; you can redistribute it and/or
    9 B2 S- c- t9 G7 G- l& z' p0 X
  16. * modify it under the terms of the GNU General Public License as6 H# Q) Q6 `, y" d( W
  17. * published by the Free Software Foundation version 2.
    1 R2 I1 U/ ~& H+ b
  18. *
    # I: n4 o, C! }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , H6 h  `$ Z8 B& {% z# c
  20. * kind, whether express or implied; without even the implied warranty
    " l3 n; w& D9 {. [$ s( T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & M3 T2 y5 U5 s4 M/ M$ C. q
  22. * GNU General Public License for more details.
    ; M9 P/ J" N% |* W* Z( k4 ]+ u! m
  23. */
    6 \( e& j! O; |! u9 R3 m) d8 V
  24. 4 ]! n' e! ]3 a
  25. #include <linux/module.h>5 `) t9 m, G% K$ P) H9 X. @
  26. #include <linux/init.h>
    - V& r. Z  g1 _& ?
  27. #include <linux/errno.h>; t1 l" W6 K' U3 W4 Z
  28. #include <linux/types.h>, @* V( T; w' f
  29. #include <linux/interrupt.h>
    - {% c" L8 H" u0 B+ P$ Y+ z
  30. #include <asm/io.h>. t* C3 A7 J5 N
  31. #include <linux/moduleparam.h>
      I$ f  M6 J/ r; I  s& j  r
  32. #include <linux/sysctl.h>7 u& J& z0 Z, r
  33. #include <linux/mm.h>
    4 K, K! ?1 n1 f6 @/ @$ e
  34. #include <linux/dma-mapping.h>2 a4 C" o* |. B1 n
  35. $ R% T. ^( W. z! }% H
  36. #include <mach/memory.h>
    ) U7 {) a$ U4 R. c* [; X+ i3 f
  37. #include <mach/hardware.h>5 c. l( U+ [: D' z7 W- b: ^
  38. #include <mach/irqs.h>
    ( j5 u2 Z. K3 s' Q5 w: D1 q
  39. #include <asm/hardware/edma.h>0 \/ h4 Q0 B/ W8 [6 U
  40. 5 N8 @6 b* ]7 [+ h% t# P+ R
  41. #undef EDMA3_DEBUG& w' i2 G( ?' A' Y+ c; W, [, a
  42. /*#define EDMA3_DEBUG*/
    ' L0 \: Q% y& n
  43. & S2 E* m: u, S" f  @# U4 o, z
  44. #ifdef EDMA3_DEBUG
    * b& u, R0 i% [, B; ~3 d5 ^5 _/ r5 p9 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / I2 w- N& w; k& l. l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( v# @/ y  X5 B% g* |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( z' p, D2 s8 J
  48. #else
    / F) K3 |+ m+ `
  49. #define DMA_PRINTK( x... )
    3 ?; \$ t) @" V& ]5 s* `4 Q
  50. #define DMA_FN_IN
    , ]7 P0 U! k9 k" M1 x
  51. #define DMA_FN_OUT% ~. P7 S' ]# x  x
  52. #endif
    9 Z# q4 G, M  a3 E3 U: p" e1 M
  53. & V$ _+ r1 ]( t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; C$ ~3 ]( ]- T, Y
  55. #define STATIC_SHIFT                3
    . A& S' j' T4 r8 }  }& ?
  56. #define TCINTEN_SHIFT               205 P, c) N. `$ M- E9 G( K: J$ _
  57. #define ITCINTEN_SHIFT              21" h8 z3 ?7 q3 H& ?" e* K0 F
  58. #define TCCHEN_SHIFT                22
    7 z! t# f) d& I  U9 l
  59. #define ITCCHEN_SHIFT               23* k8 h. l; l) {' T+ c

  60. , t) F2 S/ C! f& y# E, @" U
  61. static volatile int irqraised1 = 0;
    3 V9 V3 d4 G4 ]' m
  62. static volatile int irqraised2 = 0;
    : O: E8 u- ^$ g5 s' m* O. p( ?+ A
  63. ; \- D: E) \) r  I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( g3 y: u8 ~: X! q) s1 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- j. \/ u% W  T7 h, r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l+ w, Q. Q5 `/ K2 l( P

  67. " p9 x# s& X5 D: z+ \3 c( w. y
  68. dma_addr_t dmaphyssrc1 = 0;5 `, c9 ^9 |0 I5 P  M4 m- f$ J) k
  69. dma_addr_t dmaphyssrc2 = 0;
    " a9 r) f# r0 ^5 ?: a
  70. dma_addr_t dmaphysdest1 = 0;: e, m' r  Q* G+ T; ]
  71. dma_addr_t dmaphysdest2 = 0;5 A7 R  ?$ D* F+ d$ R
  72. , ?3 H2 j6 b; {, ~& I
  73. char *dmabufsrc1 = NULL;8 T, y& _5 L- h- e, Y
  74. char *dmabufsrc2 = NULL;& M0 c& j3 U8 q) C; J1 J
  75. char *dmabufdest1 = NULL;
    / o, u7 ^4 J" a# v4 c
  76. char *dmabufdest2 = NULL;& v! R& R$ ^. ^- m+ S
  77. . y. p# O( f  ^7 I$ ^1 O7 O
  78. static int acnt = 512;
    4 Z3 {6 o8 ^5 ?% T6 S# e
  79. static int bcnt = 8;/ Q; x' c- \( b& m& ^
  80. static int ccnt = 8;* D5 w5 x4 p% J1 D+ h/ X7 b

  81. " g0 B) U5 @& r
  82. module_param(acnt, int, S_IRUGO);
    - F( W6 z$ f, K$ s+ C
  83. module_param(bcnt, int, S_IRUGO);
    5 q+ r- F- a: R  I0 W3 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# u, w* \# g: v5 G0 P" {

" D$ H9 I- A" f! E7 I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 D+ M1 U4 D! ?. l' [: q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' G3 M0 \/ i+ X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& y4 Z6 E- @- c; X# X7 t. x7 `

- J4 }& v( d" D% Y) a& [* ~5 R- g9 U* H
6 B) o+ z8 `  K. C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 09:34 , Processed in 0.036937 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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