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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: f" Q6 O9 m* [, |/ q; ?
  1. [code]EDMA sample test application! r- n) d& z* ?: `" M8 I# K8 A
  2. /*
    3 a9 d4 j! g# |& @0 ^  q/ W
  3. * edma_test.c7 m9 b& s  H" {2 y) X* V+ f
  4. *: F$ i. F3 T* Q/ B; D
  5. * brief  EDMA3 Test Application  ?: [/ E0 Y4 x
  6. *! S( \1 \5 O1 L4 I0 z& w- }
  7. *   This file contains EDMA3 Test code.7 D5 c7 g9 v/ Y  N( d% v; _
  8. *
    * t$ ~0 M9 A8 U1 w) ?9 d5 @: I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " a) F0 [3 P' s5 m9 G4 Y) ^$ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 z, W' `/ m# v) S  `7 {
  11. *         TO CHANGE.
    - i2 h8 {0 x- F- e+ l
  12. *2 [- N  y, b  i, p( {2 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  I& V( D# L* j5 K: m/ y
  14. *
    . ]& L! g6 u/ Q
  15. * This program is free software; you can redistribute it and/or% ~' ^* ?7 |5 |- ]6 [1 y
  16. * modify it under the terms of the GNU General Public License as) |4 ^, W' T7 }  q
  17. * published by the Free Software Foundation version 2.
    0 X6 U7 U  E0 p
  18. *
    $ [8 ]. H. A: G7 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( y4 S' e1 s' L
  20. * kind, whether express or implied; without even the implied warranty
    , ^! W9 |: U+ [+ |' `5 m# [' a4 ^7 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # f% [0 i+ v2 d% O; a2 s
  22. * GNU General Public License for more details.7 j. w0 c/ \4 Z/ f& C! E
  23. */
    % B! y! l7 k2 B( W8 X9 d1 |

  24. 2 E6 G6 [. j9 y1 B# b, Q; G
  25. #include <linux/module.h>$ }9 `% o5 }7 T0 L( a. J, J. d
  26. #include <linux/init.h>
    1 u, n/ d5 o9 j4 j
  27. #include <linux/errno.h>8 T" E" B7 q0 t  h6 x
  28. #include <linux/types.h>6 R3 G( Y( m# g9 w: ]  ?
  29. #include <linux/interrupt.h>6 R9 i9 m: z. \  R; H- b. g3 I) _
  30. #include <asm/io.h># o4 L% f$ n0 Y! S) `: ~+ ^
  31. #include <linux/moduleparam.h>
    & N- X# T$ b, s0 p7 a
  32. #include <linux/sysctl.h>5 U6 w) X% H$ d
  33. #include <linux/mm.h>
    5 u$ a- ?" U5 w( G' w( l, X
  34. #include <linux/dma-mapping.h>0 r8 f- N2 `4 R4 r# {

  35. 9 k2 h( S1 E7 n% L6 u( ]6 V# n
  36. #include <mach/memory.h>* a; M$ z% _; d
  37. #include <mach/hardware.h>
    : p! ?$ s6 z9 Q- I' v- |  Z2 B
  38. #include <mach/irqs.h>
    2 U4 S* M) ]# D# {1 M# v/ w
  39. #include <asm/hardware/edma.h>
    4 `3 [8 n% p0 j; v8 q, w
  40. " q# R: y$ @" }* g! J3 \% s
  41. #undef EDMA3_DEBUG
    8 K1 _/ x) t" s* q5 ?/ K$ K
  42. /*#define EDMA3_DEBUG*/
    / t4 K6 |+ D  b5 K
  43. 7 T% \4 P5 J7 A( Q) [
  44. #ifdef EDMA3_DEBUG0 ?% y" l4 X, O- u  N$ B: H1 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): l/ a: ?' W+ ]! n/ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ [" Z+ b( y, K: c7 f) W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , P- _5 Z" e2 b8 y# [
  48. #else) Z4 ?' M- v/ Z/ I: c. H
  49. #define DMA_PRINTK( x... )
    $ o8 O: c; y2 r  R! i5 \  M0 H- y& @
  50. #define DMA_FN_IN" _! h; r# w5 \; [- [) ~
  51. #define DMA_FN_OUT" A# H% |) Z8 d' C# [
  52. #endif
    * t& n6 x9 u" r& H
  53. " b/ D  V5 z8 ]3 f* r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 U4 v  W  [6 k  K
  55. #define STATIC_SHIFT                3; y; b4 m$ K  h. o
  56. #define TCINTEN_SHIFT               20
    9 k, o4 J& M) X
  57. #define ITCINTEN_SHIFT              21+ n2 h" x5 E# B5 Y# q, t
  58. #define TCCHEN_SHIFT                22) k, ?0 j1 Q( o5 l$ E3 ?- g, |0 r
  59. #define ITCCHEN_SHIFT               23
    5 j8 y  d" v6 ^: W# m  u) q! N* e
  60. 4 f# W% S; F# n1 h1 d* X. ?
  61. static volatile int irqraised1 = 0;2 u2 N2 Y  ~( T% q1 {
  62. static volatile int irqraised2 = 0;
    ; X+ i. i( G; o2 _" \
  63. ; r$ F3 c: {) k2 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 B" t2 d# Z+ C& a8 f; F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 t2 r) g0 X1 M2 l1 i1 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , o5 ^- Q, G5 s1 r" x

  67. 0 s9 G! e0 O1 H9 g; U4 k6 L" l. n
  68. dma_addr_t dmaphyssrc1 = 0;5 Y! ^' [& X( Z
  69. dma_addr_t dmaphyssrc2 = 0;# p- u0 F1 C. L  v
  70. dma_addr_t dmaphysdest1 = 0;# Z0 Y+ O# E  A$ Q
  71. dma_addr_t dmaphysdest2 = 0;
    " A1 \9 N2 a" ?; j! u

  72. " p. }3 B- P  k: U% O$ S4 X5 u4 \
  73. char *dmabufsrc1 = NULL;
    ! e3 g/ z* \) n8 V( m
  74. char *dmabufsrc2 = NULL;5 f3 ?, T# C8 Z  R/ x
  75. char *dmabufdest1 = NULL;
    & d+ N7 P$ K6 T
  76. char *dmabufdest2 = NULL;
    1 H) |1 X0 m" |2 t, v. \

  77. 2 I0 U# w5 _. u5 h& U
  78. static int acnt = 512;
    , G( U- K# I# s/ h5 s: Y
  79. static int bcnt = 8;) K8 `( g0 [' Z+ Q
  80. static int ccnt = 8;
    5 g! T0 ?+ g7 ]% [
  81. : i# t* i4 ~' K4 ?: i! S; ]
  82. module_param(acnt, int, S_IRUGO);. a5 O2 u# H+ j+ Y5 L
  83. module_param(bcnt, int, S_IRUGO);
    * }, l0 H* w$ g% p7 X" I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" W! {3 I9 c( x$ ^4 @: a1 \: b" C$ o
9 ^3 w0 s& ]) V! O7 g2 ~, G2 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  |. J& q4 k- @7 d# Y; u8 i% `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 u* t4 ^0 A2 J. u# `+ m$ b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. l/ l. I- E0 C, l2 Z; \
) X4 ^3 ^4 Z9 T# I0 F
. Q# d. y5 P2 E; l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-20 19:26 , Processed in 0.056753 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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