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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* [/ @7 b& y+ w% |
  1. [code]EDMA sample test application
    3 j- g$ t6 L8 t4 N& M5 @* e
  2. /*: l8 l% v, I4 M% L* s0 M& M, K
  3. * edma_test.c
    9 x* S* K* N) e  z# K3 K) S
  4. *1 C  G3 Q# q, l
  5. * brief  EDMA3 Test Application5 I) u; o2 `7 D$ J6 J& |# O
  6. *
    , X/ s3 C, P9 Q2 T5 Z
  7. *   This file contains EDMA3 Test code.( B1 h* K8 \! p' O" t8 w7 R
  8. *
    2 U( a" Q( E& m2 j1 R) ?6 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! w$ B! s2 y. ]9 v, s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) F' `4 }2 b$ O; t: O3 Q
  11. *         TO CHANGE.
    ) R& n1 N; S7 a& b5 e/ h" m& A# p) r
  12. *2 k% r: |% D9 L% S, U: ]/ }* X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- [! d, Z1 U, l& h; P8 f5 v2 L5 ^
  14. *
    7 }5 y; }& ^0 ?# B" ?
  15. * This program is free software; you can redistribute it and/or
    1 G( l) `9 x1 f' n# x) I& i7 L
  16. * modify it under the terms of the GNU General Public License as
    ' y  t. f7 h0 A  b) i& B
  17. * published by the Free Software Foundation version 2.( S9 H! f% a' S/ K* f: e
  18. *
    % X# h- A1 `9 w6 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) g" q5 L  o# D! o0 v: E+ D' d
  20. * kind, whether express or implied; without even the implied warranty  e4 S( W5 P0 d* a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + D2 q5 K& R3 R
  22. * GNU General Public License for more details.
    * b6 z: N+ j' B5 G- _
  23. */5 ?4 U' {" ~: E
  24. ( V" K1 _' `/ Y6 m
  25. #include <linux/module.h>
    4 S' Q- j( J$ x- Y
  26. #include <linux/init.h>/ b) ]; I+ s; T
  27. #include <linux/errno.h># [# a0 M% B( e/ v) H$ I8 c
  28. #include <linux/types.h>
    / D6 h+ X! W, s' d/ f; M. o, D
  29. #include <linux/interrupt.h>  L- b+ P( W- t8 a# |. H" T+ t
  30. #include <asm/io.h>; |9 G% }; @! {' v2 Z
  31. #include <linux/moduleparam.h>
      ~, c) Y; H, A* z. ^
  32. #include <linux/sysctl.h>' M6 |  \0 `5 v
  33. #include <linux/mm.h>5 Z5 ^( B3 v+ h; l9 m4 h" |# G
  34. #include <linux/dma-mapping.h>
    0 h9 @; H# Y5 C9 n0 D+ x, [: p
  35. ! y) \$ F4 f5 E6 o
  36. #include <mach/memory.h>( t6 m( G0 w0 G1 g3 r0 P4 n* a7 U
  37. #include <mach/hardware.h>+ @3 e) N8 a/ \4 U
  38. #include <mach/irqs.h>
    4 n$ u; \* S- U
  39. #include <asm/hardware/edma.h>
    & r9 q& z. \; a% {4 z
  40. - P, V1 b) Z* {* O
  41. #undef EDMA3_DEBUG
    2 T) }) S- F4 y3 c/ D2 K
  42. /*#define EDMA3_DEBUG*/
    9 c; t8 E# W9 d7 M/ R

  43. - g# \8 l, D" ~
  44. #ifdef EDMA3_DEBUG
    % R  g, W/ l% s3 i; T  O6 w# {! [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      s$ X4 ~0 {. l9 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 j- a5 D. |3 g6 j2 i6 p- U! ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 _5 o" B. ~3 C2 {, C9 S8 P2 X. R% x
  48. #else
    4 j4 ~6 `' E' z2 ~6 ^
  49. #define DMA_PRINTK( x... )1 ^5 P$ F# B9 y5 ]. t& I- d' W
  50. #define DMA_FN_IN
    6 l2 q7 G. O; x+ [% W, a
  51. #define DMA_FN_OUT+ \* r9 u- V1 M; u+ A
  52. #endif
    ) T; L* |: v! v2 ?7 [
  53. ' c' T+ e' N# s  _7 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 d/ i! R, A, X  T
  55. #define STATIC_SHIFT                3
    & k( |% h+ |% W1 d6 p
  56. #define TCINTEN_SHIFT               20
    * l: F  |: w2 r4 f* t" Y& j: t# f
  57. #define ITCINTEN_SHIFT              219 D1 g0 T1 {7 D2 h6 h0 I. r9 Y
  58. #define TCCHEN_SHIFT                22: X4 c; R" [$ |8 k2 Q
  59. #define ITCCHEN_SHIFT               23
    ! i4 z# B/ i. @( V7 g8 ]
  60. " m2 K( \- L% c+ |" l
  61. static volatile int irqraised1 = 0;$ I, F7 i0 Y/ [+ O* B' z8 W
  62. static volatile int irqraised2 = 0;1 @" L6 L/ U# n3 d% e

  63. + F0 T7 N, A/ b! G, p/ {8 {5 H% B: @) T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G0 E7 }$ F( [+ L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 U8 a0 ^7 K; C3 r% \0 m8 ^  f. |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 }, W3 n5 [& r5 _
  67. # W$ h# b, B. M" m" t% ~
  68. dma_addr_t dmaphyssrc1 = 0;% o; p  v$ a" h- \9 [1 Y1 y
  69. dma_addr_t dmaphyssrc2 = 0;) F' n% x) z, C* Y% T3 i
  70. dma_addr_t dmaphysdest1 = 0;
    2 ~4 u1 P0 Y# Y5 A$ q+ T
  71. dma_addr_t dmaphysdest2 = 0;
    # ?8 u* ?# g6 W- c3 h% J0 ]

  72. - ?" S$ X# C% `( l
  73. char *dmabufsrc1 = NULL;% J6 d6 q) Y# u8 s: `
  74. char *dmabufsrc2 = NULL;% h: M8 I: z; ~' m- S, S/ `
  75. char *dmabufdest1 = NULL;
    " n& V# v) X' p. s, k
  76. char *dmabufdest2 = NULL;
    & W7 L3 W& k! Q( `
  77. ; `6 [, h; p' Q& M) r; g8 Y4 Q
  78. static int acnt = 512;4 B2 v: F  E0 r( q, w8 A8 P
  79. static int bcnt = 8;
    ! N! C" H( P8 \7 I5 m" e; Z
  80. static int ccnt = 8;
    2 G6 s  e6 |; h

  81. 8 q/ t- @* x) C* q
  82. module_param(acnt, int, S_IRUGO);1 h" s! A3 q. x; `
  83. module_param(bcnt, int, S_IRUGO);
    " P! G: L* f7 `* w. L( R5 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% z3 {' |" Z9 c( |. V
. K$ }' o) H/ u4 y1 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 g# i) v: w9 ~0 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Y2 g% \7 n8 f7 X$ ?, Q9 o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* _) t, b7 U6 c) g2 o7 \* L  Z- I& M
7 E# N% {3 v" z: h' S: J) [' Y$ u) A5 }1 A3 V* }- n1 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 21:27 , Processed in 0.039635 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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