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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 l/ }9 I5 R( ~$ s. b5 q: |
  1. [code]EDMA sample test application) I: j( u" f* r$ D% n9 P, a, g4 B
  2. /*$ ?- \9 \! \6 M: P+ K8 B1 g, t5 I
  3. * edma_test.c
    % f* q. F, [7 f4 P3 P; P
  4. *
    9 {3 m) ~4 \, J& X  V
  5. * brief  EDMA3 Test Application! w  t! M3 p: `( u. U  F' h1 h
  6. *6 L% I! m' \/ {: U) ], g
  7. *   This file contains EDMA3 Test code.
    , F; u9 D' P* G' h
  8. *
    : u" q0 S9 H* v5 d) x  a1 s& L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 m9 l: H0 `( j) D' i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ?$ p/ A: ^5 [, y& }, W  ~
  11. *         TO CHANGE.1 C4 x5 [' p+ @4 _; Y0 l
  12. *
    + t. p% Q! V' l, K$ t% u6 }# ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 [! R( A7 I4 T
  14. *
    # m2 \% v. v* h+ c) C8 a! B
  15. * This program is free software; you can redistribute it and/or
    0 ~8 z& U- T6 d! ?
  16. * modify it under the terms of the GNU General Public License as. O( J/ o( l+ \- w% p4 y5 w- L
  17. * published by the Free Software Foundation version 2.
    3 X! I5 P: U3 j* X5 c1 d& z$ d
  18. *
    1 T/ f% Q  V/ z' D) R. ?) r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. t6 Z% Z/ D! }0 `, ~
  20. * kind, whether express or implied; without even the implied warranty* l1 V3 v2 P, R5 w& s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: G, a2 Q/ [% a* i( U
  22. * GNU General Public License for more details.: D$ n& c; l/ m
  23. */" a4 z  J' h5 b" \; g0 w% X: y. Z2 g

  24. & C/ g2 ?. l; I+ t9 ]# V
  25. #include <linux/module.h>
    + `+ Q" p% k1 f( P: L! V( v; f) O
  26. #include <linux/init.h>
    8 l8 |+ M3 T. H+ g
  27. #include <linux/errno.h>
    ! R# Y) O8 F# O- w0 T
  28. #include <linux/types.h>
    & `  a; p8 E  @4 `6 \4 ?! E8 N' j5 X
  29. #include <linux/interrupt.h>
    - o4 S& O9 r, o- D! f3 I
  30. #include <asm/io.h>; ^3 E$ x$ K: {# r2 F2 e+ j' @
  31. #include <linux/moduleparam.h>
    $ E4 [: V+ r+ b% c1 }3 O
  32. #include <linux/sysctl.h>
    ; z8 C5 P8 i9 y
  33. #include <linux/mm.h>
    # c2 b( L  W8 E/ I9 Q
  34. #include <linux/dma-mapping.h>
    3 w) G5 h: z* @) J
  35. 1 g: z# t$ |9 M& l! n0 O
  36. #include <mach/memory.h>! e4 {# z# Y% k: V0 P4 w
  37. #include <mach/hardware.h>
    " [7 K  U7 k, C% V/ I
  38. #include <mach/irqs.h>
    , o* P, A, \# W& o
  39. #include <asm/hardware/edma.h>
    3 u- l8 y' {; q" m  y
  40. 0 J$ S/ R' ?8 w! B
  41. #undef EDMA3_DEBUG
    . |( f5 W% H( s) O7 ]
  42. /*#define EDMA3_DEBUG*/
    / u# ^( Q/ U( B  _
  43. 6 U0 E# i% u% f& p9 e. _
  44. #ifdef EDMA3_DEBUG
    - M. N  }  [9 L: w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & ~: @# ^  t; J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 U( ]4 k6 o# K6 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # b3 c! E# d# q; A
  48. #else8 Z  [' B' E! U+ a
  49. #define DMA_PRINTK( x... ), j7 D- X6 Z: I% Y2 H/ v1 ?: q0 J! l
  50. #define DMA_FN_IN
      {6 t) q/ |) }3 C  C9 s5 ^; ^
  51. #define DMA_FN_OUT
    2 b, l6 I2 H& y6 l" y1 e2 `) c, @
  52. #endif
    " O0 @2 a! M, j7 k  p
  53. ' W) C, E: ]- U" R2 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' T  h- A3 e4 @' K* d4 I0 Q9 {. v
  55. #define STATIC_SHIFT                3
    " m  M, t' Q9 o" ~# Z4 m
  56. #define TCINTEN_SHIFT               20" u4 B0 Y5 Z6 Z, K( d
  57. #define ITCINTEN_SHIFT              21. U7 u- u; [' k/ c! d% N4 C9 R
  58. #define TCCHEN_SHIFT                22; Z  B. O3 y. T0 |! W+ B7 p
  59. #define ITCCHEN_SHIFT               23
    " e% S. \8 c1 D& j+ e6 U3 \# Y

  60. + h" S# n; R( u3 N* @5 s
  61. static volatile int irqraised1 = 0;7 \: a/ u' N4 n* o
  62. static volatile int irqraised2 = 0;
    + f9 H( J$ E6 h0 D, O9 T

  63. ( `3 I5 H" i) W9 I; F5 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 W/ f! Q3 q5 j1 c" M* k  Q  ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' b5 I$ z( g9 F8 \$ T$ l" Q  @: v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : o4 D, E( y5 Q9 _* X# }  o5 @
  67.   S2 q% z) h3 b/ J  V# p
  68. dma_addr_t dmaphyssrc1 = 0;
    $ _" S% k0 v# \" Z) Y' H
  69. dma_addr_t dmaphyssrc2 = 0;
    : j/ F) D, N$ K+ D+ m
  70. dma_addr_t dmaphysdest1 = 0;9 f* ^0 q# E0 ~: _, O! D5 c
  71. dma_addr_t dmaphysdest2 = 0;) Y* ^6 z) s! Q) h* F/ y7 ~* D, m  r

  72. 5 ?% G% [7 ~' n- P" Z7 o2 a
  73. char *dmabufsrc1 = NULL;
    # t' _+ V% U; j
  74. char *dmabufsrc2 = NULL;
    + i# {8 V) Z% {# y$ s. e
  75. char *dmabufdest1 = NULL;
    ; Z; V0 ~& _: y. ]$ h0 E- H, W
  76. char *dmabufdest2 = NULL;
    # ~: t1 D6 Q; l$ ?

  77. , b% B  l# k7 f: h- {5 E
  78. static int acnt = 512;
    9 L% x; T7 Z* U
  79. static int bcnt = 8;
    ' Q1 \. k1 n+ n7 _2 Q0 ~. r
  80. static int ccnt = 8;$ W$ }% o" {8 Y4 L1 \& |

  81. 4 {* ]8 U6 v! N) j9 j
  82. module_param(acnt, int, S_IRUGO);; a5 S& v+ B3 {* P2 b/ c
  83. module_param(bcnt, int, S_IRUGO);
    2 x! ]4 t- C/ `% D) z* h0 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ E) K3 ^* a" {: C5 Y- q- T; K

/ g, Q; a6 H6 K  ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L* I1 m" P& J. E+ ^3 k# I; P, Y/ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 H$ |- }  I1 H7 c+ c* k8 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% q* l: ^* E0 [6 ^, g- e' h1 R# w; l7 A' o7 B
) ~; u% }* r! n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 09:30 , Processed in 0.040252 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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