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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: i$ ~* @  |" u6 C( h: Q4 o
  1. [code]EDMA sample test application
    . B+ e. ]- \0 E5 b6 W4 F6 U
  2. /*1 U, T% b. \, B4 X8 F! ?5 e4 j
  3. * edma_test.c
    , n) W' P  [3 T7 C
  4. *
    ( c# U( K9 ]( H4 n! V3 q
  5. * brief  EDMA3 Test Application
    - B9 b, u6 u7 y- G( k  n! m# u8 }
  6. *
    / t5 B# i, Q5 s! U7 y* \) p
  7. *   This file contains EDMA3 Test code.
    & F* N5 A: I  W8 @" @4 Y% e
  8. *
      c/ r) Y7 }0 T5 _! e7 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  `7 k$ ^/ Z# m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + f* z6 Q0 S7 X) R" h! I
  11. *         TO CHANGE.
    ) D0 P% i" g2 D* C; G1 \
  12. *" L6 b* R% {# Y# Z" T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 G# N  S% g; D6 E9 ^- Z3 V
  14. *
    . ~. `8 m4 C7 T( ?/ P
  15. * This program is free software; you can redistribute it and/or
    4 t( C9 Q4 R# @: U
  16. * modify it under the terms of the GNU General Public License as
    # ?! u2 u2 M$ T) m- v- ^, {
  17. * published by the Free Software Foundation version 2.: |9 ]3 {" X8 q- m+ f3 A
  18. *+ K+ ^# {' J2 d9 W$ s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 P, i% P& Q5 Z, F" ~+ N! [
  20. * kind, whether express or implied; without even the implied warranty5 e9 h) o0 |7 p2 z- d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - `7 V6 {* T; u. p/ z
  22. * GNU General Public License for more details.
    " k% V2 @5 @0 U2 f% Z9 s
  23. */5 m" Q  u. L2 C, P# [
  24. ( ?8 t# [7 o7 P1 ?
  25. #include <linux/module.h>" S% K3 M3 A# ^/ O! F
  26. #include <linux/init.h>
    7 k" X9 N3 n1 L: \, I: u$ L
  27. #include <linux/errno.h>
    1 O. \+ H2 Q' S7 ?, t0 F/ }
  28. #include <linux/types.h>& V- W9 c6 m: k+ N! ]9 a
  29. #include <linux/interrupt.h>
    9 G* X  K  ^" i: A6 ]( B+ [3 `
  30. #include <asm/io.h>
    . y  n% E' ?+ M; h( l3 u7 v
  31. #include <linux/moduleparam.h>& |  I0 d- U' s5 z7 `7 o0 Z
  32. #include <linux/sysctl.h>; c- c+ ~/ }* m
  33. #include <linux/mm.h>
    ; d" B) Q5 C: H; C5 E
  34. #include <linux/dma-mapping.h># r& I# w, ~  d" q; `; o' T
  35. 1 V+ y% [! y- A% v7 E  D4 d
  36. #include <mach/memory.h>
    7 Z5 Z: y& k; N  B& F+ D/ R6 N! {
  37. #include <mach/hardware.h>3 _' {! A9 }: d4 f. O6 x( A  m
  38. #include <mach/irqs.h>+ K2 r. N- O4 x0 T# ?- O; R% T
  39. #include <asm/hardware/edma.h>
    + F( g- [* Z5 ^! H; w& O

  40. ' g$ L  g: t5 a" R; T% t8 D, C
  41. #undef EDMA3_DEBUG* \& X9 `- d' @* q. ]
  42. /*#define EDMA3_DEBUG*/
    8 Y5 W( n8 f5 k6 `8 Z
  43. 7 p4 S! X& h) {. _
  44. #ifdef EDMA3_DEBUG* e0 o; H* [9 A: }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( B. n% H+ \$ h' \: i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 h: H6 n, g' V( d( R! U* U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 M6 V4 j. c9 T- ]
  48. #else
    : v1 M9 W) u: u
  49. #define DMA_PRINTK( x... )
    . A" ]% P6 G. W" R) d, M0 i
  50. #define DMA_FN_IN& P$ U( j4 ^6 o4 t2 Z& d, d
  51. #define DMA_FN_OUT
      |: x" z* [! |" q' n' I0 S: e. t
  52. #endif
    5 X, Q" \( a4 B% c- c+ c
  53. % S& P# N# H+ _: ^5 _8 `+ m8 c' r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 P. S* L. E( u% \+ {7 K
  55. #define STATIC_SHIFT                3
    / ^1 t) m1 }; u9 E: ?" E: r
  56. #define TCINTEN_SHIFT               20
    9 ?3 u2 R. ~% O$ M, g$ y; M
  57. #define ITCINTEN_SHIFT              21
    " w. f8 {& l/ t4 B& B$ S3 Q
  58. #define TCCHEN_SHIFT                220 v# }% o0 z6 y
  59. #define ITCCHEN_SHIFT               23
    ( P  B1 W3 }; x- E

  60. ( P4 e" ~2 f5 y& F7 {3 a- j5 {' O* g3 u
  61. static volatile int irqraised1 = 0;- a: \! g, g. ?/ r4 a8 F1 P' e. X7 P! N
  62. static volatile int irqraised2 = 0;; V. }) C6 Z; N0 K" {  d

  63. 6 I! r# f% N8 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # l  H0 a& t% K! @) }) w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 p( `) h4 @& ]/ n! D& z( I; ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  W* _" R, G8 P1 i7 ^
  67. , R* z( j, n$ O7 R; ^
  68. dma_addr_t dmaphyssrc1 = 0;! w: L+ b- F$ t0 e1 ?% V
  69. dma_addr_t dmaphyssrc2 = 0;* \6 i: z# P) k- ~; e# ~  p
  70. dma_addr_t dmaphysdest1 = 0;
    . W! ]* w' s/ u+ n1 V; a9 w
  71. dma_addr_t dmaphysdest2 = 0;
    6 _5 E* l. S# W6 c2 r
  72. % D! y. E' f- L0 }
  73. char *dmabufsrc1 = NULL;
    : H6 H  a/ U+ G0 ^7 C; `
  74. char *dmabufsrc2 = NULL;% }8 P2 l. F9 v5 f2 ~
  75. char *dmabufdest1 = NULL;& r3 Q) F5 d: D8 V5 X, A% ]# O
  76. char *dmabufdest2 = NULL;
    0 b& w& r+ `0 L& M* D2 Y4 X7 f
  77. ' \: l4 ^* ?: I5 `
  78. static int acnt = 512;% Y1 o0 n& ?5 e1 x
  79. static int bcnt = 8;. D# d4 K6 I4 |5 S1 [# f3 ~
  80. static int ccnt = 8;5 ?  u5 k9 ?0 p; P; U
  81. 0 w$ e: N8 ], g4 {; y1 x
  82. module_param(acnt, int, S_IRUGO);
    ) N4 i: H1 h7 p- i
  83. module_param(bcnt, int, S_IRUGO);+ @+ ?; s0 [8 }2 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 Q( y% F' B) y8 C

! U7 [' U  D. t% ~0 h, H7 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ {) k8 s9 T6 j- y8 W- m. Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; o6 d: f4 H$ A  y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* [( p1 I7 a. U0 q8 t" b2 l; j

# X0 M; \; T& J* l& A6 [7 {0 V& W3 D2 S) Z7 ^& A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 02:59 , Processed in 0.040928 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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