OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 o; N5 N; p  B0 M. k- ^
  1. [code]EDMA sample test application
    1 @2 L8 E6 `6 j
  2. /** X! e/ V  ?! Y7 d3 [
  3. * edma_test.c
    ' ]/ j" X5 _/ y0 @. ]! N% W
  4. *
    2 S' S& B) C1 S. p
  5. * brief  EDMA3 Test Application3 G/ s3 ~/ C; H: `
  6. *; q0 _1 H8 A0 E: Q8 G' g1 c0 W
  7. *   This file contains EDMA3 Test code.0 Y' M9 s/ J8 u+ V; g* c& N* `! P
  8. *
    * r) L4 J2 s9 g+ H4 d( s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # f0 @7 ^, H4 p% M. O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A2 O! H0 I* T
  11. *         TO CHANGE.3 }7 B4 i7 }$ ^* [1 _2 z% i8 o
  12. *) q2 t2 X5 |1 X) W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 g' T+ P5 V; T3 {/ D/ i4 m
  14. *
    & N! H1 `( B3 F) f( j
  15. * This program is free software; you can redistribute it and/or! x4 K  C* ]9 z* F- a' U
  16. * modify it under the terms of the GNU General Public License as$ V  x8 C4 v& c1 ~! V0 W- }
  17. * published by the Free Software Foundation version 2.
    6 ?' v; l' ]% a
  18. *
    5 _2 J# O$ k( f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. s  e; B! y! s: t) j8 R/ S7 [  h
  20. * kind, whether express or implied; without even the implied warranty+ q3 V7 {9 l$ Z2 d5 t; ^# f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % _* U% W' n+ P1 N, D( t8 D
  22. * GNU General Public License for more details.8 Y; ]5 {) z/ X4 {0 k/ r) @+ ]8 {! d
  23. */
    ; m1 f! b  D* B3 H/ j

  24. 8 ?3 N! _8 L4 ~2 ?2 q  Y# @% `' C
  25. #include <linux/module.h>
    1 U. v# e1 N8 u# I4 P* J$ R
  26. #include <linux/init.h>! [7 W/ }. p/ o+ }& d7 e
  27. #include <linux/errno.h>1 |/ y9 s1 e( C" n9 M  ]$ g
  28. #include <linux/types.h>) ?+ N+ i7 a2 |& b. k+ b
  29. #include <linux/interrupt.h>
    $ l. n' Y2 n6 P8 R; C, k; W
  30. #include <asm/io.h>
    : w( _, L* P: ~: z' J0 F; n. p
  31. #include <linux/moduleparam.h>
    % N' C8 A" H9 u8 `) B
  32. #include <linux/sysctl.h>' v: y' X/ P. [/ U' R
  33. #include <linux/mm.h>
    ) q$ C( z) a" q8 s  Y. L9 U
  34. #include <linux/dma-mapping.h>
    - Z, h+ `, ]. V; e6 T+ d0 Y
  35. 3 z; ~1 I/ S5 @! q& P; s% t2 f6 U' ~
  36. #include <mach/memory.h>
    + m" \2 i5 t* g& X' s2 `
  37. #include <mach/hardware.h>( K: T6 n5 }, B
  38. #include <mach/irqs.h>
    & k! u( ^1 R/ ^  F* i  T$ t# \. O0 ^! q# Y
  39. #include <asm/hardware/edma.h>
    ' N( B' L2 g- v, k
  40. & S- D7 ~6 r/ b: @2 ?
  41. #undef EDMA3_DEBUG! D1 F% {- v, a( s  ^- \
  42. /*#define EDMA3_DEBUG*/: |* P9 \, \, t4 q) e3 n
  43. ) |4 G" W- X: r) @
  44. #ifdef EDMA3_DEBUG
    + I) L7 o$ S: m3 a3 S7 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 I/ q# Z8 {& Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 X5 V, c9 v( l4 N/ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % J9 f9 x5 E( q- g# |) J
  48. #else
    ! k7 p% l; n0 x% B, l
  49. #define DMA_PRINTK( x... )- D% l4 q2 ^! I7 i; F
  50. #define DMA_FN_IN3 K6 a& X4 o2 c! P, c
  51. #define DMA_FN_OUT
    6 A( h" V1 U; X( \& Z2 z2 R% O
  52. #endif
    $ a5 q" {; a0 R+ o! S! Z
  53. : p( b1 t, _6 `9 r" [+ z3 W3 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 [1 o* d1 ]8 x  G
  55. #define STATIC_SHIFT                3
    - D# K6 {5 l8 o- g/ ?( ^
  56. #define TCINTEN_SHIFT               20
    : X+ j* g& C2 ?) X/ |
  57. #define ITCINTEN_SHIFT              21
    3 P* w3 @& t' @! V( ~
  58. #define TCCHEN_SHIFT                226 w9 _: ^, ^0 Z- H  [# h
  59. #define ITCCHEN_SHIFT               23  m  O  A5 e* [

  60. ) Z+ M$ `- q2 R: V! Z2 r
  61. static volatile int irqraised1 = 0;
    7 r+ R$ L" ~9 K8 i8 `) `
  62. static volatile int irqraised2 = 0;8 l$ \# G7 N' G' t. R

  63. 7 D2 n' q+ g* D1 J" m1 l0 W1 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B9 @' w  B+ {$ j! a: j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 g6 e8 q9 x* x2 A2 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ i  ~  R6 ?" R* k/ F0 l; P. s  J' u

  67. % |$ n9 q9 Y* A4 Z! U" D  z
  68. dma_addr_t dmaphyssrc1 = 0;" U. q, P5 Q' {0 v7 v) @( k' h
  69. dma_addr_t dmaphyssrc2 = 0;
    / x  \! Z9 W2 e( D5 k
  70. dma_addr_t dmaphysdest1 = 0;( c. ?% y! U+ w% N
  71. dma_addr_t dmaphysdest2 = 0;
    * g9 Q$ H% b. a

  72. ) H! E  E+ B0 ]" b8 x9 ?1 F) N: s0 l
  73. char *dmabufsrc1 = NULL;
    # Q" ~4 G0 `% L4 i7 f: Z8 J, s# `6 [
  74. char *dmabufsrc2 = NULL;' v0 o; W1 V7 v% R9 Z4 ?3 {
  75. char *dmabufdest1 = NULL;( }4 l1 Q7 F0 O; V8 q
  76. char *dmabufdest2 = NULL;4 P, V& I- s7 c# y

  77. ' \) y0 A% N5 S6 o7 e
  78. static int acnt = 512;
    ! M- U2 D1 O3 b" Y: I
  79. static int bcnt = 8;5 ]* y& l6 v" {. L( b
  80. static int ccnt = 8;
    3 }$ G& t) o6 i! v" {
  81. ; i) D  S. x( h/ J9 A
  82. module_param(acnt, int, S_IRUGO);
    " K; D( y( D* y/ P. h
  83. module_param(bcnt, int, S_IRUGO);
    ) W  N! [8 n  _3 i& h+ _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 q7 D0 j# O2 E/ n, b; ~2 C
: b3 k$ Z) E9 \, U- p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ S2 v& E! m: y* ^9 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ p2 L2 k4 U2 D9 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 O9 n' w! X) ]) ~3 b
1 X  G4 A! G% l' y% Z* z: A$ ~. n5 Y5 P& P) ]& B8 P+ d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-13 11:14 , Processed in 0.038578 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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