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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . Y0 r9 M7 n4 L8 v: x0 k* t5 z! T/ x9 c
  1. [code]EDMA sample test application
    ( K1 Z7 j9 ^. H% v) ]( K% ~/ S& b
  2. /*
    : q5 I, t9 n+ i2 V+ y% O
  3. * edma_test.c" K2 T$ B8 W, D
  4. *
    , E1 M- E% }7 q( ^
  5. * brief  EDMA3 Test Application8 Q% c0 g! g  H3 q9 q
  6. *! d# e7 O& D" T) a' y
  7. *   This file contains EDMA3 Test code.
    6 p6 B- b8 q, f* u  l& o
  8. *+ B% [  v% b" {* I5 |0 |1 B* [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      y4 {( k6 X. V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ^, v! I$ M/ K
  11. *         TO CHANGE.3 C& G+ C' K% @' k4 e3 l# _+ {' ^. ^
  12. *; y# Y2 h  z: d" @! A8 S; r; h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 J- D+ z4 ~, z7 g( a4 v/ }( i+ ~: ?( I
  14. *
    - ~) x- }$ H" V$ Y# ?# q' N
  15. * This program is free software; you can redistribute it and/or
    % M8 [3 S2 [8 s" w
  16. * modify it under the terms of the GNU General Public License as& I+ N. H2 Y5 ?0 n4 p, o
  17. * published by the Free Software Foundation version 2.
    + M1 D# n5 Q, H4 A. x+ W" v
  18. *
    - P4 N1 Q& z" l4 D' P2 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# G8 `: j- m+ h* r; D6 X& O' ^
  20. * kind, whether express or implied; without even the implied warranty! M0 Q6 L0 s( m7 c! a! b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 b0 G7 A) A1 g. F6 [3 V
  22. * GNU General Public License for more details.
    2 x+ G' K" u# g3 V# o+ }
  23. */
    5 I9 [  c, H% Z* c/ {' x6 d
  24. 3 w; N2 L4 U1 N, R
  25. #include <linux/module.h>* s8 K% D0 _8 l2 }8 ?
  26. #include <linux/init.h>9 c. ~% _+ i& |: x
  27. #include <linux/errno.h>
    5 n/ K; i& p! k2 N5 q
  28. #include <linux/types.h>+ b: L/ w- B7 t3 ?: S6 _
  29. #include <linux/interrupt.h>! y; w# `; s# A/ P
  30. #include <asm/io.h>9 ]( x8 l) D) L) S4 [% C: r
  31. #include <linux/moduleparam.h>
    1 V7 ~0 [* g, I/ S& f9 M
  32. #include <linux/sysctl.h>) @- M0 T# E$ _! R( r3 w0 I9 b
  33. #include <linux/mm.h>
    7 }! _: h( C& n# ^  c/ Y) h
  34. #include <linux/dma-mapping.h>: ]8 s% i( L, l. b0 {% d7 [
  35. " r% k" O% U' U' J/ R0 p  M
  36. #include <mach/memory.h>
    # j6 [0 j3 u7 }% }/ T9 m
  37. #include <mach/hardware.h>* {+ Z0 t& n1 O; K  V
  38. #include <mach/irqs.h>
    * z* Z, l& }/ L# f# F# P) E% p7 ?) C
  39. #include <asm/hardware/edma.h>' F5 L- u" ~* w: ?. o

  40. 5 n8 [; o/ o* j0 i+ g
  41. #undef EDMA3_DEBUG0 y/ c( m2 j$ _, w
  42. /*#define EDMA3_DEBUG*// E0 p! d3 k  c! p$ |: E: p; ~" ^
  43. / P" [; W( x; n* ^8 q$ ^
  44. #ifdef EDMA3_DEBUG8 l8 A  N" k, `# c' f- s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      h2 @+ _; U* @% [4 Y$ m2 b% t! w& Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' S, Z. |" {' X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 a$ t% |: @8 `
  48. #else4 ]5 j9 X0 _3 G% A' [+ L9 u# C
  49. #define DMA_PRINTK( x... ). s/ x4 o7 U0 ?" p: b
  50. #define DMA_FN_IN
    , r" U0 A# t) y3 J% @. g7 Y- z, @  j
  51. #define DMA_FN_OUT
    , O' o! e$ e( z% z4 K! E2 }5 I4 z: G
  52. #endif& @- P7 N# y3 v

  53. 5 p( [4 t1 R, H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 T- ?7 h) S% e5 B4 X
  55. #define STATIC_SHIFT                3
    , _) a: Y9 N$ h5 s* n; O9 r
  56. #define TCINTEN_SHIFT               20
    . ~7 ], ?( K8 w: o/ O& |
  57. #define ITCINTEN_SHIFT              21
    , b/ K) B, j7 d! E6 i; e7 l0 [! F
  58. #define TCCHEN_SHIFT                22
    $ v$ F) m3 Y8 ^1 v! m
  59. #define ITCCHEN_SHIFT               23
    7 V! n1 W( d( N8 A" d6 f; J( u
  60. + K. s3 {/ X2 O2 l" h  i- w
  61. static volatile int irqraised1 = 0;4 P. m  K" r% O! _8 L
  62. static volatile int irqraised2 = 0;2 J5 b$ x$ [* U

  63. 9 A+ ~* W8 a, {, I* i6 O: ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _. q5 C& h8 C* a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ M: L. t  `4 g9 {3 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B+ K+ I. A1 \, T
  67. ' q7 e, [3 j* S
  68. dma_addr_t dmaphyssrc1 = 0;  ]2 D5 s2 t) g2 H( W) R" \- y! D
  69. dma_addr_t dmaphyssrc2 = 0;, M; U$ N( g, D
  70. dma_addr_t dmaphysdest1 = 0;
    4 Q3 K! t2 H# i
  71. dma_addr_t dmaphysdest2 = 0;0 S" O% w" \! q+ p+ P+ I5 p1 t
  72. ' f9 r+ }! Z' E' W2 z0 A; g
  73. char *dmabufsrc1 = NULL;% F7 H* e. {$ ]. a, ]7 R4 c
  74. char *dmabufsrc2 = NULL;
    & K# S5 }: [) i, e, I
  75. char *dmabufdest1 = NULL;
    " Y; G7 }3 `" ~+ T4 O- m
  76. char *dmabufdest2 = NULL;8 n/ }: f" q! d% n& t  y  H$ @1 s

  77. ! ~/ r- u: I3 w- N5 S
  78. static int acnt = 512;2 r: c4 p" B. Z" `% x
  79. static int bcnt = 8;$ b7 Z9 ^6 C; D6 J. U* l) b
  80. static int ccnt = 8;
    $ f% Y& f9 q8 b& b
  81. ) d9 J7 _. w  c! {7 }0 A
  82. module_param(acnt, int, S_IRUGO);8 ]% @: Z7 R$ B4 o- G
  83. module_param(bcnt, int, S_IRUGO);( J0 p- t4 M- l) m. v3 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( }$ q' p' t" J# b0 A' u8 L

8 r% `0 q8 x+ F7 u$ |, C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ u- c; R, E* R2 t5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 H1 A9 U9 b$ f! M# B+ C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 C+ o( L+ p  C. Y
( w, l" x1 k3 V

, n, q7 l2 ^- |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-5 15:17 , Processed in 0.044528 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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