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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * e" g) w& Y! k* s4 V( j* f4 O
  1. [code]EDMA sample test application
    ; P% r* O" u, q% {  [
  2. /*
    5 I; r+ A4 ]1 {1 N, U6 P
  3. * edma_test.c
    # C/ S# l8 M. A" n1 h# @' q: g
  4. *) E* R5 r4 V7 ]. N+ J3 ^) `& Y5 H
  5. * brief  EDMA3 Test Application1 _; n6 P! ~4 g  J/ m
  6. *5 A7 u# y9 y  j1 I( g. Z/ G
  7. *   This file contains EDMA3 Test code.! j- [8 h( W! I
  8. *
    2 ^1 q1 `4 K. o! c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % [( z0 h0 z# _$ v/ H- f- ^/ B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 c0 N, |$ X4 ~5 j
  11. *         TO CHANGE.8 v0 W7 P! B/ ~
  12. *
    : O6 _1 C1 L$ k! Q$ M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 r" g0 J  A( ~/ I' i# r" T
  14. *- v. H' n  g  s- `2 c
  15. * This program is free software; you can redistribute it and/or4 K( S& }" B  }
  16. * modify it under the terms of the GNU General Public License as% ^. V" O: W0 B9 ^
  17. * published by the Free Software Foundation version 2.
    # f+ ]8 W! [/ m# E7 G
  18. *
    . h+ n" \) t5 S# `8 Y  R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : w6 Y6 x0 `* e3 d, ?4 y8 G+ @% K
  20. * kind, whether express or implied; without even the implied warranty- s- h* p. d$ w. ~8 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 k  q% O# c( Z
  22. * GNU General Public License for more details.
    7 d/ w6 ~: N7 v; i
  23. */9 y: ]! F3 R: r6 |: n: |; {

  24. 1 T% s4 i( Z7 |! h' {$ Z8 u) @1 o
  25. #include <linux/module.h>2 E3 I3 ]! r, t0 V! h4 u
  26. #include <linux/init.h>
    0 c4 b+ p- h, k% x6 ]
  27. #include <linux/errno.h>
    9 h; E9 T# S$ p, X
  28. #include <linux/types.h>
    6 N8 j( W6 A8 D9 g$ @1 U9 L
  29. #include <linux/interrupt.h>
    7 J3 E7 O, \0 D
  30. #include <asm/io.h>: U# ]) B) p. x1 ^/ l4 K; b+ u( V
  31. #include <linux/moduleparam.h>; W5 G/ L( A+ H* V
  32. #include <linux/sysctl.h>
    : G3 W$ Y( k9 F0 x. d5 }
  33. #include <linux/mm.h>: z5 k) K( S' `& K
  34. #include <linux/dma-mapping.h>
    / l; D" V. ?. R# i1 I% z# o, [
  35. % l  L2 I7 P+ Y! K/ m& A* R5 ~
  36. #include <mach/memory.h>
    ) t  @2 g6 k& v3 s' w
  37. #include <mach/hardware.h>
    0 ]% l$ H7 r' W9 S* i7 ?0 M
  38. #include <mach/irqs.h>- L0 M$ ^$ P7 G5 `1 S
  39. #include <asm/hardware/edma.h>
    & M$ B0 c2 _" c
  40. $ {4 l3 s3 B* a9 @+ A
  41. #undef EDMA3_DEBUG- c7 U; i4 p. r+ c  S
  42. /*#define EDMA3_DEBUG*/
    % ?  x0 t5 g7 r9 K
  43. 7 W  T6 X5 u8 F' I, ^1 q0 C' N8 o' n. E: D
  44. #ifdef EDMA3_DEBUG
    8 A0 C% P1 B! ?9 N' S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 a$ J% o# {" R! ^; U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' _+ u+ n0 {6 _' C9 I, A. H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# o/ b/ x$ `$ @0 R3 r
  48. #else
    0 P# B, R* }. C
  49. #define DMA_PRINTK( x... )
    - ]2 u) w: y, B
  50. #define DMA_FN_IN
    : S* ~4 F3 F) s9 |
  51. #define DMA_FN_OUT" `: z. j( a; `# C: G' |2 t
  52. #endif
    % C7 ~1 R! e* v9 k

  53. ! `  n$ S+ W5 S8 _) M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 i: a  W8 m: E" w7 @
  55. #define STATIC_SHIFT                3
    ( p* D0 A8 r! d6 [: u$ T. t' n/ I
  56. #define TCINTEN_SHIFT               20# z! o0 n  Z9 a7 \
  57. #define ITCINTEN_SHIFT              21
    ! q/ H1 m+ j0 G  M+ H% r1 O# X
  58. #define TCCHEN_SHIFT                22, k3 X9 o6 x% H8 K5 M* r; H# S! Q
  59. #define ITCCHEN_SHIFT               23
      C9 K" [. @% p) I9 ]" f0 j
  60. % v# i7 m$ d8 M
  61. static volatile int irqraised1 = 0;
    0 \# E* f+ J! @3 Y, f0 \
  62. static volatile int irqraised2 = 0;3 Y: w! Q, t5 V

  63. , m6 y: g6 s& r- h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) N' b/ A. Y2 G, u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 T, w% e/ [4 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j  l1 ?; y' V1 h/ g
  67. 1 O, A7 [; ~, r' G
  68. dma_addr_t dmaphyssrc1 = 0;* I* R, ^6 g3 [3 M5 J4 [( y2 ~
  69. dma_addr_t dmaphyssrc2 = 0;7 }  y& L, B( D, J9 M
  70. dma_addr_t dmaphysdest1 = 0;
    - N& @: U) |& d$ U: j9 I! s
  71. dma_addr_t dmaphysdest2 = 0;, H$ x- K& {* U- @

  72. # S3 t! `$ m. c3 |8 G  o3 L! `5 W
  73. char *dmabufsrc1 = NULL;
    ; V+ W# N' V( i
  74. char *dmabufsrc2 = NULL;
    9 A) \) q0 z5 {5 h6 L  |" b; K
  75. char *dmabufdest1 = NULL;
    ) n6 z7 \' A: h- I
  76. char *dmabufdest2 = NULL;4 |; q. X& g. f% i. _# M
  77. 0 |2 g: s( F0 e$ z5 D
  78. static int acnt = 512;  a9 _- S" W* B$ p
  79. static int bcnt = 8;" I: G$ s% v0 W/ G, S. i& I
  80. static int ccnt = 8;
    : V3 c4 U. c4 l# U
  81. 4 n( R& e/ V6 P( |" y6 ?8 _1 `
  82. module_param(acnt, int, S_IRUGO);
    & X6 M, Y( F3 W& R  O
  83. module_param(bcnt, int, S_IRUGO);
    " X% `& j' x  e8 u! T8 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 w+ B  @! }+ i. I3 C. G( z5 f
% e# H( N6 {4 p& B" O" [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Q3 ~) n  F. N/ i+ }* e% v. K. o; x; S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. {- j& m% a) D% n+ d+ m6 _1 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' I. z2 O% X# V" w* ]+ Y

4 m  F" C5 [" Z+ s$ e; w/ T
2 e5 _- f# o- g% S( b1 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 20:10 , Processed in 0.062592 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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