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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& f* B6 y- B6 q. W! r- b# c
  1. [code]EDMA sample test application+ F' m( s, h5 v" H
  2. /** B( J" z+ z2 [# ]
  3. * edma_test.c3 [( H' _  d! O4 v! T3 ^6 i: ]
  4. *2 w3 ~: T9 b5 B
  5. * brief  EDMA3 Test Application/ O! a9 \7 x3 ~' O; }- o$ K4 L
  6. *; E) V2 U/ S7 h. l
  7. *   This file contains EDMA3 Test code.5 F; b2 Q  ?0 x) p$ L5 W; S4 R, b
  8. *. n8 @$ q# V# O5 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 @1 P- `4 X, J9 l8 Z% |" Z, U6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . K# W, c, j5 i% I0 {& U" n
  11. *         TO CHANGE.
    ! P0 x$ u" A/ y2 q' [9 f6 i: E
  12. *$ g. ~, x' c8 q; ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; T; ~1 j8 ]) }3 l- N9 U
  14. *# p8 k. e7 s  Y
  15. * This program is free software; you can redistribute it and/or
    - {) f5 Q0 P; H1 z
  16. * modify it under the terms of the GNU General Public License as
    9 v! a8 Y/ c9 M( y1 ^5 N: l$ g
  17. * published by the Free Software Foundation version 2.0 n, j' {. j# N8 ^2 D8 \6 l4 a
  18. *3 S, q; a9 \4 R- t, x1 H  {3 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & x% j/ J; D# E" I2 I
  20. * kind, whether express or implied; without even the implied warranty" G3 e* E' _5 J# e: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. Z4 g7 K0 C1 \/ G+ j( B6 i
  22. * GNU General Public License for more details.
    . v, F5 p5 A. ]3 c( H! M
  23. */# l  T6 U; G1 {% ]

  24. . G) M# g/ b7 F" P
  25. #include <linux/module.h>; |, N6 o7 F1 \3 x0 [6 M
  26. #include <linux/init.h>/ D, n* D5 T& P& }7 s
  27. #include <linux/errno.h>! P$ u/ g: K2 @
  28. #include <linux/types.h># z3 _8 O$ T: X# l2 E: W
  29. #include <linux/interrupt.h>( R" y) O. {4 I6 k8 i8 |
  30. #include <asm/io.h>. Q  B; w6 j4 N- _4 _1 M
  31. #include <linux/moduleparam.h># K# X/ k1 t" G" [' u
  32. #include <linux/sysctl.h>
    4 y7 K+ m' o9 {$ d
  33. #include <linux/mm.h>
    $ L3 a8 ~) ~# I% h' E  [4 i8 k7 ^
  34. #include <linux/dma-mapping.h>/ E3 B% Z% R& B  s, d) T3 q( ?

  35. - I3 a; ~0 O* O) V
  36. #include <mach/memory.h>. L* P, K3 h' @/ e( p- p
  37. #include <mach/hardware.h>
    ) r3 W! h2 r, O/ D$ n, K
  38. #include <mach/irqs.h>
    2 |0 @+ u% S$ w0 |' F; f$ _
  39. #include <asm/hardware/edma.h>8 b0 ?1 c: z. N4 M( ~
  40. 5 V7 l3 q: _/ u. |2 T
  41. #undef EDMA3_DEBUG$ Y1 f! Z# p  C% C( e
  42. /*#define EDMA3_DEBUG*/
    . T; k. s; ]3 Z1 }/ W) {
  43. 1 D( u: E# ~# z: u4 C. b+ p
  44. #ifdef EDMA3_DEBUG
    / B) r  z' O  R. A3 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) W: I$ y) l$ B; d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + u9 A, G; C" M. m$ L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( h0 q9 v4 s; y4 W+ R9 _& x, Q
  48. #else5 H6 ?) R* n+ T9 G, Z* Q% B2 V2 _
  49. #define DMA_PRINTK( x... ), Y5 H  Y3 h: F
  50. #define DMA_FN_IN2 f" U) H6 `8 R4 T3 i
  51. #define DMA_FN_OUT1 r  }: K! _; Y- Y6 W4 C8 R
  52. #endif
    ! e) I2 s) D' v6 w3 h1 C2 d
  53. & l- D2 L* ?! @% J2 t* _5 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 ?) z) X! E6 G
  55. #define STATIC_SHIFT                34 E( d- f: m; k/ A
  56. #define TCINTEN_SHIFT               208 a7 w3 u0 ^6 n! J6 _+ _1 x9 _
  57. #define ITCINTEN_SHIFT              21* n9 }6 N* w2 K7 J
  58. #define TCCHEN_SHIFT                22
    0 H4 ]0 }$ @3 Y
  59. #define ITCCHEN_SHIFT               23( g. N8 i& ?- l3 v
  60.   t5 E; v5 U3 q& S& ^+ O& F
  61. static volatile int irqraised1 = 0;
    . D8 c- _* _+ ~- v# M; c+ J& u
  62. static volatile int irqraised2 = 0;
    1 f. @2 g3 `. U

  63. 1 {2 n1 R* I* A( Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% O- u/ ?' J5 A: g4 e* z* G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 x7 X! }; ?5 `. T2 |. q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 G# V+ M" Y' @0 W9 }, f

  67. 0 ~8 q8 y8 v1 R
  68. dma_addr_t dmaphyssrc1 = 0;
    5 G5 Y; c- W1 Q3 W" w$ X8 r
  69. dma_addr_t dmaphyssrc2 = 0;
    , {: W/ l, Z0 X. o  w- U) v
  70. dma_addr_t dmaphysdest1 = 0;( j; D2 `$ h# }& s
  71. dma_addr_t dmaphysdest2 = 0;" P3 [, h! `+ R# m) l) N' {

  72. + ~" ]/ n4 y" p! a- I/ H, L1 T
  73. char *dmabufsrc1 = NULL;
    6 |. ]5 b9 ^0 a3 n' Y' v6 i9 h
  74. char *dmabufsrc2 = NULL;4 l. T$ t1 q0 ^3 [0 w
  75. char *dmabufdest1 = NULL;6 _' A7 b  g5 ^0 G' P# C" m
  76. char *dmabufdest2 = NULL;3 W- |. w, p2 z9 J. Q
  77. 4 G/ [+ y& X' `5 g; D1 R9 Z
  78. static int acnt = 512;1 f& W  F) q; m/ t! v2 [; R, T* f
  79. static int bcnt = 8;
    ) v7 m/ b/ {4 R
  80. static int ccnt = 8;% O6 E2 H, Q7 Z6 q& e
  81. 9 p$ C+ N, W5 [
  82. module_param(acnt, int, S_IRUGO);4 [' ]0 T! U" o+ N; K: `
  83. module_param(bcnt, int, S_IRUGO);0 |, Q$ I# y7 c# I+ m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- o# C+ r: q, T6 \: n' Q! [$ I
" e) k1 s. Z0 K% [) S7 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E, f& L! w4 b, c8 ?/ H! Q% Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) e) E4 R$ D" [  o# w) d7 Z+ Y' o3 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 O2 D& S4 G  j/ {' z/ U- K) V  Q% W' @& s

: s3 E% E. [+ @% X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 08:45 , Processed in 0.041571 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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